Skip to content

perf(editor): watch only active, recent and at-risk workspaces - #30415

Merged
nwparker merged 5 commits into
mainfrom
nwparker/watch-active-and-dirty-only
Oct 20, 2026
Merged

nwparker merged 5 commits into
mainfrom
nwparker/watch-active-and-dirty-only

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca used to ask the operating system to watch every folder of every workspace that had a tab open. On a Mac, all of those watches go through one system service that every app shares. When it gets too busy, everything on the machine slows down. One teammate had a chat start that stalled for more than 30 seconds waiting on that service.

Now Orca only watches the workspace you are looking at, plus a few you used recently. When you go back to a workspace it stopped watching, Orca checks your open files against what is on disk and catches up.

What Changed

Before: every workspace with an open editor tab kept a whole-folder watch, whether or not you had looked at it today. With 20 workspaces open, that meant 20 watches.

After: a workspace keeps its watch only if it is:

  • the active workspace,
  • one of the 3 most recently visited workspaces, or
  • showing a tab whose file was deleted or renamed, so the warning clears the moment the file comes back. At most 3 such workspaces stay watched this way, and the least recently used ones go first.

Every other workspace's watch is released. This applies the same way to local folders, WSL, SSH workspaces (where the watch runs on the remote host and is released through the same request), folder workspaces, and workspaces on a paired Orca server.

Switching back. When a released workspace is watched again, Orca catches up after the new watch is in place. It reuses the existing paths and adds no new UI:

  • Clean tabs reload from disk. This is the same "everything may have changed" refresh used after a reconnect. Before reloading, Orca first checks with the host that owns the file whether the file still exists. If the host says it is gone, the tab gets the usual "deleted" banner and keeps its last content, instead of reloading into an error.
  • Tabs with unsaved edits get the existing disk check that runs for restored tabs. If the file changed on disk, the usual "changed on disk" banner appears and the edits are kept. This check runs after the watch is in place, including when the watch was installed late.
  • Git status, the Files tree (local and remote) and markdown document lists refresh once from the same signal.
  • Combined Changes views re-read their loaded files, including ones based on a saved snapshot. A Changes tab that is not on screen forgets its cached file contents, so it loads fresh the next time you open it.

If the watch could not be installed right away (the watcher limit was full, or the SSH connection was still coming up), the late install sends the same catch-up signal when it lands.

What is not here. The earlier draft paused autosave on re-watched tabs and had timers and banners for that pause. All of it is gone. Since #30417, every editor save sends the disk version it was based on, and the host refuses the save if the file changed since then. A stale save cannot overwrite anything, so nothing needs to be held while a workspace is unwatched. The draft's hidden on/off setting is also gone.

Also carried over from the draft:

  • One watch request per folder and host. Two workspaces on the same folder share it, and it is released only when neither needs it.
  • Events from SSH watches now say which connection they came from, so a local folder and an SSH folder at the same path are no longer confused.

Why

Watching less is the direct fix for the shared system service being overloaded. The alternatives were:

  • Keep watching everything and make each watch cheaper. That does not help, because the cost is the number of whole-folder watches.
  • Keep extra watches for workspaces with unsaved edits. That is no longer needed now that the host checks every save. Unsaved edits in a released workspace are checked against disk when you return.
  • Hold autosave until the watch is back (the earlier draft). That added timers, a new banner and a new readiness message. The guarded save makes all of it unnecessary.

The 3 recent workspaces stay watched so quick back-and-forth switching never has to catch up. The count is the same on every OS.

Measured with 20 workspaces open, each with a tab, on macOS (Apple Silicon). The native subscription count comes from the watch-target selector. The other three numbers come from a separate 20-second run where a script wrote about 400 files a second spread across 20 folders of 3,000 files each, with one native watch per watched folder:

before after
Native whole-folder subscriptions 20 4 (active + 3 recent)
Events delivered to Orca during the churn 7,047 1,655
Watcher CPU time in that process 245 ms 62 ms
Subscriptions with 5 / 10 workspaces 5 / 10 4 / 4

During this run, the system service's own CPU time was mostly driven by how many writes happened, so it was too noisy to compare here. The win is that it delivers to, and keeps state for, 5 times fewer subscribers.

Linked Issue

Maintainer PR; no issue.

Visual Proof

N/A. Nothing new appears on screen. Switching back reuses the existing reload and "changed on disk" banner, which are covered by the tests below.

Testing

  • Automated tests added/updated
  • editor-external-watch-background-trim.test.ts: which workspaces stay watched, the order recent workspaces are evicted in, deleted workspaces not holding a recent slot, unsaved/combined-diff/rich-editor tabs no longer pinning a watch, and the same policy for SSH, WSL, folder workspaces and paired servers.
  • useEditorExternalWatch-background-trim.test.tsx: switching away releases the native subscription, switching back re-subscribes and catches up, an SSH workspace is released and re-requested on its connection, and a shared folder is released only once.
  • useEditorExternalWatch-switch-back.test.tsx: on switching back, a clean tab reloads, a tab whose file was deleted keeps its content and shows the deleted banner, and an unsaved tab whose file changed gets the changed-on-disk banner with its edits kept, including when the change lands between the switch and a late install. Git status and Files get exactly one refresh, cached Changes contents are dropped, and autosave is never held.
  • editor-external-watch-overflow.test.ts, use-combined-diff-section-revalidation.test.tsx, useFileExplorerWatch.catch-up.test.tsx: the existence check (including when it fails or the host returns an error), the open Changes view re-reading its sections, and the local Files tree taking the catch-up without double-processing.
  • The pinned-workspace limit and its eviction order.
  • Main-process tests: late local capacity installs and late SSH installs send the catch-up signal, and SSH events carry their connection.
  • pnpm tc, pnpm lint, oxlint and pnpm run check:code-quality:changed pass.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH: the watch is released through the same unwatch request the app already sends when the last tab closes, so the remote host's watcher is torn down cleanly. Re-watching goes through the existing install, retry and capacity paths.
  • Paired Orca servers: catch-up waits for the host's existing "ready" event, so nothing written after the catch-up is missed. No wire change.
  • Windows/Linux: same policy and same count on every OS.
  • Older paired servers: they lack the batch existence check, so Orca falls back to the reload itself. If the reload says this exact file is missing, the tab is marked deleted and keeps its content, rather than showing an empty error. A reply like "worktree not found" while a server is re-pairing never counts as a deletion.
  • Unsaved tabs that can't be checked: the existing disk check now also asks paired servers whether the file still exists. It gives up after a fixed number of retries and shows the changed-on-disk banner, so autosave is never paused indefinitely. A newer check requested during a read always gets one fresh read.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

The change adds a default-enabled setting that limits background file watches to the active workspace, up to three recently visited workspaces, and workspaces with dirty non-virtual tabs. The target selector tracks omitted workspace targets. When a target returns, the external-watch hook arms disk verification and schedules reloads for eligible clean tabs after the watch becomes ready. The change also adds disk-baseline checks before user saves, experimental settings UI, translations, telemetry schema support, and tests.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to d8b10

Saving can use an outdated file owner, and some workspaces can miss disk updates after watch installation problems. Resolve these paths before merging.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 38 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description includes the required sections and gives detailed implementation, testing, platform, and performance information. However, it contains critical inaccuracies: it states that the hidden … Update the description to match the implementation and objectives. Document trimBackgroundWorkspaceWatches and its default behavior, state that all eligible unsaved-edit workspaces remain watched, correct the listed test files, and reconc…
Passed Passed checks: 3 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely summarizes the primary performance change: limiting editor file watches to active, recent, and at-risk workspaces.
Full details: Description check

Explanation

The description includes the required sections and gives detailed implementation, testing, platform, and performance information. However, it contains critical inaccuracies: it states that the hidden on/off setting was removed, while this PR adds trimBackgroundWorkspaceWatches and a hidden experimental UI control; it limits unsaved-edit workspaces to three, while the stated objective keeps all eligible unsaved-edit workspaces watched; and its testing and checklist claims conflict with the PR objectives.

Resolution

Update the description to match the implementation and objectives. Document trimBackgroundWorkspaceWatches and its default behavior, state that all eligible unsaved-edit workspaces remain watched, correct the listed test files, and reconcile the command and manual-testing claims with the actual results. Mark the manual-testing checkbox accurately and retain N/A for visual proof if appropriate.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9e5147fb-087a-4b8a-8e4b-2d57d0c09a23
📥 Commits

Reviewing files that changed from the base of the PR and between eaa1ee1 and f87790b.

📒 Files selected for processing: 21
  • src/renderer/src/components/settings/ExperimentalPane.tsx
  • src/renderer/src/components/settings/HiddenExperimentalGroup.test.tsx
  • src/renderer/src/components/settings/HiddenExperimentalGroup.tsx
  • src/renderer/src/hooks/editor-external-watch-background-trim.test.ts
  • src/renderer/src/hooks/editor-external-watch-rewatch-reload.test.ts
  • src/renderer/src/hooks/editor-external-watch-rewatch-reload.ts
  • src/renderer/src/hooks/editor-external-watch-scope.ts
  • src/renderer/src/hooks/editor-external-watch-target-rows.ts
  • src/renderer/src/hooks/editor-external-watch-targets.ts
  • src/renderer/src/hooks/useEditorExternalWatch-background-trim.test.tsx
  • src/renderer/src/hooks/useEditorExternalWatch-subscriptions.test.tsx
  • src/renderer/src/hooks/useEditorExternalWatch.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/default-global-settings.ts
  • src/shared/global-settings-types.ts
  • src/shared/telemetry-property-schemas.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟠 Major · Run the reload only after a successful watch installation. · useEditorExternalWatch.ts:89

src/renderer/src/hooks/useEditorExternalWatch.ts:89
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Run the reload only after a successful watch installation.

If watchWorktree rejects, the catch handler logs the error and resolves installed. Line 89 then calls reloadCleanEditorTabs even though no watch is live. A later disk write can remain unseen because the target stays selected and this effect does not reinstall its watch. Preserve the installation failure in the promise result, and retry the watch before treating the workspace as restored.

🟡 Minor · Reload clean tabs after the remote watch reports ready. · useEditorExternalWatch.ts:73-74

src/renderer/src/hooks/useEditorExternalWatch.ts:73-74
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reload clean tabs after the remote watch reports ready.

subscribeRuntimeFileChanges resolves after the preload subscription handle is created, not after the files.watch stream reports ready. Line 74 reloads tabs before that event. A remote write can occur between the reload and remote watcher readiness and remain undetected. Trigger the catch-up reload from the actual ready acknowledgement instead.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bce6c798-a3bd-4344-95c6-69e013ee78f5
📥 Commits

Reviewing files that changed from the base of the PR and between 2c9d98b and 17321fd.

📒 Files selected for processing: 1
  • src/renderer/src/hooks/useEditorExternalWatch.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 65e28b74-43ff-4b06-b79c-9114bea9a810
📥 Commits

Reviewing files that changed from the base of the PR and between 17321fd and c26dc1c.

📒 Files selected for processing: 13
  • src/renderer/src/components/editor/editor-restored-tab-conflict-scan.ts
  • src/renderer/src/components/editor/editor-save-baseline-check.ts
  • src/renderer/src/components/editor/editor-save-queue.ts
  • src/renderer/src/components/editor/useEditorPanelDiffContentLoader.test.tsx
  • src/renderer/src/components/editor/useEditorPanelDiffContentLoader.ts
  • src/renderer/src/components/editor/useEditorPanelFileContentLoader.ts
  • src/renderer/src/hooks/editor-external-watch-local-roots.ts
  • src/renderer/src/hooks/editor-runtime-file-watch.test.ts
  • src/renderer/src/hooks/editor-runtime-file-watch.ts
  • src/renderer/src/hooks/useEditorExternalWatch-background-trim.test.tsx
  • src/renderer/src/hooks/useEditorExternalWatch-rewatch-typing.test.tsx
  • src/renderer/src/hooks/useEditorExternalWatch.ts
  • src/renderer/src/runtime/runtime-file-watch-client.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment on lines +104 to +110
// Why: an unverified baseline means disk may have moved; check before writing, and refuse until the banner shows.
if (trigger === 'user' && !(await verifyDiskBaselineBeforeUserSave(store, liveFile))) {
throw new Error(CHANGED_ON_DISK_SAVE_REFUSAL)
}
if ((saveGeneration.get(file.id) ?? 0) !== queuedGeneration) {
return
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Re-read the live tab and store state after the baseline-verification await.

Lines 79–98 capture state and liveFile. The same block checks liveFile presence, readOnly, and pendingOwnerMigration there. Then Line 105 awaits verifyDiskBaselineBeforeUserSave. That call performs a disk read, and a remote files.read can take up to 15 seconds. During that await, the tab can close, start an owner migration, or change its routing context. The saveGeneration check at Line 108 detects only a generation bump. After it, Lines 121–141 build fileContext and editorTabFileAccess from the stale state and liveFile. The write can then go to an owner that is no longer current, or it can run for a tab that is no longer open. Before this change, no await separated these guards from the write.

After the verification await, read the store again. Then repeat the liveness and owner-migration guards before you build the write context.

🐛 Proposed fix
         if (trigger === 'user' && !(await verifyDiskBaselineBeforeUserSave(store, liveFile))) {
           throw new Error(CHANGED_ON_DISK_SAVE_REFUSAL)
         }
         if ((saveGeneration.get(file.id) ?? 0) !== queuedGeneration) {
           return
         }
+        if (trigger === 'user') {
+          // Why: the disk check awaited I/O; owner, access and liveness may have changed meanwhile.
+          state = store.getState()
+          liveFile = state.openFiles.find((openFile) => openFile.id === file.id) ?? null
+          if (!liveFile || liveFile.readOnly === true) {
+            return
+          }
+          if (liveFile.pendingOwnerMigration === true) {
+            throw new Error('This file is still restoring its workspace owner. Try saving again.')
+          }
+        }

For this fix, declare state and liveFile with let at Lines 79–80.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Announce readiness to adopted capacity-retry… · filesystem-watcher-local-subscription.ts:95-100

src/main/ipc/filesystem-watcher-local-subscription.ts:95-100
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Announce readiness to adopted capacity-retry listeners.

If sender A is waiting for capacity and sender B later subscribes to an existing live root, this branch adds A as a listener. Only B receives the fs:watchWorktree result. A receives no fs:watchLive, so A’s pending catch-up reload never runs. Announce readiness to each adopted listener after confirming its live membership. The same notification must cover listeners adopted when a new root finishes installation.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8756dae8-5b0d-4356-8285-900c16931f63
📥 Commits

Reviewing files that changed from the base of the PR and between c26dc1c and d8b100e.

📒 Files selected for processing: 16
  • src/main/ipc/filesystem-watcher-handlers.ts
  • src/main/ipc/filesystem-watcher-live-announce.ts
  • src/main/ipc/filesystem-watcher-local-subscription.ts
  • src/main/ipc/filesystem-watcher-remote-controller.ts
  • src/main/ipc/filesystem-watcher-terminal-resync.test.ts
  • src/main/ipc/filesystem-watcher.test.ts
  • src/preload/api/filesystem-api.ts
  • src/preload/api/fs-bridge.ts
  • src/renderer/src/hooks/editor-external-watch-local-roots.ts
  • src/renderer/src/hooks/useEditorExternalWatch-background-trim.test.tsx
  • src/renderer/src/hooks/useEditorExternalWatch-rewatch-typing.test.tsx
  • src/renderer/src/hooks/useEditorExternalWatch-subscriptions.test.tsx
  • src/renderer/src/hooks/useEditorExternalWatch.ts
  • src/renderer/src/store/slices/restored-editor-owner-reparent.test.ts
  • src/renderer/src/web/preload-api/web-filesystem-api.ts
  • src/shared/filesystem-entry-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@nwparker
nwparker force-pushed the nwparker/watch-active-and-dirty-only branch 2 times, most recently from 579a222 to 13c8d6f Compare October 19, 2026 02:11
@nwparker
nwparker changed the base branch from main to nwparker/save-disk-precondition October 19, 2026 02:11
@nwparker nwparker closed this Oct 19, 2026
@nwparker nwparker reopened this Oct 19, 2026
@nwparker nwparker changed the title perf(editor): watch only active, recent and unsaved-edit workspaces perf(editor): watch only active, recent, unsaved and combined-diff workspaces Oct 19, 2026
@nwparker
nwparker force-pushed the nwparker/watch-active-and-dirty-only branch 3 times, most recently from 973947c to a47c50b Compare October 19, 2026 04:11
@nwparker
nwparker force-pushed the nwparker/save-disk-precondition branch 10 times, most recently from f3a33ec to 4e4cf54 Compare October 19, 2026 11:16
@nwparker
nwparker force-pushed the nwparker/watch-active-and-dirty-only branch from 32c1f7e to 5868894 Compare October 19, 2026 20:01
@nwparker
nwparker requested a review from Jinwoo-H as a code owner October 19, 2026 20:01
@nwparker
nwparker changed the base branch from nwparker/save-disk-precondition to main October 19, 2026 20:01
@nwparker nwparker closed this Oct 19, 2026
@nwparker nwparker reopened this Oct 19, 2026
@nwparker nwparker changed the title perf(editor): watch only active, recent, unsaved and combined-diff workspaces perf(editor): watch only active, recent and at-risk workspaces Oct 19, 2026
@nwparker
nwparker marked this pull request as draft October 19, 2026 20:27
@nwparker

Copy link
Copy Markdown
Contributor Author

Back to draft: the safe version of this needs every editor save to check the disk first (planned as phase 2 of the editor buffer design in #30851). Once that lands, this PR drops its autosave-hold logic and ships on top of it.

@nwparker
nwparker force-pushed the nwparker/watch-active-and-dirty-only branch from 74d6667 to a904df5 Compare October 20, 2026 11:46
@nwparker
nwparker marked this pull request as ready for review October 20, 2026 11:47
@nwparker
nwparker force-pushed the nwparker/watch-active-and-dirty-only branch 3 times, most recently from fd8be59 to d1ce40e Compare October 20, 2026 12:31
Background workspaces no longer hold a whole-tree native file watch. The
active workspace, the 3 most recently visited ones, and any showing a
deleted/renamed tab keep theirs; every other workspace's subscription is
released (local, WSL, SSH via the relay, and runtime hosts alike).

When a dropped workspace is watched again, its tabs are verified against
disk through the existing paths: one overflow resync once the watch is in
place reloads clean tabs and refreshes git status, Files and markdown
lists; dirty tabs go through the restored-tab disk check, which shows the
changed-on-disk banner. Saves stay guarded by the host-side disk check, so
nothing is held while unwatched.

Also: watch requests are shared per directory and host; root events reach
every workspace on that root and SSH payloads carry their connection id;
late SSH and local/WSL capacity-retry installs send an overflow resync.
…Files trees after a rewatch

- Overflow catch-up drops cached combined-diff bodies for the workspace and
  re-reads every loaded section of a mounted review (snapshot-backed too).
- Clean edit tabs are probed on the owning host first; a file proven gone is
  marked deleted and keeps its last content instead of reloading into an error.
- Dirty tabs are checked from the overflow itself, so the check runs after the
  watch is installed, including late capacity/SSH installs.
- Local/WSL Files trees also take the renderer-synthesized catch-up.
- Deleted/renamed-tab pins are capped at 3 beyond the active and recent set.
…le existence answers

- Cached Changes views reset only clean loaded sections; dirty sections keep
  their drafts and baselines (also for per-path invalidation).
- A mounted review re-reads loaded and in-flight sections on catch-up.
- Existence answers carry a per-tab generation; a newer probe or watch event
  for the tab supersedes an older answer.
- A tab is marked deleted only on a per-path ENOENT, never on a whole-request
  not-found or an old host's scalar fallback.
…letions, chunk existence probes

- A disk check requested while one is in flight is followed by one fresh read
  (coalesced) instead of being answered by the older reply.
- The restored-tab check probes runtime-owned files on their host; a per-path
  ENOENT marks the tab deleted. After a retry ceiling it stops, clears the
  suspension and shows the changed-on-disk banner.
- Overflow existence probes are split into host-sized chunks, in order.
…le absence answers re-read

- A tab that already read its file and now gets a path-specific ENOENT on reload
  is marked deleted and keeps its last content, with or without an existence
  probe, so older paired servers are covered.
- The restored-tab check applies its request generation after the absence
  probe too, so an older answer cannot resolve a newer request.
@nwparker
nwparker force-pushed the nwparker/watch-active-and-dirty-only branch from d1ce40e to 2971065 Compare October 20, 2026 12:46
@nwparker
nwparker merged commit 3f435fb into main Oct 20, 2026
44 checks passed
nwparker added a commit that referenced this pull request Oct 20, 2026
…seded or closed (#31128)

Follow-up to #30415. A watch event that superseded a pending overflow existence
probe left the tab's entry behind forever, and the dirty-tab disk-check request
map never removed anything. Superseding now deletes the entry, and closed tabs'
disk-check requests are dropped by the scan's existing open-tabs subscription.
The disk-check map uses a global sequence so a reopened tab can't reuse an old
read's number.
nwparker added a commit that referenced this pull request Oct 20, 2026
…rt stacks (#31216)

Fixes bugs found reviewing #30270, #30605, #30885, #30417, #31113, #30415,
#30992 and #30997, and removes code those PRs made unnecessary.

Co-authored-by: Claude <[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