Repository navigation
fix(tui): keep Copilot totals after background refresh - #1784
Merged
iamtoruk merged 4 commits intoOct 27, 2026
Merged
Conversation
Contributor
The provider-scoped background index kept the cached slice whenever the live parse had the same call count, while report and the first paint (buildDurablePeriod) take the live slice there. A shared cache derived under older numbers, which a provider-only run never re-derives, still moved the headline after refresh: on the getagentseal#1769 reporter's machine Lifetime went from 69.91 to 68.68 with the same calls and less output. The index now uses overlayProviderDaySlices like buildDurablePeriod. It also fills the dates and slices the cache lacks, so the date fill above goes back to main. Two test values that pinned the cached slice move to what report shows for the same data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


The provider-filtered TUI could show the correct spend at first paint, then drop its headline to zero after background indexing while the project and model panels retained the usage. The shared daily cache was non-empty and complete but lacked the sessions' entire date; the indexed headline refused to fill that date.
Allow provider-scoped projections to fill missing historical dates from their normalized sessions even when the shared cache is complete. Existing cached days keep their precedence, period and project filters still apply, and the projection leaves the shared cache unchanged. No parser or cache-format change.
Closes #1769.
Behavior proof
Two controlled Copilot VS Code journals contain 40 + 60 credits ($1.00), 2,000 input tokens and 1,000 output tokens, three days before the run. A complete shared cache contains only an unrelated older Claude day.
1a3ce74aThe new integration test mounts the production Ink dashboard and waits for its actual background refresh. It also covers 5,000 cache-read tokens, project inclusion/exclusion, repeated refreshes and byte-for-byte cache preservation. Two additional regression cases cover Copilot and Codex period bounds and retention of richer cached history. All three added cases fail against the unchanged production code and pass with the fix.
These are controlled fixtures on macOS, not the reporter's logs or a live Windows Copilot installation. The images render captured, ANSI-stripped Ink output; capture details.
Validation
Node 26.8.1, unchanged dependencies, normal root test scope (
npm test -- --maxWorkers=2):1a3ce74a2029c3dd, first full runThe first branch run failed the existing raw Ctrl-C hydration-lock removal assertion in
tests/dashboard-process-exit.test.ts. Its original two-test suite then passed separately on main and branch; the full branch rerun passed without changing code, assertions or timeouts. The initial failure is retained above.npx tsc --noEmit,npm run build, andgit diff --checkpassed.