Repository navigation
Session History: the Workspace tab stops re-reading every transcript to find its sessions - #30469
Conversation
…scans stop re-reading files
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3a954787-17f2-4233-9661-f3d0bb1670d1
📒 Files selected for processing: 16
src/main/ai-vault/session-parse-cache-database.tssrc/main/ai-vault/session-parse-cache-persistence.tssrc/main/ai-vault/session-parse-cache-store.tssrc/main/ai-vault/session-scanner-cline-parser.tssrc/main/ai-vault/session-scanner-cursor-chat-meta.test.tssrc/main/ai-vault/session-scanner-cursor-chat-meta.tssrc/main/ai-vault/session-scanner-graph-parsers.tssrc/main/ai-vault/session-scanner-grok-parser.tssrc/main/ai-vault/session-scanner-kiro-parser.tssrc/main/ai-vault/session-scanner-opencode-parser.tssrc/main/ai-vault/session-scanner-scope-cwd-facts.test.tssrc/main/ai-vault/session-scanner-scope-walk.test.tssrc/main/ai-vault/session-scanner-scope-walk.tssrc/main/ai-vault/session-scope-cwd.tssrc/main/ai-vault/session-scope-cwds-table.tssrc/main/ai-vault/session-sidecar-stat.ts
💤 Files with no reviewable changes: 1
- src/main/ai-vault/session-scanner-scope-walk.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Workspace and Project history could repeatedly read unrelated transcripts before finding older matching sessions. This PR saves validated folder answers in the existing cache and resolves membership through its current parsed results, retaining main’s ordered results while reducing repeated content reads. Full review completed on Real hidden Electron QA compared pinned main Known pre-existing gap, tracked in a follow-up PR: both builds lose older matching rows on cached revisits. Dense Workspace falls from 341 to 250, losing 24 Codex and 67 Claude rows; Project falls from 380 to 250, losing 57 Codex, 69 Claude and 4 Grok rows, including selected old Codex/Grok sessions. Cached results are trimmed again with a different budget from a fresh scan. The lane owner will fix result selection in a separate PR and explicitly accepted parity with main here. This PR does not fix that gap. Dense first/repeat opens show different result sets and cannot establish a repeat-open speedup. The approved existing-sign-in Codex driver exception used direct CDP with fully isolated app homes and verified actual process arguments/environment. No credentials were copied and no sign-ins made. Critical real hook/settings hashes stayed equal; other config drift was external, also observed with the rig stopped. Final corpus integrity matched, all owned rig processes/listeners stopped, and the QA checkout is clean. Authenticated resume remains unproven, Grok authentication unverified, and a live folder-workspace flow was not exercised; folder/remote compatibility has source-review evidence only. No SSH/WSL live or peak-memory claim is made. The intended reduction in unrelated Cline read warnings remains documented; no further code was changed in this resumed loop. For Brennan’s review:
The judgment points are current parsed authority, membership before parsing, and malformed-row isolation. |






ELI5
Workspace Session History could spend over a minute reading thousands of files before showing sessions. The scan was reopening unrelated transcripts just to learn their folder. This change saves lightweight folder answers and reuses valid parsed results in batches, while retaining main’s ordered Workspace and Project results, including Codex sessions beyond the newest 250 on the machine. The pre-existing cache-reopen coverage gap below remains and is tracked in STA-11167 (Linear) and #30586.
What Changed
Before, finding an older matching session could require a full parse of unrelated histories, or repeated transcript-head reads. The existing History cache now also saves folder answers learned from a transcript head or a small companion file. Each answer is valid only while its transcript modified time, size, platform and observed companion file agree.
Current valid parsed results remain authoritative, including a parsed result with no folder. Membership is resolved through the cache owner immediately before a session can be excluded, so a parse published during a scan takes precedence. Batched database reads isolate malformed records, and an unresolved authoritative read falls back to normal parsing instead of excluding a session using weaker information.
Grok, Cursor, Rovo, Cline, Kiro and legacy OpenCode use their existing directory extraction from small metadata files. Codex and the existing header readers save their head answer too. Formats that need full parsing, a shared index or a multi-file join keep that path. This reduces membership work where a valid cheap or parsed answer exists; it does not promise zero transcript reads for every agent.
The new
scope_cwdstable contains only cheap folder answers. Parsed folder information is derived from the existing saved rows rather than duplicated. Both tables participate in existing missing-file and WSL cleanup. Unknown, failed and cancelled reads are not saved as a definitive absence of a folder.Why
The common pattern is to let one owner hold session identity and folder information, then select matching sessions before applying the limit. Orca also reads histories written by external agent CLIs, so discovery and source validation must remain complete. The existing cache owns that validated information; a separate search index cannot replace it because search is optional and has different directory semantics.
Capping discovery would hide old sessions again. A new catalog would still need to reconcile externally written files and agent-specific dependencies. The chosen design keeps complete discovery and parser admission while avoiding repeated unrelated content reads where metadata suffices.
Linked Issue
Tracked in STA-11097 (Linear). Preserves the older-session coverage from #29977.
Visual Proof
Real hidden Electron UI on M4Air compared main
51530bb86cb2f799fb5162840654c64d9ff48fb2with this exact headb6be62c6472b9b21c5861f2ed5fd14c4c3ec6168. The same frozen genuine-history subset contains 577 files / 1,534,151,807 bytes, including Codex, Grok and Claude. Selected old Codex sessions rank 720 and 644 behind newer ordinary native sessions. Corresponding main/branch cells have identical ordered session IDs, coverage and ranking, including Project and All; no out-of-scope rows appeared.Click-to-settled milliseconds, one accepted sample per cell; variance is unmeasured. Fresh means a new app profile, repeat closes/reopens History in the same process, and clean restart retains the saved profile while proving History did not open before the measured click. These are bounded-subset timings, not disk-cold or whole-machine measurements. Heap is Chromium renderer used JavaScript heap at settlement, not peak or whole-process memory.
Fresh and repeat samples were faster on the branch; neither restart sample demonstrated a speedup. These single samples do not establish statistical performance or a regression. The optional scanner benchmark has zero accepted samples.
The minute-long scan, reproduced and removed. The real history above is too small to show the slow scan, so a second run used a generated history the size of the reported one: 3,210 sessions, 10.58 GB, in each agent's real file layout with synthetic text only. Mostly Grok (2,403 sessions with 4.4 MB histories each), plus Cursor and Codex (the in-scope Codex sessions are older than the newest 250). Ten sessions belong to the selected workspace. It ran on the M4Air, main (this branch's base
4940654, same dependencies) against this headb6be62c, on the identical files, three runs per cell, from the click on History to a settled list:On main the strip sat at "Reading 3,066 / 3,074 files" for most of the wait, the reported symptom. The branch settled in about a second and never showed that strip in the captured samples. All twelve opens showed the same ten sessions in the same order. Heap at settlement was 226 to 260 MiB in both builds. Fresh profile is not disk-cold (no cache purge); restart ranges overlap, so no restart speedup is claimed.
Known, pre-existing coverage gap, tracked in STA-11167 (Linear) and #30586: both builds show 341 dense Workspace sessions on a fresh open, then 250 on repeat, losing 24 Codex and 67 Claude sessions; all 341 return after restart. Project revisit similarly drops from 380 to 250, losing 57 Codex, 69 Claude and 4 Grok sessions, including the selected old Codex and Grok rows. Cache hits re-truncate with
truncateAiVaultListResult, while a fresh scan combines separately limited results. This PR does not fix that gap. Its follow-up will give result selection one owner. Dense fresh-versus-repeat timings compare different result sets and cannot establish a repeat-open speedup.The lane owner approved the existing signed-in Codex QA worker driving the isolated app directly through CDP, without copied credentials or new sign-ins. The normal internal hook listener used its approved OS-assigned port; controlled ports remained gate-assigned. Actual process arguments and isolation environment were verified on every launch. Hook-bearing real configuration hashes remained equal; other config drift was external, also observed with the rig stopped. All recorded rig processes/listeners stopped, the final corpus rehash matched, and the QA checkout is clean.
Normal tabs, row details and refresh-close-reopen were exercised. Authenticated agent resume remains unproven, Grok authentication unverified, and a live folder-workspace flow was not exercised; folder and remote compatibility have source-review evidence only. No SSH/WSL live or peak-memory claim is made.
Testing
Full review path: this changes saved cache data and scan concurrency, so the light path does not apply.
3e20d188c39da1cdfa707c4100ca986d2907f0b8and passed on the repair. They cover concurrent parsed publication across eviction and pending/committed persistence, and malformed rows plus failed authoritative reads after a real SQLite restart. Six named files / 65 tests passed on Windows high; the normal commit hook passed.b6be62c6472b9b21c5861f2ed5fd14c4c3ec6168adds the duplicate-import correction and two explicit registrations so the SQLite scope tests run under Node. The runtime boundary test and both affected scope files passed again on Windows: 21 tests, with matching real-config hashes. The normal staged commit hook passed.Review
The full review’s single status comment records the two repaired findings, real UI evidence and remaining limits. The lane owner assigned the pre-existing cached-result coverage gap to a follow-up PR and accepted exact parity with main for this PR. Readiness is checked on the exact head after the status comment is updated.
Agent skill upstream boundary
Notes
orcad, including its SSH and independent WSL route, remains memory-only as before. Windows Electron reading WSL files may use the Windows host's persistent cache. No new server persistence feature is included.Checklist