Remote upload watch mode was effectively unusable on large workspaces#49
Merged
m1rl0k merged 1 commit intoContext-Engine-AI:testfrom Dec 9, 2025
Merged
Conversation
(e.g. ~6K files) on Windows due to two issues:
- The standalone client’s SimpleHashCache reloaded file_cache.json and
re-validated every cached path on each access, causing O(N^2) Path.exists()
calls and constant file_cache.json rewrites.
- Both standalone and non-standalone clients re-hashed the contents of every
candidate file on every watch iteration, even when mtime/size were unchanged.
This change:
- Updates standalone_upload_client.SimpleHashCache to:
- Load file_cache.json once into memory and run the stale-check only once
per process.
- Keep an in-memory dict for all subsequent get/set/all_paths calls.
- Stop flushing the cache file on every set/remove, eliminating the
continuous rewrites during watch.
- Adds an in-memory stat cache to RemoteUploadClient.detect_file_changes in
both scripts/standalone_upload_client.py and scripts/remote_upload_client.py:
- Tracks (mtime_ns, size) per absolute path.
- Uses stat() to short-circuit unchanged files and only re-hash files whose
stat changed or are new.
- Keeps initial behavior of treating the first watch iteration as a full
sync (all files "created"), but makes subsequent iterations fast and
responsive even on large Windows repos.
Result: both standalone and non-standalone --watch modes now detect single-file
edits quickly on a ~6K-file Windows workspace without hammering cache files or
re-hashing every file on each interval.
m1rl0k
added a commit
that referenced
this pull request
Mar 1, 2026
Remote upload watch mode was effectively unusable on large workspaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(e.g. ~6K files) on Windows due to two issues:
This change:
Updates standalone_upload_client.SimpleHashCache to:
Adds an in-memory stat cache to RemoteUploadClient.detect_file_changes in both scripts/standalone_upload_client.py and scripts/remote_upload_client.py:
Result: both standalone and non-standalone --watch modes now detect single-file edits quickly on a ~6K-file Windows workspace without hammering cache files or re-hashing every file on each interval.