Skip to content

fix: keep live watcher fresh across atomic directory replacements - #710

Merged
justrach merged 1 commit into
release/0.2.5843from
codex/watcher-atomic-release
Aug 27, 2026
Merged

fix: keep live watcher fresh across atomic directory replacements#710
justrach merged 1 commit into
release/0.2.5843from
codex/watcher-atomic-release

Conversation

@justrach

Copy link
Copy Markdown
Owner

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:

  • macOS: 1,070 passed, 4 expected skips
  • MCP E2E: 58/58
  • native Linux ARM64: test-index 216/216
  • repeated directory replacement: 30/30 plus 100 sustained saves
  • ReleaseSafe builds: macOS, x86_64-linux-musl, aarch64-linux-musl, x86_64-windows-gnu
  • experiment-694 median first scan: 632ms base vs 637ms head (+0.8%); quiet/edit paths unchanged
  • uppercase private-key path/content checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/watcher.zig
for (self.unwatched.items) |path| {
dirty.put(path, {}) catch {};
}
for (self.unwatched_dirs.items) |path| dirty.put(path, {}) catch {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@justrach
justrach merged commit 1c6bc98 into release/0.2.5843 Aug 27, 2026
2 checks passed
@justrach
justrach deleted the codex/watcher-atomic-release branch August 27, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant