Repository navigation
Session History: a repeat open keeps every older session of the workspace - #30586
Conversation
…d for a workspace A repeat open or tab revisit of Session History's Workspace and Project tabs dropped to 250 sessions, losing older matching sessions (341 -> 250 in QA). Every cache reuse re-cut the scan's result with a shared newest-N counter for in-scope rows, which the scan's own per-agent budgets don't match. The cut now bounds only out-of-scope rows, so a scan's result passes through unchanged, and scoped requests reuse only a scan of their own depth so lowering the depth rescans. Tracked in STA-11167.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
|
Session History showed older matching sessions on first open, then hid them when reopened: a cached list applied a second, different limit. This PR keeps every matching row returned by the scan in Workspace and Project, including local aggregation in All computers. Changing the depth for a workspace or project requests a scan at that depth. Full-path review is complete on 32268b9. Independent correctness and architecture reviewers, followed by the final readiness, performance and compatibility source review, found no confirmed production defect. No production fixes were needed during the loop. A second final main sync imports the scanner update. All nine other PR files remain byte-identical to the reviewed head; the overlapping scope-walk test keeps both main’s new cases and this PR’s retention assertions. Eight named files passed, 92 tests. The history-depth default and bounded fresh scanner selection remain unchanged. The full PR workflow, including its aggregate gate, passed on this exact head. Real Electron QA ran again on the qa-gate-admitted M4Air using the same frozen genuine history. The new final head was rebuilt and tested against current main
At the final depth change, exactly 26 rows outside the workspace were removed; all 341 matching rows and their relative order remained. The new final head reproduced the previously reviewed head’s complete results, and its clean All result matched current main’s complete ordered IDs. All accepted states finished loading. Test processes and listeners were stopped, real hook-file hashes and all 577 frozen transcript files were unchanged, and the QA worktree was clean. Deferred and limits: the automated depth-decrease test proves the new request rather than the entire result; real QA above supplies that missing evidence. One overbroad source comment remains a P3 nit: an inherited history-folder mismatch can admit an unrelated row on a fresh All listing and trim it on reuse. Changing that admission rule was previously deferred. Fresh Workspace and All exactly match current main; Project and the full final result sets match the previously reviewed head. The History depth default remains 250, with main’s bounded global list and scoped supplements retained. All-computers aggregation can add matching rows and unrelated rows previously displaced by them; it removes no previously selected row. Closing History resets the host selection to Local Mac, an inherited behavior; aggregation was therefore measured through mounted scope revisits with All hosts selected throughout. No paired host was configured, so real paired-host, SSH, WSL and mixed-version runtime behavior was not tested. Mobile, folder-workspace runtime behavior, authenticated agent turns, resume and native focus were also outside this QA run; compatibility and platform paths received source review. No performance improvement is claimed. For Brennan’s review Workspace repeat: baseline 250 matching; final head 341. Project revisit: baseline 250 matching; final head 380. Clean All first open: current main and final head both have the same 532 rows in the same order. Depth change and reopen: baseline 250 matching / 428 loaded; final head 341 matching / 522 loaded. The final Unlimited state loaded 548 rows before reducing depth. All-hosts Workspace revisit, with only a local host configured: baseline 250 matching; final head 341. Project also retained 380 across mounted revisits. Two judgment points in the change:
|











ELI5
Session History's Workspace and Project tabs showed every matching session the first time you opened them, then only 250 when you came back. Older sessions of that workspace or project disappeared on a repeat open or a tab revisit, including Codex sessions beyond the newest 250 on the machine. A fresh scan and a saved (cached) result were cut down by two different rules. Reusing a saved result no longer applies a second limit to matching sessions, so reopening retains the workspace or project sessions admitted by the scan.
What Changed
Before: on a real machine, the Workspace tab of a large workspace showed 341 sessions on first open (273 Codex, 68 Claude) and 250 on a repeat open (249 Codex, 1 Claude). The Project tab showed 380, then 250 on revisit: 57 Codex, 69 Claude and 4 Grok sessions were missing, including old sessions that were on screen a moment earlier. The All computers view capped Workspace and Project at 250 matching sessions even on a first open.
After: a repeat open, a tab revisit and the All computers view show every session the scan found for the workspace or project.
Mechanism. A scan keeps the newest N sessions overall and adds the workspace's or project's own sessions, found by a separate walk with its own per-agent budget. Every saved result, in the main process, in the per-remote-host cache and in the window, was cut again on reuse by
truncateAiVaultListResult. That kept the newest N overall plus the newest N matching sessions, with one counter shared by all agents. So a reused result could hold fewer matching sessions than the scan that produced it.truncateAiVaultListResultnow bounds only the sessions outside the workspace or project: it keeps every matching session plus the newest N others. The scan already budgets matching sessions per source; reusing its result now preserves every matching row. With no workspace or project selected, the rule is the same newest N as before.aiVaultCachedDepthServes). Otherwise, lowering the depth menu would show the larger scan's matching sessions again. Lowering the depth there now runs a scan at the new depth. Views without a workspace or project still reuse a larger saved result, trimmed to the requested depth.Why
The common pattern is to apply the scope filter before the limit and to serve a saved result exactly as it was fetched, keyed by the whole request. Orca's scan already filters by scope before its limit; the bug was only the second, different cut on reuse. Removing the second matching-session cap keeps selection in one place, and requiring the same depth for workspace and project reuse matches that request identity.
Alternatives considered:
Differences from the common pattern, labelled:
Linked Issue
Tracked in STA-11167 (Linear). Found during QA of #30469 (STA-11097). It completes the older-session coverage from #29977.
Visual Proof
Real hidden Electron QA compared baseline
6c40f919with final94b1f8a91ee700227af5638e0ef1fdd78ed253c5on the qa-gate-admitted M4Air, using the same frozen genuine history and complete ordered row identities. Workspace retained 341 matching sessions on fresh/repeat/revisit opens (baseline 341 → 250); Project retained 380 (baseline 380 → 250). A separate clean All first open kept the same 532 rows and order. Unlimited → 250 → reopen changed the complete result 548 → 522 → identical 522, removing only 26 rows outside the workspace. Mounted All-hosts scope revisits retained Workspace 341 and Project 380 with only a local host configured. Sparse history stayed 39 matching / 260 loaded.Full baseline/final screenshots and review findings, including Project, All, depth changes and local aggregation. No paired host was available; paired-host, SSH, WSL and mixed-version runtime checks remain unverified. The approved existing-sign-in Codex QA driver used Playwright CDP; no new sign-in or copied credentials. Processes were stopped, hook hashes and the corpus stayed unchanged, and the QA worktree was clean.
Testing
Manually tested in an isolated real Electron app on the admitted M4Air (details above)
Automated tests added/updated, or explained why not below
New regression test: a scan result with more matching sessions than the depth passes through the cut unchanged, and again on a second pass (the repeat-open bug).
New renderer test: a workspace view lowered from Unlimited to 250 scans again at 250, instead of reusing the larger scan.
Updated tests: the cut keeps every matching session; a deeper scan serving depth 1 keeps every matching session it found, with the pinned newest Hermes session still first; the main cache test now repeats the same request; two remote-host cache timer and concurrency tests check larger-depth reuse on views without a workspace.
Ran 9 named test files (160 tests) on macOS: depth, scope walk, main cache, host-leg cache, renderer refresh, list merge, projects, tab history switch and the IPC handler. Typecheck and lint run in CI.
Review
Full-path review finished on
94b1f8a91ee700227af5638e0ef1fdd78ed253c5: independent correctness and architecture reviews plus final readiness, performance and compatibility source checks found no confirmed production defect. No production fixes were needed in the loop. Main was merged once at the end, with no overlap and the ten PR files and patch unchanged. The exact-head full PR workflow and aggregate gate passed.Deferred: an overbroad source comment about preserving every raw fresh row; the inherited unrelated history-folder admission exception remains as previously decided. The narrower automated depth-decrease test is supplemented by the actual complete-result QA above. Closing History still resets its host choice to Local Mac, as on baseline; All-hosts aggregation was tested using mounted scope revisits. No performance claim or authenticated-agent-turn/resume coverage is implied.
Agent skill upstream boundary
Notes
Checklist