You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep file changes visible while the file watcher is paused after repeated crashes - #52678
When Orca's file watcher crashes too many times, Orca stops watching files for a while (5 to 60 minutes) before trying again. During that pause, files that changed on disk did not show up in the file explorer or open editors. Now Orca checks again every 10 seconds during the pause, so changes still appear, just a little later.
Files
Added
Deleted
Net
Test
3
$\color{#1a7f37}{\Huge{\mathbf{+}}}$133
$\color{#cf222e}{\Huge{\mathbf{−}}}$13
$\color{#1a7f37}{\Huge{\mathbf{+}}}$120
Prod
4
$\color{#1a7f37}{\Huge{\mathbf{+}}}$138
$\color{#cf222e}{\Huge{\mathbf{−}}}$32
$\color{#1a7f37}{\Huge{\mathbf{+}}}$106
What Changed
Before: when the crash breaker dropped a root, its listeners got one refresh at the drop and one after the cooldown. Nothing in between.
After: while the cooldown wait is pending, a slow timer (10 s) sends each dropped root's listeners the same catch-up refresh the app already sends after a watch gap (resync), marked watchStillDown so the renderer does not ask to watch again (that would cancel the cooldown). The renderer handles it as it does after any gap: the explorer re-reads the folders it shows, git status refreshes the active worktree, clean editor tabs reload or get marked stale, dirty tabs are compared with disk, and deleted files are detected.
One timer is shared by every dropped root and refreshes at most 8 roots per tick, taking turns by root so every root gets one. It stops when the cooldown ends (rewatch), when the last listener unwatches or goes away, and on quit, through the existing retry cancel. While the window is hidden or minimized it parks and refreshes when the window shows again.
No timer runs when no root is dropped.
Why
The breaker's own comment already says callers need their own polling while it is open; only the git common-dir watch had one. Reusing the overflow refresh keeps the cost to what the user is looking at, instead of walking whole trees to diff them. 10 s is a fallback cadence for a degraded state that lasts minutes.
Linked Issue
Internal (item 769).
Visual Proof
N/A: main-process change to a failure-only path (the watcher crash breaker); the visible effect is the existing overflow refresh, covered by the tests below.
Testing
filesystem-watcher-crash-fuse-rewatch.test.ts (real watcher handlers, only the watcher child mocked):
refreshes reach the renderer every 10 s during the cooldown, stop after the rewatch, and no timers remain;
unwatching during the cooldown stops the timer and the retry;
watching a healthy root arms no timer.
The first two fail with the fix reverted.
Scale check: 2,000 roots dropped at once and re-registered every cooldown for 12 cycles: at most 8 refreshes per tick, every root served, 0.33 ms per tick on main, no timers left after stop.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
Only runs while the crash breaker has dropped at least one root and a window is visible: one main wakeup per 10 s (0 when hidden or healthy) and at most 8 small IPC messages per tick, whatever the number of dropped roots (0.33 ms per tick at 2,000 roots). Renderer work per tick is at most 8 roots' gap reconciliation, the same work a single watch gap already costs per root: the explorer's loaded folders when that root is shown, git status for the active worktree, an existence probe of those roots' clean tabs and a disk read of their dirty tabs. Watched roots are the explorer's root and roots with open tabs, not every workspace.
Risk
Level: Low
Only the crash-breaker cooldown path changes. If it misbehaved, users in that degraded state would see the explorer refresh every 10 s. Plain revert.
AI Disclosure
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
Cross-platform: timers and Electron window state only; WSL roots have no crash breaker and are unchanged. Remote/SSH roots watch through runtime streams and are unchanged.
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)
I stated the risk: what could break, for whom, and how to back it out
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)
QA on 374e2d1 (Linux, dev build, profile seeded with 1,901 workspaces, 1,800 chat tabs and 200 terminals). The file watcher's child process was killed 3 times, which opened the crash breaker for 300 s. The only commit since, 3a40651, drops an unrelated lockfile change; the code is identical.
Flow
Result
New file created during the cooldown
Shown in the explorer within 4.5–7 s (on the next 10 s refresh)
Active clean tab overwritten on disk
New text shown in 1.5 s
Dirty tab's file overwritten on disk
"Changed on disk" banner, unsaved text kept
Open file deleted on disk
Tab marked deleted
Cadence
Refresh every 10.0 s; the watch was never retried early; the breaker stayed open its full 300 s
Cooldown ends
Rewatch 77 ms after it ends; new file shown in 530 ms; no refreshes in the next 60 s
All tabs closed during a cooldown
No refreshes for that root in the next 60 s
Base f9f7ebb6ef5, same steps
New file and edit still missing after 115 s (the bug)
CPU during the cooldown: main +1.3 points, renderer +0.4 points vs healthy (60 s samples, fleet profile loaded).
QA evidence: new file during the cooldown / dirty-tab conflict / base build after 60 s (file still missing)
Not covered in the app: more than 8 dropped roots at once, and parking while the window is hidden. A local harness covered both: at most 8 refreshes per tick, every one of 2,000 roots served, no timers while hidden, and one refresh on show.
No actionable comments were generated in the recent review.
Walkthrough
The change adds scheduled catch-up resyncs while a local watcher is down during its cooldown. The scheduler processes up to eight roots per batch and checks window visibility before running. Catch-up notifications include a watchStillDown flag, which the renderer uses to exclude them from deferred watch-root refreshes. Tests cover cooldown notifications, retry behavior, unwatching, and timer cleanup.
Merge Risk: Low · up to 62489
While the file watcher is paused after repeated crashes, file changes now stay visible through periodic catch-up refreshes. That costs a small, bounded amount of extra CPU during the cooldown. In a slow-disk case a clean tab may stay stale until the watcher is retried. Neither issue is likely to block merging, but owners should be aware of both.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: while the file watcher is paused after repeated crashes, file changes stay visible. The changeset adds a 10-second resync timer during the crash-breaker cooldown that …
Description check
The description follows the repository template: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist. It …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: while the file watcher is paused after repeated crashes, file changes stay visible. The changeset adds a 10-second resync timer during the crash-breaker cooldown that refreshes explorer, git status, and open tabs, which matches the title.
Full details: Description check
Explanation
The description follows the repository template: ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, AI Disclosure, Review, Agent skill boundary, Notes, and Checklist. It explains the before and after behavior, the mechanism, the test coverage, and the risk with a rollback method. The Linked Issue section cites an internal item rather than a GitHub issue. The Risk section does not set the Level field to a value and the AI Disclosure section is left empty.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
[Medium impact] The PR appears safe to merge; no actionable issues were found.
Summary
Keeps file changes visible while the watcher waits through a crash cooldown.
Local files keep showing changes while a crashed watcher waits to restart.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Watcher crash cooldown] --> B[Register root for polling]
B --> C{Window visible or windowless launch?}
C -->|Yes| D[Send catch-up refresh for up to eight roots]
D --> E[Wait ten seconds]
E --> C
C -->|No| F[Wait for show or restore]
F --> D
D --> G[Renderer refreshes files without restarting watch]
B --> H[Cooldown ends or last listener leaves]
H --> I[Remove root and stop polling when empty]
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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
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.
ELI5
When Orca's file watcher crashes too many times, Orca stops watching files for a while (5 to 60 minutes) before trying again. During that pause, files that changed on disk did not show up in the file explorer or open editors. Now Orca checks again every 10 seconds during the pause, so changes still appear, just a little later.
What Changed
resync), markedwatchStillDownso the renderer does not ask to watch again (that would cancel the cooldown). The renderer handles it as it does after any gap: the explorer re-reads the folders it shows, git status refreshes the active worktree, clean editor tabs reload or get marked stale, dirty tabs are compared with disk, and deleted files are detected.Why
The breaker's own comment already says callers need their own polling while it is open; only the git common-dir watch had one. Reusing the overflow refresh keeps the cost to what the user is looking at, instead of walking whole trees to diff them. 10 s is a fallback cadence for a degraded state that lasts minutes.
Linked Issue
Internal (item 769).
Visual Proof
N/A: main-process change to a failure-only path (the watcher crash breaker); the visible effect is the existing overflow refresh, covered by the tests below.
Testing
filesystem-watcher-crash-fuse-rewatch.test.ts(real watcher handlers, only the watcher child mocked):The first two fail with the fix reverted.
Scale check: 2,000 roots dropped at once and re-registered every cooldown for 12 cycles: at most 8 refreshes per tick, every root served, 0.33 ms per tick on main, no timers left after stop.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Performance
Only runs while the crash breaker has dropped at least one root and a window is visible: one main wakeup per 10 s (0 when hidden or healthy) and at most 8 small IPC messages per tick, whatever the number of dropped roots (0.33 ms per tick at 2,000 roots). Renderer work per tick is at most 8 roots' gap reconciliation, the same work a single watch gap already costs per root: the explorer's loaded folders when that root is shown, git status for the active worktree, an existence probe of those roots' clean tabs and a disk read of their dirty tabs. Watched roots are the explorer's root and roots with open tabs, not every workspace.
Risk
Level: Low
Only the crash-breaker cooldown path changes. If it misbehaved, users in that degraded state would see the explorer refresh every 10 s. Plain revert.
AI Disclosure
Review
Agent skill upstream boundary
Notes
Cross-platform: timers and Electron window state only; WSL roots have no crash breaker and are unchanged. Remote/SSH roots watch through runtime streams and are unchanged.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)