Skip to content

Session History: find every agent's older sessions in Workspace and Project views - #29977

Merged
brennanb2025 merged 9 commits into
mainfrom
brennanb2025/session-history-scope-before-cap
Oct 18, 2026
Merged

brennanb2025 merged 9 commits into
mainfrom
brennanb2025/session-history-scope-before-cap

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​728 $\color{#cf222e}{\Huge{\mathbf{−}}}$​15 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​713
Prod 37 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1064 $\color{#cf222e}{\Huge{\mathbf{−}}}$​482 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​582

ELI5

Agent Session History could lose a workspace's older conversations because newer sessions from other folders filled the list first. Workspace and Project now select matching conversations before spending their history limit.

What Changed

A workspace with about twelve Codex conversations showed only one after 1,493 newer transcripts appeared elsewhere. The same omission affected agents whose files were outside the existing folder-based lookup.

Every agent now declares how its session directory is discovered. The scanner reuses its parser, enrichment, ordering, cancellation and deduplication while selecting scoped history. Database-backed sources filter ordered metadata before admitting rows. Workspace requests its own paths; Project and All retain their existing broader project paths and supplements. Scope-preserving trimming also reaches caches and All computers, and WSL membership retains distro identity through Project attribution.

Why

The common pattern applies folder membership before the page limit. Applying that rule throughout the existing listing path removes the repeated omission class; raising the global cap or adding another agent-specific exception would leave it intact.

Intended differences and limits:

  • Membership follows the parsed session directory. An uncached older session that started elsewhere and later moved into the workspace can still be missed by the opening-record selector.
  • Gemini transcripts do not record a working directory.
  • Sparse scopes can inspect every discovered file or database metadata row; there is no file-count ceiling that could hide older matches. Opening-record reads and cached parsing avoid unnecessary full reads, and cancellation remains available.
  • Foreign databases use their existing ordered iterators with the shared normalized path matcher. Selected output is bounded, but sparse metadata lookup can still scan all rows.
  • Existing clients and servers remain compatible. Recovery requires an updated execution host; older hosts retain their prior coverage. No saved fields, settings, new external operations or minimum server version are introduced.

Linked Issue

N/A — maintainer-reported missing history.

Visual Proof

Fresh real Electron QA on the M4Air compared exact branch acac1452b1c with its pinned main baseline 30e3119fc75, using two genuine old Codex conversations plus 270 newer unrelated transcripts, default history depth 250. Both builds used separate throwaway homes and were rebuilt for this comparison.

Tab main this PR
Workspace main Workspace: both older conversations missing PR Workspace: both genuine conversations listed once
Project main Project: empty in folder workspace PR Project: same pre-existing folder workspace gap
All main All: 250 sessions PR All: intended 252-session supplement

Workspace shows neither genuine conversation on main and both exactly once on the branch. Explicit refresh and closing/reopening history preserve both (branch after reopening). Project is empty on both in this folder workspace, the pre-existing gap tracked in STA-10957. All's 252 rows at depth 250 are the intended existing scoped supplement.

All five real configuration fingerprints stayed unchanged across 24 checkpoints spanning preparation, builds, launches, UI driving, shutdown and final cleanup. The QA worker inspected every capture, actual app identity, isolation environment and keychain flags. The existing signed-in Codex worker drove through CDP under the approved driver exception; no credentials were copied or new sign-in performed. All recorded app processes and descendants exited and ports 9420/9421 were clear.

Testing

The full PR workflow, including aggregate job 117529796173, passed on exact head acac1452b1c07c74fd749d600ba45fb19b833c87. Windows regression verification reproduced both new failures on d5 and passed them on this head; seven related named files passed 98/98. Earlier Windows coverage passed 216 tests in 25 named files and 76 tests in three files after fixture corrections.

The two regressions cover an unchanged Cursor transcript gaining workspace metadata and a Codex conversation whose latest parsed directory must survive memory-cache eviction. Both now consult current parsed metadata before an opening-record shortcut can exclude the conversation. Codex retains the single bounded 64 KiB first read.

Matched Windows measurements on 20,000 Codex files, two fresh processes with production event-loop yields: scoped first open 2.19–2.27 s (193 baseline 3.55–3.56 s), warm 0.235–0.243 s (baseline 0.228–0.233 s), busy about 0.26 s, and after memory reset 2.23–2.25 s. All three older matching sessions remain present. This fixture has no persistent SQLite cold tier; database latency, live WSL/SSH, cancellation timing and general memory bounds remain unmeasured.

In real Electron on 272 files, branch first open settled in 365 ms with a 119 ms host scan; warm refresh settled in 53 ms with a 10 ms host scan. Main cold timing was not captured. Session resume, full app restart, All computers and old peers were not exercised in this short QA.

  • Manually tested on another machine through Electron/CDP
  • Automated tests added/updated

Review

Five review rounds total: three full rounds, the performance delta, and one bounded verification of its frozen repair. The last reviewer agreed both authority regressions are fixed, verified the exact tree and 103 production / 102 test touches, and found no new issue. Final readiness covered all eight areas plus a separate six-question performance pass; no new proven candidate remained. The inherited timestamp-cutoff limitation remains deferred; no further fix or architecture round was added.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied or translated.

Notes

Execution stays on the host that owns the sessions. Folder workspaces remain supported. WSL database requests use the existing distro boundary and additive internal scope field; no response shape or stream operation changes.

Checklist

  • Focused on scoped session-history completeness
  • Before, after, mechanism and alternatives explained
  • Before/after visual evidence attached
  • Final review and performance findings resolved
  • Cross-platform, SSH, folder-workspace and mixed-version impact considered
  • Required CI and relevant tests pass on the final head

…and Project views

Session History kept only the newest sessions across every agent, then filtered
by workspace; only Claude, Pi and CodeBuddy got their older in-scope sessions
back. Every agent now declares how its cwd is found without a full parse, and
the scan selects in-scope sessions before the recency cap: Codex and other
header agents by their opening record, SQLite stores by their directory column,
the rest by their cached parse. The scan and the cached-list cut share one
scope rule.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 17, 2026 05:19
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Scoped scans retain and filter candidate files beyond the regular newest-file limit. The scanner adds per-agent CWD lookup, batched candidate parsing, cancellation checks, and alias deduplication. Shared matching accounts for normalized paths and WSL distro identity. Result merging and session-list display now account for scope paths and pending scope resolution. The exported CWD_BUCKET_LAYOUTS array was removed; individual layout exports remain.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 19302

A narrow timestamp mismatch can still hide a matching session from scoped history. Fix the cutoff before merging if complete scoped results are required.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 37.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 90 functions across 47 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly summarizes the main change: finding older sessions for agents in Workspace and Project views.
Description check Passed The description is complete and follows the repository template. It explains the user impact, implementation, rationale, limitations, visual evidence, testing, review findings, compatibility considera…
Full details: Description check

Explanation

The description is complete and follows the repository template. It explains the user impact, implementation, rationale, limitations, visual evidence, testing, review findings, compatibility considerations, and checklist status.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99929098-7ad9-4e78-9e5d-85205a52e44d
📥 Commits

Reviewing files that changed from the base of the PR and between 8612588 and bb71ac5.

📒 Files selected for processing: 27
  • src/main/ai-vault/session-cwd-bucket-layouts.ts
  • src/main/ai-vault/session-newest-files.ts
  • src/main/ai-vault/session-parse-cache-store.ts
  • src/main/ai-vault/session-scanner-antigravity-sources.ts
  • src/main/ai-vault/session-scanner-candidate-parse.ts
  • src/main/ai-vault/session-scanner-candidates.ts
  • src/main/ai-vault/session-scanner-discovery.ts
  • src/main/ai-vault/session-scanner-opencode-sources.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite-discovery.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite-dispatch.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite-list.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite-worker-client.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite-worker-protocol.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite-worker-spawn.ts
  • src/main/ai-vault/session-scanner-opencode-sqlite.test.ts
  • src/main/ai-vault/session-scanner-opencode2-sqlite-list.ts
  • src/main/ai-vault/session-scanner-scope-discovery.ts
  • src/main/ai-vault/session-scanner-scope-walk.test.ts
  • src/main/ai-vault/session-scanner-scope-walk.ts
  • src/main/ai-vault/session-scanner-source-discovery.ts
  • src/main/ai-vault/session-scanner-sqlite-scope-rows.ts
  • src/main/ai-vault/session-scanner-types.ts
  • src/main/ai-vault/session-scanner-zcode-sources.ts
  • src/main/ai-vault/session-scanner.ts
  • src/main/ai-vault/session-scope-cwd.ts
  • src/shared/ai-vault-scope-cwd-match.ts
  • src/shared/ai-vault-session-depth.ts
💤 Files with no reviewable changes: 1
  • src/main/ai-vault/session-cwd-bucket-layouts.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@brennanb2025

brennanb2025 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Agent Session History could hide a workspace’s older conversations when newer sessions from unrelated folders filled the 250-session limit. Workspace and Project now select matching history before spending their limit, through discovery, caches and All computers aggregation. Existing row actions and setup paths stay on their current paths.

Five review rounds are complete. The final main merge was checked narrowly on b3320ebc240ef54fd22f3ef2ea56672827449627; it is not a sixth design round. The reviewer agreed with the conflict resolution and found no new issue: main’s error stays visible for the failing selection until a refresh succeeds, while cancellation ends the pending state without painting an empty result. The scan line and existing issue banners retain main’s behavior. This PR’s scanner and scope-selection changes remain identical to the reviewed repair.

The loop fixed selected Workspace requests, aggregation, Antigravity enrichment, activity ordering, WSL identity and Project attribution, database error reporting, cancellation yields, cold/cached result limits and temporary false-empty presentation. Its last repair keeps current parsed metadata authoritative when Cursor metadata appears or a Codex parse leaves memory. Both regressions failed on the earlier performance patch and passed on the reviewed repair. No open P0/P1 or new proven merge issue remains.

Validation on the merged head:

  • The full PR workflow, including static analysis, typecheck, tests, packaging and its aggregate gate, passed on the exact commit. GitHub reports MERGEABLE/CLEAN, out of draft, with zero unresolved threads.
  • Windows high spec passed all five requested renderer files: 50 tests, exit 0. This covers refresh, conditional publication, the selected Workspace request, legacy filtering and the scan strip. React test warnings were retained; an initial unbuilt local package prevented collection, then the package build and targeted run succeeded.
  • Earlier repair verification passed 98/98 tests in seven related files after both new regressions failed on the preceding patch. The final readiness pass retains the eight-area review and independent performance review, with the merge checked for new interactions.

Matched Windows measurements on the reviewed scanner, 20,000 Codex transcripts and production event-loop yields: first scoped open 2.19–2.27 seconds, warm 0.235–0.243 seconds, busy 0.257–0.260 seconds, and after memory reset 2.23–2.25 seconds. The approved earlier baseline was 3.55–3.56 seconds first open and 3.59–3.70 seconds after reset; warm performance is similar. The final merge leaves those scanner files unchanged. These measurements were not repeated on the merge and are not latency or memory bounds.

Intended limits remain: sparse scopes may inspect all discovered files or database metadata rows; an uncached session that moved after its opening record can remain missing until parsed; Gemini records no directory; All retains its existing supplements; older execution hosts retain their existing coverage. No new saved field, external operation or minimum peer version is introduced. The inherited cutoff assumes activity does not exceed transcript modification time; rewritten timestamps outside that contract remain deferred. No temporary second membership authority remains.

For Brennan’s review

Fresh real Electron QA compared pinned main fc925c3e9b2 with exact merged head b3320ebc240 on M4Air. Both were freshly built, used separate throwaway homes, and read the same two genuine older Codex conversations plus 270 newer unrelated transcripts at the default history depth of 250. The approved existing signed-in Codex worker drove through CDP; no credentials were copied or new sign-in performed.

View main merged PR
Workspace A main: older conversations missing merged: both genuine conversations once
Workspace C main: 250 unrelated sessions merged: 270 matching sessions from the intended supplement
Project main: empty folder Project merged: same pre-existing folder Project gap
All main: 250 sessions merged: intended 252-session supplement

Workspace A retained both conversations exactly once after Refresh.

Merged after Refresh
Merged after A → C → A
Merged after reopening Agents

Project’s empty folder view is pre-existing, tracked in STA-10957. All’s extra rows and Workspace C’s matching supplement are intended.

The strip, count bar and list top moved 0 pixels across 55 main and 68 merged rendered frames spanning refresh and workspace switching, including loading frames. The strip stayed at y=161.5, the count bar at y=194.5, and the list at y=226.5. No rows from the wrong workspace appeared. This is sampled evidence, not a guarantee against every sub-frame condition. First-ever loading has a different count-bar state and is not covered by that geometry claim.

merged Workspace switch loading below the retained strip
merged first-open scanning state

The QA worker inspected all 22 full-window captures; 13 were uploaded. All recorded app/daemon descendants exited and assigned ports were clear. The five established real-config fingerprints stayed unchanged through every app interval and final cleanup. A later check found an unattributed Codex config change after all test processes had exited; two account-local hooks files were discovered only at the end and lack before-run hashes. Those are explicit evidence limits, not a claim that all final real configuration stayed unchanged. No config contents were copied, inspected or restored.

This short rerun did not inject error/partial-scan banners or exercise resume, whole-app restart, setup/default tabs, All computers, other providers, live WSL/SSH, older peers, or large-corpus memory. Error/banner interaction was checked in source and the named tests. Prior screenshots and timings are historical; the images above show the merged head.

Judgment points:

…history-scope-before-cap

# Conflicts:
#	src/main/ai-vault/session-scanner.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bcb6826c-9561-45fa-a0bb-28b77de8545e
📥 Commits

Reviewing files that changed from the base of the PR and between 6806fac and 1930262.

📒 Files selected for processing: 2
  • src/main/ai-vault/session-scanner-candidate-parse.ts
  • src/main/ai-vault/session-scanner.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

…a per-file read

A scoped scan walks every transcript, and each one cost an await, a parse-cache
database lookup and, for Codex, two head reads every scan. Remember each file
version's settled cwd (from its opening records or its parse), drop settled
out-of-scope files synchronously before the async walk, and read Codex's
roughly 20 KB first record in one 64 KB read.
…ipt heads

The settled-cwd prefilter let a transcript-only verdict reject files whose
current parse (hot or cold) says otherwise: a Cursor chat whose meta.json
appeared later, or a Codex session whose parsed latest cwd moved after its
row left memory. Restore parse-cache-first selection; keep Codex's single
64 KB first read.
…history-scope-before-cap

# Conflicts:
#	src/renderer/src/components/right-sidebar/ai-vault-session-refresh.ts
@brennanb2025
brennanb2025 merged commit 407bf03 into main Oct 18, 2026
37 checks passed
brennanb2025 added a commit that referenced this pull request Oct 18, 2026
nachumi-a2zoperations added a commit to A2Z-Operations/orca that referenced this pull request Oct 20, 2026
Resolution groups:
1. Revert-caused conflicts (29 files under acp, ai-vault, native-chat, pi,
   claude, codex, runtime/rpc, renderer ai-vault, shared ai-vault, mobile
   picker): upstream side taken. Our side carried only upstream release-branch
   commits there (2213562, c361d26, bb20d8f, 42e1469), none of ours.
   Files deleted on one side follow upstream (3 restored, 3 removed).
   Also aligned to v1.4.232: 40 files that auto-merged but still carried the
   stablyai#29977 revert (c361d26) or a duplicated stablyai#30436 test block (bb20d8f);
   no fork or PR commit touches them.
2. package.json: upstream (version 1.4.232); no own change on our side.
3. cloud-operate-relay-production-reserve-watch.yml: upstream. 5974258 is an
   upstream "match main's workflow files" commit; .github now equals v1.4.232.
4. src/main/updater/updater-setup.ts: upstream structure (macOS ShipIt
   scheduling, stablyai#30944) plus our kill-switch import; the early returns in both
   check entry points and setupAutoUpdater auto-merged unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant