-
Notifications
You must be signed in to change notification settings - Fork 22
Fix for VSC windows #948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix for VSC windows #948
Conversation
|
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
@mashraf-222 tests are failing |
…nd added safty check
|
this feels extremely complicated for what should be a simple fix, can you fix the merge conflicts and I'll review it again. |
| # Attempt to remove worktree using git command with retries | ||
| for attempt in range(max_retries): | ||
| try: | ||
| attempt_num = attempt + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Not sure if this will execute successfully on win for multiple retries. If this then as discussed , this might also require some time delay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the loop starts with for attempt in range(max_retries):, which tries up to 3 times for windows, each iteration calls repository.git.worktree("remove", "--force", str(worktree_dir)). If it succeeds, it returns immediately.
If it fails, the code catches git.exc.GitCommandError and checks if the error message contains "permission denied" or "access is denied" to determine if it's a permission error. The condition if is_permission_error and attempt < max_retries - 1: decides whether to retry: it must be a permission error and not the last attempt.
When retrying, it logs the retry, then calls time.sleep(retry_delay), which starts at 0.5 seconds and doubles each time (0.5s then 1.0s then 2.0s). This gives Windows time to release file locks. After the sleep, retry_delay *= 2 increases the delay for the next retry, and the loop continues.
…ss handling as execute_test_subprocess
I fixed the conflicts and the workflow tests, it looks extremely complicated because this PR is fixing lots of bugs for windows vsc. |
Windows Compatibility Fixes for CodeFlash CoreThis PR addresses critical Windows compatibility issues that were preventing the CodeFlash extension from working correctly on Windows systems. These fixes ensure reliable subprocess execution, proper file handling, and consistent path resolution across all platforms. OverviewThe changes in this PR focus on fixing Windows-specific bugs related to subprocess management, file locking, path resolution, and LSP communication. These issues were causing hangs, crashes, and incorrect behavior when running CodeFlash on Windows. Bugs Fixed1. Subprocess Deadlocks on Windows
2. File Locking Issues in Git Worktrees
3. Inconsistent Path Resolution
4. LSP Message Delimiter Parsing Error
5. Malformed Windows Paths in LSP
6. Coverage Database File Locking
7. Console Window Spawning in LSP Mode
8. LSP Progress Bar Compatibility
Code Changes SummaryCore Subprocess Handling
Git Worktree Management
Path Resolution
LSP Integration
Test Discovery
Related ChangesThis PR complements our internal PR that fixes Windows path handling in the VSCode extension UI components. Together, these changes ensure full Windows compatibility across the entire CodeFlash ecosystem. |
|
@mashraf-222 status on this? |
waiting for a review. |
PR Type
Bug fix, Enhancement
Description
Normalize paths for Windows compatibility
Use worktree paths in LSP initialization
Robust relative path computation with fallbacks
Case-insensitive filtering of files
Diagram Walkthrough
File Walkthrough
functions_to_optimize.py
Case-insensitive path filtering for Windowscodeflash/discovery/functions_to_optimize.py
beta.py
Use resolved worktree paths in LSP initcodeflash/lsp/beta.py
optimizer.py
Robust mirror_path with Windows-safe normalizationcodeflash/optimization/optimizer.py