Skip to content

perf(main): gate idle git-common polling + coarse-FS add/remove fix (re-open of #9882) - #10074

Merged
nwparker merged 3 commits into
mainfrom
nwparker/perf-git-common-idle-gate
Jul 23, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/perf-git-common-idle-gate

Conversation

@nwparker

@nwparker nwparker commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Re-opens #9882 (auto-closed when its stacked base #9849 merged + branch was deleted). Contains only #9882's changes, cleanly rebased onto main (which now has #9849). Adversarial gpt-5.6-sol-xhigh re-review CLEAN. Includes the two review fixes: (1) always-enumerate the worktrees dir to catch coarse-FS same-granule add/remove, (2) ENOENT-vs-transient readdir error handling so a transient failure can't fabricate worktree deletions. Verified: git-common tests 35/35, typecheck:node clean.

Made with Orca 🐋

nwparker and others added 3 commits July 22, 2026 20:40
…FS add/remove

The worktrees-dir readdir was gated on the dir's mtime:ctime:ino:size signature, so on
a coarse-mtime/FAT filesystem a same-granule add+remove (all four fields collide) went
undetected until the ~30s index backstop. A single readdir of a small dir is negligible
next to the per-entry structural stats that already run every tick, so always enumerate —
the listing is the authoritative add/remove signal. The expensive per-entry index read
stays gated on each entry's own dir signature; onFullScan now reflects the ungated
index-metadata backstop fan-out (the real periodic cost) rather than the readdir.

Co-authored-by: Orca <[email protected]>
…on readdir failure

Follow-up to always-enumerating the worktrees dir: the readdir catch-all treated ANY
error as an authoritative empty listing, so a transient failure (EIO/ESTALE/EMFILE,
network/SSH hiccup) emitted a false delete for every linked worktree (and a false create
next tick) — and enumerating every tick widened that exposure. Only ENOENT (dir truly
absent) now yields an empty listing; other errors retain the known entries so per-entry
stats still run and a real removal surfaces as that entry's own stat miss. Adds a
regression test (readdir → ENOTDIR) asserting no false delete.

Co-authored-by: Orca <[email protected]>
@nwparker
nwparker merged commit 414bdc9 into main Jul 23, 2026
2 checks passed
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 85e071e0-fe70-4691-9b15-02f47e8c3289

📥 Commits

Reviewing files that changed from the base of the PR and between 63bd3ff and abaf359.

📒 Files selected for processing (3)
  • src/main/ipc/worktree-base-directory-poller.test.ts
  • src/main/ipc/worktree-git-common-polling.ts
  • src/main/ipc/worktree-git-common-watch.test.ts

📝 Walkthrough

Walkthrough

Linked worktree polling now uses size-aware filesystem signatures, polls logs/HEAD each tick, and preserves prior snapshots for transient directory-stat or readdir failures. The polling loop enumerates worktree entries every tick and triggers full scans at the configured backstop or after visibility resumes. Tests cover in-place metadata changes, linked worktree additions and removals, transient errors, backstop scans, and hidden visibility behavior.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…re-open of stablyai#9882) (stablyai#10074)

* perf(main): gate idle git-common polling

Co-authored-by: Orca <[email protected]>

* fix(main): enumerate git-common worktrees every tick to catch coarse-FS add/remove

The worktrees-dir readdir was gated on the dir's mtime:ctime:ino:size signature, so on
a coarse-mtime/FAT filesystem a same-granule add+remove (all four fields collide) went
undetected until the ~30s index backstop. A single readdir of a small dir is negligible
next to the per-entry structural stats that already run every tick, so always enumerate —
the listing is the authoritative add/remove signal. The expensive per-entry index read
stays gated on each entry's own dir signature; onFullScan now reflects the ungated
index-metadata backstop fan-out (the real periodic cost) rather than the readdir.

Co-authored-by: Orca <[email protected]>

* fix(main): don't fabricate worktree deletions on a transient git-common readdir failure

Follow-up to always-enumerating the worktrees dir: the readdir catch-all treated ANY
error as an authoritative empty listing, so a transient failure (EIO/ESTALE/EMFILE,
network/SSH hiccup) emitted a false delete for every linked worktree (and a false create
next tick) — and enumerating every tick widened that exposure. Only ENOENT (dir truly
absent) now yields an empty listing; other errors retain the known entries so per-entry
stats still run and a real removal surfaces as that entry's own stat miss. Adds a
regression test (readdir → ENOTDIR) asserting no false delete.

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Orca <[email protected]>
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