Repository navigation
fix(runtime): bound persisted graph hydration for large profiles - #11832
brennanb2025 merged 1 commit into
Conversation
Greptile SummaryThis PR fixes two release regressions that hung the main process on a Windows profile with 239 workspace entries and 723 tabs: a repeated per-workspace session scan introduced in #9994 (reducing ~86,150 checks to 723 via a single one-pass
Confidence Score: 5/5Safe to merge after removing the diagnostic file; no regressions identified in the new hydration logic or renderer sync paths. The one-pass hydration scan correctly limits worktree inclusion to sessions where ownerHostId === hostId, stale folder workspaces are cleanly excluded via null returns rather than exceptions, and the pre-scanned session is threaded through the call chain without introducing new fetch paths. All 7 changed files have strong test coverage directly exercising the regression scenarios. Files Needing Attention: The diagnostic file docs/reference/diagnostics/2026-07-31-runtime-graph-lag-regression.md should be removed before merge.
|
| Filename | Overview |
|---|---|
| src/main/runtime/orca-runtime.ts | Core fix: adds getWorkspaceSessionHydrationTargets for one-pass session scanning, refactors tryGetWorkspaceSessionHostIdForWorktree to return null for stale folder workspaces, threads pre-scanned workspaceSession through the hydration call chain |
| src/main/runtime/orca-runtime.test.ts | Adds three new regression tests and updates an existing SSH/serve test to pass mobileSessionTabs: [] so the new hydration-scan code path is exercised |
| src/renderer/src/runtime/sync-runtime-graph.ts | Adds folderWorkspaces to the mobile-session sync key and filters stale folder-workspace worktrees out of buildMobileSessionTabSnapshots with cache eviction |
| src/renderer/src/lib/runtime-session-mirror-targets.ts | New helper filtering getRuntimeSessionMirrorEnvironmentIds to environments with a resolved status.status and a known runtimeEnvironments entry |
| src/renderer/src/runtime/web-session-tabs-sync.ts | Replaces inline environment-key computation with getReachableRuntimeSessionMirrorTargets, deferring mirror subscriptions until runtimes report a healthy status |
| src/renderer/src/runtime/sync-runtime-graph.test.ts | Adds folder-workspace removal coverage including cache-eviction and version-bump after removal and restore |
| src/renderer/src/lib/runtime-session-mirror-targets.test.ts | New unit tests covering health-probe gating, missing-environment exclusion, and legacy pairingRevision fallback |
Reviews (3): Last reviewed commit: "fix(runtime): bound persisted graph hydr..." | Re-trigger Greptile
| | Live `folderWorkspaces` | 0 | | ||
| | Stale `folder:*` session keys | 2 | | ||
| | Local `tabsByWorktree` entries | 116 | | ||
| | Local persisted tabs | 397 | | ||
| | Saved-runtime `tabsByWorktree` entries | 123 | | ||
| | Saved-runtime persisted tabs | 326 | | ||
| | Total persisted tabs inspected by the graph path | 723 | | ||
| | Persisted workspaces with a serve/SSH-owned PTY candidate | 0 | | ||
|
|
||
| The stale keys are: | ||
|
|
||
| ```text | ||
| folder:2573f8cc-8e3a-4e16-bf2b-95f8bae2eb1d | ||
| folder:5e144304-2c66-4571-aa46-552a3338b928 | ||
| ``` | ||
|
|
||
| For this profile, the pre-fix graph publication performs approximately 86,150 tab checks because it rescans an entire host session for each graph workspace. The fixed one-pass candidate discovery performs 723 checks, about 119 times fewer. Because this profile has no runtime-owned persisted pane candidate, the correct result is no ordinary runtime hydration work after that single pass. | ||
|
|
||
| ## Live-process evidence | ||
|
|
||
| The app was deliberately left running so diagnostics could be collected without destroying roughly 110 active/saved sessions. | ||
|
|
||
| | Observation | Evidence | | ||
| | --- | --- | | ||
| | Main process hung | PID 43984 (`Orca`), Windows `Responding=False`, about 303 MB private bytes at the latest sample | | ||
| | Renderer still present | PID 33908 (`Orca`), about 390 MB private bytes at the latest sample | | ||
| | No resource saturation | Repeated sampling did not show sustained CPU or GPU saturation; this is consistent with event-loop starvation/blocking rather than machine-wide overload | | ||
| | Runtime bridge unavailable | `orca status --json`, computer-use capabilities, and computer-use app enumeration all timed out against the wedged app | | ||
| | Trace stopped with app state | `C:\Users\neil\AppData\Roaming\orca\logs\main.trace.ndjson` stopped at 14:39:15, four seconds after the profile's last write | | ||
| | Main trace showed Git pressure | `git.exec` completions peaked at 219/min at 14:34 and 213/min at 14:33, then continued at 195, 183, 162, and 148/min through 14:38 | | ||
| | Windows recorded a real hang | Application log Event 1002 (`Application Hang`) at 12:08:43; WER Event 1001 at 12:08:41 classified the failure as `AppHangB1` | | ||
|
|
||
| A compact dump of the hung main process was captured at: | ||
|
|
||
| ```text | ||
| C:\Users\neil\orca\diagnostics\orca-main-43984-hang-20260731-154629.dmp | ||
| ``` | ||
|
|
||
| It is 7,100,310 bytes. The dump is intentionally **not** committed to this repository. | ||
|
|
||
| ## Why the two regressions amplify each other | ||
|
|
||
| The stable regression makes graph publication scale with graph workspaces multiplied by all tabs in the selected persisted session. Large profiles therefore pay repeated whole-session scans even when every tab is locally owned and no hydration is necessary. |
There was a problem hiding this comment.
PII in committed diagnostic file
The file contains the affected user's Windows username (neil) in absolute file-system paths (C:\Users\neil\AppData\..., C:\Users\neil\orca\...). The PR description notes this file is temporary and can be removed before merge — it should be before this lands in the default branch's git history, since git history is effectively permanent once a branch is merged.
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 8a0d7a348e2774d78c568ad8dbcfc92da982db36 and 14cb346. 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughRuntime graph hydration now resolves missing folder workspaces without throwing, discovers runtime-owned worktrees from host sessions, and reuses loaded workspace-session data during reconciliation. Mobile session synchronization now tracks folder workspace changes and removes snapshots for deleted folder workspaces. Runtime mirror subscription keys now use reachable targets with runtime, connection-generation, and pairing-revision values. Tests cover graph readiness, session read counts, snapshot filtering, cache eviction, and mirror target selection. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/src/runtime/sync-runtime-graph.ts (1)
765-784: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winEvict snapshots for removed folder workspaces.
Line 778 skips a removed folder workspace, but cache cleanup later checks the unfiltered
worktreeIdsset. A stale folder key can therefore retain itsmobileSessionSnapshotCacheByWorktreeentry indefinitely and reuse its old snapshot if that ID returns.Track published worktree IDs and use that set for cache cleanup. Add a test that primes the cache, removes the folder workspace, and verifies eviction.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7fbc1309-be84-4e6f-bef1-f41f98f0aa41
📥 Commits
Reviewing files that changed from the base of the PR and between e493795 and fcae9f1963bf0f3a031d8d6590c7dba0be9bf22f.
📒 Files selected for processing (8)
docs/reference/diagnostics/2026-07-31-runtime-graph-lag-regression.mdsrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/lib/runtime-session-mirror-targets.test.tssrc/renderer/src/lib/runtime-session-mirror-targets.tssrc/renderer/src/runtime/sync-runtime-graph.test.tssrc/renderer/src/runtime/sync-runtime-graph.tssrc/renderer/src/runtime/web-session-tabs-sync.ts
| pnpm exec oxlint <the seven changed TypeScript files> | ||
| PASS |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Replace the placeholder with the executed file list.
The command is not runnable. List the seven TypeScript files so readers can reproduce the lint validation.
Proposed fix
-pnpm exec oxlint <the seven changed TypeScript files>
+pnpm exec oxlint \
+ src/main/runtime/orca-runtime.ts \
+ src/main/runtime/orca-runtime.test.ts \
+ src/renderer/src/runtime/sync-runtime-graph.ts \
+ src/renderer/src/runtime/sync-runtime-graph.test.ts \
+ src/renderer/src/lib/runtime-session-mirror-targets.ts \
+ src/renderer/src/lib/runtime-session-mirror-targets.test.ts \
+ src/renderer/src/runtime/web-session-tabs-sync.ts📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| pnpm exec oxlint <the seven changed TypeScript files> | |
| PASS | |
| pnpm exec oxlint \ | |
| src/main/runtime/orca-runtime.ts \ | |
| src/main/runtime/orca-runtime.test.ts \ | |
| src/renderer/src/runtime/sync-runtime-graph.ts \ | |
| src/renderer/src/runtime/sync-runtime-graph.test.ts \ | |
| src/renderer/src/lib/runtime-session-mirror-targets.ts \ | |
| src/renderer/src/lib/runtime-session-mirror-targets.test.ts \ | |
| src/renderer/src/runtime/web-session-tabs-sync.ts | |
| PASS |
fcae9f1 to
8a0d7a3
Compare
Electron validation (8a0d7a348e)Validated the pushed branch in an isolated Orca dev profile via CDP and the real Electron renderer/main-process boundary.
Remaining gap: this macOS host currently has no PTY devices available, so a new terminal process could not be allocated. The screenshot proves the rendered app remained responsive after the large-profile graph publication, but it is not evidence of successful terminal typing. Live Windows input remains to be checked after the wedged remote instance can be safely restarted. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/runtime/orca-runtime.test.ts (1)
27006-27025: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winFix the duplicate assertion; restore the missing readiness check.
Line 27023 and line 27024 assert the exact same expression:
expect(getWorkspaceSession).toHaveBeenCalledTimes(1). The test title says "hydrates runtime-owned candidates from one host-session read," and the line-range change summary states the test verifies "synchronization reaches the ready state." ThegraphStatuscheck is missing. Both sibling tests in this block ("keeps the graph ready when a mobile snapshot references a removed folder workspace" and "scans ordinary persisted sessions once instead of once per graph workspace") end withexpect(runtime.getStatus().graphStatus).toBe('ready').Without this check, the test does not verify that
syncWindowGraphactually completes successfully when 100 runtime-owned worktree candidates are present in the persisted session but absent from themobileSessionTabssnapshot. A regression that leaves the graph in'reloading'or'unavailable'after this hydration path would not be caught.♻️ Proposed fix
runtime.syncWindowGraph(1, { tabs: [], leaves: [], mobileSessionTabs: [] }) expect(getWorkspaceSession).toHaveBeenCalledTimes(1) - expect(getWorkspaceSession).toHaveBeenCalledTimes(1) + expect(runtime.getStatus().graphStatus).toBe('ready') })Based on learnings, this deferred finding is anchored here per the
line_range_change_detailsguidance for lines 27006-27025.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f8ef24d1-4045-466e-8f6c-2570ecf4b65b
📥 Commits
Reviewing files that changed from the base of the PR and between fcae9f1963bf0f3a031d8d6590c7dba0be9bf22f and 8a0d7a348e2774d78c568ad8dbcfc92da982db36.
📒 Files selected for processing (7)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/renderer/src/lib/runtime-session-mirror-targets.test.tssrc/renderer/src/lib/runtime-session-mirror-targets.tssrc/renderer/src/runtime/sync-runtime-graph.test.tssrc/renderer/src/runtime/sync-runtime-graph.tssrc/renderer/src/runtime/web-session-tabs-sync.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- src/renderer/src/lib/runtime-session-mirror-targets.test.ts
- src/renderer/src/lib/runtime-session-mirror-targets.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/runtime/sync-runtime-graph.test.ts
- src/renderer/src/runtime/sync-runtime-graph.ts
- src/main/runtime/orca-runtime.ts
8a0d7a3 to
14cb346
Compare

Summary
Why
The affected Windows profile has 239 persisted workspace entries and 723 tabs, but no persisted serve/SSH-owned pane candidates. The old graph publication path performed about 86,150 tab checks by rescanning full sessions per graph workspace. The new path performs 723 checks (~119x fewer).
There are two related release regressions:
v1.4.160as well as rc.3.folder_workspace_not_foundthrow on stale folder snapshots. The affected profile has zero live folder workspaces and two stalefolder:*session keys.The installed
1.4.163-rc.3main process is formally hung, runtime/computer-use bridge calls time out, Windows recordedAppHangB1, and terminal typing outside Orca remains normal. I recommend blocking rc.3 promotion and cutting another RC with this fix.Full machine, release-ancestry, trace, profile, ruled-out-candidate, dump-location, and validation evidence is intentionally committed for review in
docs/reference/diagnostics/2026-07-31-runtime-graph-lag-regression.md. Per review request, that temporary file can be removed before merge. The dump itself is not committed.Validation
pnpm run typecheck:nodepnpm run typecheck:weboxlinton all seven TypeScript filesgit diff --check