Skip to content

Session History: the "Reading N / M files" count reaches its total - #30683

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/scan-strip-count
Oct 19, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/scan-strip-count

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20

ELI5

While Session History scans your agents' transcripts, a strip says "Reading N / M files". The count could never reach its total: a teammate's strip sat at "Reading 2,417 / 3,259 files" until the scan finished. The scan promised to read files it then never needed, and never took them back off the total. Now it does, so the count no longer sits below a total it can never reach.

What Changed

Before: on a large history, the first part of the scan put its whole list of candidate files on the total, up to twice the History depth (2,000 at the default). It then stopped as soon as it had enough sessions, typically well short of that list. The unread files stayed on the total for the rest of the scan. The teammate's numbers fit this (the split between passes is inferred, not measured): 1,158 of 2,000 planned files read, plus 1,259 read by the Workspace walk, gives 2,417 / 3,259.

After: when that first pass stops early, the files it skipped come off the total, so the strip no longer stalls below a total the scan can't reach, and the scan's final report has the count equal to its total. The strip still switches to "Scanned N files" when the scan finishes, as before. The existing progress throttle can leave the last "Reading" frame short before "Scanned" replaces it. That behavior is accepted and unchanged. Its nominal one-second update interval is a scheduler cadence, not a wall-clock guarantee during a stalled event loop or filesystem operation.

Mechanism. The scan has three passes that read transcripts: the newest-first pass, the Workspace or Project folder walk, and the per-folder Claude pass. Each pass told the progress tally how many files it would read, but only parseSessionCandidates knows how many it actually reads. Now that loop owns its share of the total:

  • A pass with a fixed list announces the list when it starts and takes back whatever it didn't reach when it stops (noteAiVaultScanUnread, a new dropUnread on the tally).
  • The filtered Workspace walk keeps announcing each batch it selects, as it already did.
  • The two callers no longer announce a total of their own, so no caller can promise files the loop then skips.

Plan (full review path). Keep the existing total and session limit, and put announcement and retirement of planned reads in the parse loop that knows which files it skips. This changes five production files (+26/-6), adds one regression, and changes no saved data, payload shape, scan selection, ordering, or process/session lifecycle. The review rejected the light path because the mutable count is reported from the scan worker to windows. Correctness, architecture, a dedicated performance pass, independent plan checks, real Electron QA, and the full PR workflow passed on the final head. No publication or throttling changes are planned.

Why

The common pattern uses a spinner or "Scanning…" for discovery that can stop early. Orca keeps its existing "N / M" display; the loop that decides which reads are needed also owns the total it announces.

Options considered:

  • Announce every pass per batch. The total would then be at most 8 files ahead of the count, so it would say nothing useful.
  • Leave the up-front totals and have each caller subtract later. That keeps the plan and the correction in two places, which is how this bug came about.
  • Show only "Reading N files", with no total. That matches the common pattern most closely, but it removes something users see now. That is a product choice nobody has asked for.

Difference from the common pattern, labelled:

  • Intended: Orca keeps the existing "N / M" total. M is now the files planned for reading, minus any a pass skipped once it had enough sessions. M can drop when the first pass finishes early. The finished report balances the reads; the last active frame still follows the existing throttle.

Linked Issue

Follow-up to #30469 (tracked in STA-11097), whose plan listed this as a separate fix in the scan tally.

Visual Proof

Compared main 83c768d1b433 with head 006b712232b1e170dd327bf3fc5c30f18baf311f on the qa-gate-admitted M4Air, using the same 4,479 genuine transcript files. All seven paired flows preserved ordered session rows, metadata, per-agent counts, the depth limit, and the final Scanned footprint. Exact results and before/after progress screenshots. The approved exception was used: the existing signed-in Codex worker drove the isolated app directly through CDP.

Flow Main finished reads Branch finished reads Rows displayed Finish
Workspace, cold 385/588 385/385 72 Scanned 3,103 files
All, global cold 297/500 297/297 250 Scanned 3,103 files
Project and warm scoped scans 372/575 372/372 72 scoped / 325 All Scanned 3,103 files
Sparse history 1/1 1/1 1 Scanned 1 file

The long Workspace walk painted 297/297 after retiring the unread suffix. The last Reading frames were 358/385 for Workspace and 48/500 for global All; Scanned replaced them about 731ms and 696ms later. These are measured examples, not a hard timing guarantee. Warm scans emitted no Reading frame. Timings varied between runs and are not a performance benchmark.

Testing

  • Manual Electron QA completed on the qa-gate-admitted M4Air

  • Automated tests added/updated, or explained why not below

  • New test: a real scan where the newest file fills a limit of 1 ends with read: { done: 1, total: 1 }. On main the same scan ends at { done: 1, total: 2 }.

  • Ran 6 named test files on macOS (24 tests): scan progress flow, scan progress, scan cutoff, Workspace walk, scanner service entry and the request deadline. The full PR workflow, including static analysis, all five test shards, relay integration, macOS/Windows packaging, and its aggregate gate, passed on 006b712232b1e170dd327bf3fc5c30f18baf311f.

Review

Full-path correctness, architecture, dedicated performance/readiness review, and sequential plan checks found no open defect under the stated scope. Existing final-frame throttling is documented above; it is unchanged. Real Electron QA and the full PR checks are complete on the final head. Live Windows, WSL, Linux, SSH and mixed-version flows, CPU and heap measurements were not exercised; the relevant unchanged paths were source-reviewed.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH and paired hosts: the strip shows only this computer's scan; the progress payload goes from the scanner child process to the main process and then to the window, all one app build. No wire change.
  • Mobile: does not read this progress.
  • WSL and folder workspaces: unchanged; this only counts files the scan already reads.
  • No new saved data.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after progress screenshots attached in the linked review comment
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • Lint, typecheck, tests, packaging and aggregate gate passed in CI on the final head

The scan's first pass announced its whole candidate slice (limit x 2) as files
to read, then stopped once it had enough sessions, and nothing took the unread
files back out of the total. The parse loop now owns its share of the total:
an unfiltered pass announces its list and takes back what it never read; a
filtered walk keeps announcing per selected batch.
@brennanb2025

brennanb2025 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Session History announced files before reading them, then stopped early when it had enough recent sessions. The unread remainder stayed in the total during the later Workspace walk, leaving “Reading N / M files” below a total the scan could no longer reach.

The parser now owns both announcing planned reads and retiring the suffix it skips. The total can decrease when a pass stops early. Session selection, order, the depth limit, per-agent counts and the “Scanned N files” finish are unchanged.

Full-path review completed on 006b712232b1e170dd327bf3fc5c30f18baf311f: correctness, architecture, dedicated performance/readiness review and independent plan checks found no open defect under the agreed scope. No production change was needed during review. The final merge of main left all reviewed AI Vault files byte-identical and included the unrelated import fix in #30680. The full PR workflow and aggregate gate passed on this exact head.

Real Electron QA compared main 83c768d1b433 and this head on the qa-gate-admitted M4Air with the same frozen 4,479-file genuine history. Seven paired flows covered cold Workspace, global All, All with an active workspace, Project, Workspace/All revisits and sparse history. All head scans finished with equal read counts. Full ordered loaded/displayed rows, stored metadata and agent rosters matched; only isolated-home prefixes and naturally advancing relative-age labels were normalized. The existing signed-in Codex worker directly driving the isolated apps through CDP was the approved driver exception. Protected hook files were unchanged.

Flow Main finished reads Head finished reads Displayed rows, both Finish, both
Workspace, cold 385/588 385/385 72 Scanned 3,103 files
All, global cold 297/500 297/297 250 Scanned 3,103 files
Project / warm scoped scans 372/575 372/372 72 scoped / 325 All Scanned 3,103 files
Sparse history 1/1 1/1 1 Scanned 1 file

Deferred, accepted existing behavior: the last active Reading frame is not guaranteed to balance before Scanned replaces it. Head Workspace ended its active frames at 358/385 and global All at 48/500; Scanned replaced those frames about 731ms and 696ms later. Warm scans painted no Reading frame. No publication flush was added. On the long Workspace walk, 297/297 appeared after the 203-file suffix was removed and before real scope reads were announced. A later 5.961-second event gap occurred while actual scope reads remained pending, after the unreachable debt had been retired. Its cause was not established. The nominal 1000ms cadence is not a universal wall-clock bound. Run times varied and these captures are not a controlled performance comparison.

Live Windows, WSL, Linux, SSH and mixed-version flows, cancellation/failure, CPU and heap measurements were not exercised; relevant paths were source-reviewed. Both builds logged existing listener warnings without new visible errors. Full-window screenshots and raw session metadata remain private; the progress crops below contain no transcript content.

For Brennan’s review:

Workspace, main → head during the later walk (the head subsequently continued real scope reads):

Main Workspace Reading 318 of 588

Head Workspace Reading 297 of 297

Global All, main → head last active frame → unchanged finish. The head’s active frame still lags; its finished event is 297/297:

Main global All Reading 224 of 500

Head global All last Reading 48 of 500

Head global All Scanned 3103 files

Project, main → head (neither warm scan painted Reading):

Main Project Scanned 3103 files

Head Project Scanned 3103 files

Two intended judgments: the parse loop owns the initial total, and it retires the suffix it skips. The existing N/M display is retained intentionally.

Remote QA apps, servers, transfer shell, copied corpus/rigs/evidence and QA checkout were cleaned up after the full evidence was checksum-verified on the coordinator.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 702bcd9e-eeac-442d-a550-46c5debf42ef
📥 Commits

Reviewing files that changed from the base of the PR and between 83c768d and 006b712.

📒 Files selected for processing: 6
  • src/main/ai-vault/ai-vault-scan-progress-flow.test.ts
  • src/main/ai-vault/ai-vault-scan-progress.ts
  • src/main/ai-vault/ai-vault-scan-tally.ts
  • src/main/ai-vault/session-scanner-candidate-parse.ts
  • src/main/ai-vault/session-scanner-scope-walk.ts
  • src/main/ai-vault/session-scanner.ts
  • 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.

@brennanb2025
brennanb2025 merged commit 6285797 into main Oct 19, 2026
33 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/scan-strip-count branch October 19, 2026 18:16
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