fix: keep live watcher fresh across atomic directory replacements - #710
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 282ea87b76
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for (self.unwatched.items) |path| { | ||
| dirty.put(path, {}) catch {}; | ||
| } | ||
| for (self.unwatched_dirs.items) |path| dirty.put(path, {}) catch {}; |
There was a problem hiding this comment.
Prune deleted directories before retrying their watches
When a watched directory is deleted, its key remains in dirs because the reconciliation path never removes directory entries; the subsequent arm records the missing path in unwatched_dirs. Adding every such path to dirty here then makes dirtyForcesDirectoryScan relist its parent every two seconds indefinitely, even after all files beneath the deletion have been reconciled. On large trees this permanently defeats the quiet-cycle optimization, so vanished directories should be removed from the directory/watch state rather than retried forever.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
Makes the live watcher use pinned root capabilities, exact file/directory identities, add-before-retire watch rearming, overflow reconciliation, and first-turn context scan gating. Secret paths remain excluded, and large test queues now live on the heap for Linux/Windows stack portability.
Validation on exact head: