Repository navigation
Description
Operating system
macOS 26.3.2 (Apple Silicon)
Orca version
1.4.184
Details
Short summary
After roughly 30 minutes of normal multi-agent use, Orca input, rendering, terminal output, and worktree create/attach operations become progressively unusable. The Orca main process reaches ~100% CPU and its RSS grows rapidly. Quitting and reopening Orca immediately restores responsiveness, while persistent agent processes survive and reattach.
The local persistent state also retains thousands of removed worktree records and stale workspace-session owners. Repeatedly removing those stale records through the supported worktree.rm RPC causes a full Git worktree rescan per record and can itself pin the main process at 100% CPU.
createOrAttach timed out after 30000ms and listSessions timed out after 9500ms occur after the runtime is already degraded; they appear to be symptoms, not the initiating cause.
Observed runtime behavior
On a fresh restart:
- Main process CPU: roughly 10-27%
- Main process RSS: roughly 300 MB
- Renderer heap: roughly 14 MB
- Input is responsive
Immediately before a restart during degradation:
- Main process CPU: 97-106%
- Main process RSS grew from about 540 MB to 812 MB in about 20 seconds
- Input and terminal output were delayed to the point of being unusable
- New worktree/session create or attach operations timed out
A second reproduction about 30 minutes after restart showed:
- Main PID CPU: 99-102%
- Main PID RSS: 1.31 GB at first measurement
- Renderer CPU: about 6%; the bottleneck was the Electron main process
- A 5-second macOS
sampleshowed the main thread continuously draining Node/V8/libuv filesystem callbacks (uv__work_done->node::fs::AfterInteger-> JS callbacks)
Historical renderer crash reports on the same machine also show renderer heap growth from about 2.5 GB to 3.3 GB to approximately 4 GB before repeated renderer crashes in 1.4.168/1.4.175.
Persistent-state mismatch
At one fresh snapshot:
worktree.ps: 22 current worktrees, 11 live terminalsworkspaceSession.tabsByWorktree: 53 owner keys- Stale persisted owner keys absent from the runtime worktree set: 35
- Persisted terminal tabs/layouts: 26
- Sleeping agent session records: 23
worktreeMeta: 2,858 records- Local, path-missing, non-live records eligible for cleanup: about 2,000
Many retained records pointed at long-deleted /private/tmp/..., Claude scratch worktrees, review worktrees, and removed Orca child worktrees.
Terminal lifecycle churn
Daemon logs show substantial create/attach/kill churn and failed cleanup:
- 2026-08-17: 617 created, 613 exited, 667 killed, 384 kill-failed, 390 attached
- 2026-08-18: 304 created, 252 exited, 330 killed, 195 kill-failed, 202 attached
- 2026-08-19 (partial day): 20 created, 14 exited, 16 killed, 20 kill-failed, 54 attached
Other recurring errors include tab_not_found, listSessions timed out after 9500ms, close failures, and createOrAttach timed out after 30000ms.
Cleanup reproduction
- Start Orca with a large
worktreeMetaset containing removed local worktrees. - Confirm each candidate is absent from
worktree.ps, absent from an authoritativeworktree.detectedList, and its filesystem path no longer exists. - Call
worktree.teardownMissingTerminalsfor the exact IDs. - Call non-force
worktree.rmfor each exact stale ID. - A 5-record smoke test succeeds and removes the record plus tabs/browser tabs/groups/layout state without changing live terminal counts.
- A larger sequential batch causes Orca main CPU to reach 100%.
main.trace.ndjsonshows eachworktree.removetaking roughly 0.1-1.5 seconds and repeatedly invokinggit worktreescans for the same repositories. Even after the caller is stopped, queued main-process filesystem/Git work continues for some time.
Agent Bridge / external worktree ingestion
One registered repository had externalWorktreeVisibility: show, which caused independently managed external and agent worktrees to be discovered by Orca. Changing the repository to:
externalWorktreeVisibility: hideagentWorktreeVisibility: hideexternalWorktreeDiscoverySuppressedAt: <now>importedExternalWorktreePaths: []
keeps the repository visible while preventing those independent sessions/worktrees from being surfaced as Orca workspaces. A first-class per-repository "never ingest external agent sessions" control would make this much clearer and safer.
Suspected persistence gap
Inspection of the 1.4.184 bundled code suggests:
removeWorktreeMeta()correctly calls workspace-session owner cleanup.removeWorkspaceSessionStateForWorktree()exists and cleans owner state across partitions.worktree.teardownMissingTerminalsexists and performs an authoritative scan before stopping missing-worktree PTYs.- Renderer authoritative reconciliation builds purge state for removed local worktrees.
- Persisted metadata forgetting after an authoritative scan appears to be implemented for SSH (
forgetRemovedForExecutionHost) but not equivalently for local worktrees.
This may explain why local worktreeMeta records survive after their worktrees disappear and are loaded/scanned again on every run.
Expected behavior / requested fix
- After an authoritative local Git scan, automatically and durably forget metadata and workspace-session owner state for worktrees that no longer exist.
- Prune empty
tabsByWorktreeowner keys, dependent layouts, sleeping-agent records, terminal tombstones, and history/cache records once their exact live PTY/worktree owner is gone. - Make cleanup batch-oriented: one authoritative repo scan, then remove all confirmed-missing IDs without rescanning Git per ID.
- Coalesce persistence saves and terminal-manager notifications during a cleanup batch.
- Bound or garbage-collect terminal lifecycle managers after exit/kill/failed-kill paths.
- Add diagnostics for retained worktree metadata count, workspace-session owner count, internal terminal-manager count, queued filesystem work, and main-process event-loop lag.
- Add a regression test with thousands of historical worktree records and hundreds of terminal create/attach/kill cycles; assert bounded CPU, memory, state size, and create/attach latency.
- Make
createOrAttach/listSessionstimeout errors include event-loop lag and queue/backlog diagnostics so the initiating cause is distinguishable from the timeout symptom. - Expose a supported CLI/RPC for bounded local stale-state GC, or make normal reconciliation sufficient so an external janitor is unnecessary.
I can provide the redacted macOS sample and trace slices if useful.
Activity
seanssoh commentedon Aug 19, 2026
Additional reproduction evidence: after the sequential stale-worktree cleanup was stopped, the Orca main process remained at 97-102% CPU for several minutes and RSS continued to climb. A normal macOS application quit request did not terminate the main process within 20 seconds, so no offline state mutation was attempted. This is consistent with the main event loop remaining occupied by queued filesystem/Git work after the RPC caller has gone away.
seanssoh commentedon Aug 19, 2026
Follow-up after separating the renderer, persistent-state, history-scanner, and external-load hypotheses on 1.4.184. The strongest current mechanism is terminal-manager/replay accumulation; the large Codex history scanner is a separate historical amplifier, not the sole cause of this reproduction.
1. Renderer terminal-manager / replay evidence
Across the 10 retained renderer trace rotations (88 renderer launches):
terminal_replay_guard_wedged_release: 39 occurrences.terminal_webgl_diagnostic: 5,375 occurrences.mountedManagersreached 29, 33, 44, and in one launch 104.terminal_replay_guard_wedged_releasewas the final relevant terminal event immediately before the user restarted Orca. The fresh renderer restarted with one manager and low heap, and input became responsive again.Inspection of the bundled renderer shows:
liveManagers = new Set()populated by pane-manager registration/unregistration.REPLAY_GUARD_STALL_CHECK_MS.terminal_replay_guard_wedged_releaseis emitted only when the xterm replay write rejects or a probe makes no parser progress for the stall interval; it then reports an undeliverablereplay-wedgedpipeline.managersandmountedManagers; it resets/refreshes all panes.This fits the user-visible failure better than the create/attach timeout itself: old/inactive pane managers and recovery/refresh fan-out accumulate, terminal output/replay wedges, rendering and input degrade, and new session attach then times out.
Cmd+Shift+RinvokeswebContents.reloadIgnoringCache()and is a much less destructive workaround than quitting the whole app because the runtime/PTYS remain outside the renderer.Requested additions:
2. Exact offline persistent-state audit
A read-only, authoritative Git/path-based dry run against the current state file found:
worktreeMeta: 2,755 before, 47 retained after classification (2,708 stale metadata records).worktreeMeta: 2,738.workspaceSession.tabsByWorktree: 53 -> 21.Every removable local ID was absent from the owning repository's authoritative
git worktree list, its exact path did not exist, and it was not a non-local host record. The large gap between 2,755 persisted records and 47 real/present worktrees is machine-specific and likely explains why most users do not reproduce this quickly.The safe local mitigation is currently offline only: back up
orca-data.json, remove the confirmed-missing owners and dependent state in memory, fsync a temporary file, and atomically rename it while Orca is stopped. A supported batch reconciliation RPC would be much safer than requiring this workaround.3. Codex history scanner: real historical amplifier, zero spans in today's trace
The default Codex session tree on this host contains 6,218 rollout files and about 63.1 GB of logical history. A 3-day retention inventory found:
Historical
aiVault.scanspans show:Bundled scanner inspection shows the default source resolves to
CODEX_HOME || ~/.codex, recursively walks/stats/sorts the tree, keeps up to 2,000 newest candidates, and parses up to 1,000. Results are cached, but resumable byte offsets are not persisted across process restart, and invalidation deletes the path cache.However, the current
main.trace.ndjsonand its latest rotations contain zeroaiVault.scanspans. Therefore this scanner has caused or amplified past stalls but does not explain today's renderer replay wedge by itself. A supported per-source exclusion and size/byte budget would still prevent independently managed Agent Bridge sessions from being imported merely because they use the operator's default Codex home.4. Controlled confounders
The host also had unrelated security/indexing load and 20 orphaned CRM test
embedded-postgrespostmasters. The Postgres processes were idle (approximately 0% CPU) and are independently attributable to timed-out Go tests. These can amplify host resource usage but do not explain why reloading/restarting only Orca immediately restores input while the external processes remain.Current working model
The evidence now supports three distinct layers:
The local mitigations are intentionally outside the live Orca main process: offline atomic stale-state pruning, moving old rollout files outside scanner roots, and isolating future Agent Bridge Codex history under a separate
CODEX_HOME. None of those substitutes for lifecycle disposal and bounded reconciliation in Orca itself.seanssoh commentedon Aug 19, 2026
Correction and stronger reproduction evidence for 1.4.184: the current failure is in the Electron main process, not the renderer. The renderer/replay evidence in my previous comment may describe a separate historical failure mode, but it does not explain this captured incident.
Exact main-process timeline
Old main PID 99750 was launched at 10:48:11 KST.
Two independent 5-second macOS samples, taken about 20 minutes apart while PID 99750 was wedged, show the same main-thread path:
At 12:11:46, 101 of 107 main-thread samples were in this path. At 12:31:50, 102 of 105 were in the same path, including the same JIT addresses. This looks like a main-process JS continuation triggered by an async filesystem integer result that does not return or is continuously re-entered. The standard macOS sample cannot recover the bundled JS function name.
Confounders ruled down
skipped-app-runningevery minute.git.execspans and fiveworktree.removespans, but the high-CPU transition occurred at 12:11:20, about seven minutes after the preceding removal at 12:04. Later removals amplified an already wedged main process; they did not initiate this reproduction.PIAutoscanwas also near 100% during the captured incidents and can amplify filesystem latency. It is now near idle while Orca is normal, but this still does not explain why the Orca main process independently remains at 100% after the external load changes.Machine-specific accumulated state
Current local state is unusually large:
orca-data.json: about 4.0 MB, including 2,757worktreeMetaentries.orchestration.db: about 93 MB.The
task-list --briefimplementation still performsSELECT t.*for every task, including fullspecandresult, then abbreviates in main-process JavaScript. Large read/list operations therefore materialize much more data than the brief output suggests.The bundled worktree watcher also contains a possible self-amplifier in both base and git-common polling:
If one 2-second poll takes at least two seconds under I/O pressure, the next tick is scheduled with zero delay. On macOS, a watcher-process failure can switch git-common watching to this polling fallback. I do not yet have a log proving fallback activation in this incident, so this remains a code-supported hypothesis rather than the confirmed JS function.
Requested diagnostic/fix direction
task-list --briefproject only brief columns in SQL instead of loading fullspec/result.I now have two redacted main-process sample files and timestamped 10-second CPU/RSS/process/state samples for this incident if maintainers want them.
yzxcj797 commentedon Aug 19, 2026
One concrete gap stands out from the report's persistence numbers, and it explains the ~2,000-record accumulation with the existing GC in place:
gcStaleWorktreeMetagates on a 30-day idle grace BEFORE it stats the path (worktree-metadata-normalization.ts:68-71, deliberately so active entries skip the stat fan-out). But multi-agent churn creates exactly the shape that gate keeps forever: a Claude/scratch worktree created and removed within one session has anewestTouchminutes old, so the grace never elapses — and the record survives every startup scan indefinitely while its /tmp path is long gone. The grace is right for entries that might be recreated; it is the wrong gate for entries an authoritativeworktree.detectedListscan has already proven absent.The minimal, well-scoped fix matching your item 1: let a proven-absent local path bypass the idle grace the same way SSH already does via
forgetRemovedForExecutionHost— authoritative absence is stronger evidence than timestamp age. The batch-scan coalescing (onegit worktree listper repo, then remove all confirmed-missing IDs without rescanning per ID) is the natural second step and is what fixes the 100%-CPUworktree.rmloop you measured.I have the repo checked out and the loading-store/GC path mapped; the authoritative-absence bypass looks containable to the normalization module plus the detected-list reconciliation reporting its retirements. If a maintainer confirms this is the intended direction (rather than a broader persistence rework), I'll take the minimal first step.
seanssoh commentedon Aug 19, 2026
Additional controlled comparison for the terminal-history path:
While the restarted main process was healthy, four active Orca terminals produced a combined 350-400 KB of terminal-history output every 10 seconds. The bundled main process flushes dirty sessions every 5 seconds, permits four concurrent checkpoints, and resets each incremental output.log at the 5 MiB boundary.
Two sessions crossed that boundary during 2-second monitoring:
Therefore normal 5 MiB rollover/full-checkpoint work is not sufficient to produce the permanent 100% main-process wedge. It does establish a useful control: the hot incident samples are in the same Node fs completion family used by this high-rate persistence path, but the failure requires additional accumulated state, backlog, or I/O pressure.
The current strongest model is a positive-feedback failure: continuous terminal output plus other main-process filesystem/Git/orchestration work causes pending output to outpace processing; each fs completion immediately drains/encodes/writes more work, and the main event loop never becomes idle. Restart clears or reseeds the backlog and restores responsiveness. Exact confirmation still requires a V8 main-process profile because native sampling cannot name the JIT JavaScript continuation.
seanssoh commentedon Aug 19, 2026
Live confirmation from the affected 1.4.184 profile strongly supports this direction.
A read-only recount of the current
worktreeMetamap found:newestTouch == 0The
newestTouch == 0cohort is especially important: the currentgcStaleWorktreeMetabranch explicitly continues when the value is zero, so those 2,339 records do not merely wait for the grace period; they never become eligible through this GC path. The current local detected-list reconciliation prunes missing lineage after one authoritativegit worktree list, but it does not retire the corresponding localworktreeMetarecords. That is the missing local analogue of the SSH forget path described above.This makes authoritative-absence retirement plus one-scan-per-repo batch reconciliation the right minimal fix and a very high-value test on this machine. One boundary remains: replaying the large read-only orchestration query set once after restart did not reproduce the permanent main-process wedge, and normal 5 MiB terminal-history checkpoints also recovered. So the stale metadata is now a confirmed persistence defect and credible repeated-work amplifier, but I would not yet label it the sole cause of every 100% incident without the V8 main-process profile.
I can test a maintainer-approved patch against this exact 2,709-missing-record profile and report before/after counts, detected-list latency,
git.execvolume, and main CPU.seanssoh commentedon Aug 19, 2026
Applied the bounded offline mitigation on the affected 1.4.184 profile and verified live-session continuity.
Exact offline state transition:
worktreeMeta: 2,757 -> 49workspaceSession.tabsByWorktreeowners: 56 -> 23The scheduled broader maintenance GC was temporarily unloaded during this operation, so no orchestration DB pruning, Codex-history archival, Postgres cleanup, worktree removal, or terminal stop ran concurrently.
Session continuity was preserved:
ptyIdandincarnationIdconnected=trueandwritable=trueImmediate post-restart control:
readyorca-data.jsonis now about 2.45 MBworktreeMetaremains 49 after startup and a live re-scan still reports 0 stale ownersThis establishes that authoritative-absence pruning can reduce the affected state by two orders of magnitude without terminating the daemon-backed working sessions. It does not yet prove that the permanent 100% main-process wedge is eliminated; the next comparison is whether the same workload survives beyond the previous roughly 83-minute time-to-failure, with automatic capture if main CPU again remains above threshold.
seanssoh commentedon Aug 19, 2026
Follow-up correction with the fatal incident captured after the offline stale-state prune:
Orca-2026-08-19-150211.ipsfor the old main PID 70752:EXC_BREAKPOINT / SIGTRAP, faulting thread 0 (CrBrowserMain). The native stack is in the same V8/Node async-filesystem family seen in the earlier samples, includingnode::fs::FSReqCallback::Resolveandnode::fs::AfterInteger. We still cannot identify the exact bundled JS continuation from native symbols alone.orca status --jsonat 15:02:12, observedapp.running=false/stale_bootstrap, then explicitly ranorca open --jsonat 15:02:17 to preserve an active worker flow. That command spawned macOS/usr/bin/openPID 97616; CoreServicesUIAgent/LaunchServices then launched Orca PID 97637. This auto-open masked the crash from the operator. App version remained 1.4.184 and updater artifacts were unchanged.git.execspans (16.6s aggregate) and 3 successfulworktree.removespans (7.9s aggregate). Those are plausible triggers/amplifiers but their traced duration does not explain the 12-minute CPU loop.sample(1)of the wedged main process timed out at 14:49, but the macOS crash report preserved the fatal stack. Renderer CPU was not the driver.Updated conclusion: authoritative-absence GC and batching remain valid fixes for stale worktree amplification, but they are insufficient as the root fix. The remaining evidence points to a main-process filesystem/terminal-history continuation or backlog loop, likely amplified by concurrent Git/worktree churn.
nwparker commentedon Aug 19, 2026
This is alot of text to read. @seanssoh could you consolidate it down to a simplier message? We're happy to help but that's alot!
seanssoh commentedon Aug 19, 2026
Additional longitudinal evidence from the same post-crash PID 97637 (launched 15:02:17 KST):
sample(1)again captured the same dominant main-thread path: libuv work completion ->node::MakeLibuvRequestCallback<uv_fs_s>->node::fs::AfterInteger->node::fs::FSReqCallback::Resolve-> V8/JIT continuation.node::fs::FSReqCallback::Resolve.ready, main CPU was ~8%, and the app had been up 6h22m with no additional crash report.This makes the issue recurrent rather than a one-off crash, but also shows that episodes can recover and can remain temporarily invisible to the operator.
seanssoh commentedon Aug 19, 2026
Overnight longitudinal update from the same PID 97637, covering 22:25 KST through 04:44 KST:
ready.This strengthens the case for instrumenting the JS continuation around filesystem completion and correlating it with timer/retry boundaries.
seanssoh commentedon Aug 20, 2026
Version 1.4.185 update: the same issue is still reproducible.
ready.This confirms that updating from 1.4.184 to 1.4.185 did not resolve the main-process high-CPU loop.