orca icon indicating copy to clipboard operation
orca copied to clipboard

Cold AI Vault scan reads 6.7 GB for ~109 s with zero cache reuse; RPC/UI stalls observed around the same incident

Open eisen0419 opened this issue 4 months ago • 2 comments

Environment

  • Orca 1.4.142-rc.7 (macOS, Apple Silicon MacBook Pro), acting as orchestrator over SSH worktrees on a remote Mac mini (relay 0.1.0+2a9c9eab06ca)
  • Large local agent-transcript corpus: ~4 GB of Codex rollouts under ~/.codex/sessions (463 files) plus Claude/Gemini/OpenCode stores

Summary

On one fresh launch, aiVault.scan took 109.15 s and reported 6.75 GB read with no cache reuse. RPC and UI stalls were observed in the same incident family, so the scan is a leading suspect, but the causal link to the intermittent RPC wedges and an hours-long GUI freeze on this machine has not been established. Reporting the measured scan cost on its own merits, plus the surrounding observations.

Measured evidence

Startup scan captured in main.trace.ndjson right after a fresh app launch:

aiVault.scan  durationMs=109150
candidates=1364, fullParses=702, bytesRead=6749311278, reused=0, incremental=0, issues=0

Source interpretation (verified in source at v1.4.138-rc.7; these files are unchanged through the locally available v1.4.142-rc.3 tag; the exact v1.4.142-rc.7 source was not available in this clone):

  • The scanner runs in Electron's main process (src/main/ai-vault/session-scanner.ts, withSpan('aiVault.scan', ...)), parses stream chunks synchronously, and processes up to eight candidates per batch.
  • The parse cache (session-scanner-parse-cache.ts) is a module-level Map, i.e. process-local — a fresh launch cannot reuse it. The captured launch reported reused=0, incremental=0.
  • The span's own comment says it exists to make scan cost visible for "STA-1278-style" one-core-pegged investigations, i.e. this cost is meant to be measured — here is a real-corpus measurement.

Stalls observed in the same incident (correlation only)

Across Jul 16–17, terminal list/create calls via the relay stalled for roughly 3 to >4 minutes and then self-healed; one close call stalled for >10 minutes and eventually returned exit 0 after a retry had already closed the terminal; one create attempt produced no window and succeeded when re-issued. Short verbs kept responding during the same windows.

Limitations / unresolved observation

During an hours-long GUI freeze on the same machine (desktop + paired mobile frozen on stale state while request/response RPC still answered), the trace tail contained only once-per-minute renderer_memory breadcrumbs. Because aiVault.scan is recorded on completion, this trace does not establish whether a scan was in flight. Recovery followed a combined full quit, daemon cleanup, artifact cleanup, and relaunch, so that intervention does not isolate the cause of the freeze.

Proposed reproduction (step 5 not yet performed on this machine)

  1. Fully quit Orca.
  2. Retain a representative transcript corpus (here: ~4 GB Codex rollouts, 463 files, plus other stores).
  3. Enable the local trace and relaunch.
  4. Continuously timestamp terminal list latency and UI updates until aiVault.scan completes.
  5. Repeat on the same build after temporarily reducing/moving the transcript corpus, and compare.

Expected: RPC/UI remain responsive while scanning. Actual in the captured large-corpus launch: aiVault.scan completed in 109.15 s with 6.75 GB read; exact stall/scan overlap still needs a second instrumented capture.

Suggestions

  • Move transcript parsing off the main process (worker threads or a utility process), or yield between parse batches.
  • Persist the parse cache across restarts so a cold start does not re-read the entire corpus.
  • Consider a watchdog/timeout around the scan.

Potentially related user-facing report: #8864 ("Agent history lookup hang forever") — its underlying mechanism is not established in that report.

Happy to provide the full trace file or run instrumented builds — the corpus that triggers this is real daily usage, not synthetic.

eisen0419 avatar Jul 17 '26 18:07 eisen0419

I can take this

AmethystLiang avatar Jul 17 '26 20:07 AmethystLiang

Taking a look 👀

brennanb2025 avatar Jul 19 '26 19:07 brennanb2025