Repository navigation
fix(tui): flag likely cache busts accurately - #38727
Merged
Merged
Conversation
kitlangton
enabled auto-merge (squash)
July 24, 2026 17:59
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 2026
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.
What
Make the debug turn-token view warn about likely prompt-cache busts without flagging known cache resets or OpenAI accounting noise.
The TUI now:
! Likely cache bustBefore / After
Before
Every lower cached-token count was labeled a definitive
Cache bust, including normal OpenAI quantization, comparisons across model switches, and expected cache resets after compaction. An intermediate revision suppressed those false positives but made every remaining drop a subdued neutral observation.After
Known OpenAI bucket movements remain silent. Model switches and completed compactions establish a new baseline. A larger decrease between matching, uncompacted model steps is highlighted without claiming certainty about its cause.
How
packages/tui/src/routes/session/rows.tscarries model identity with cross-turn cache baselines, clears the baseline at completed compaction boundaries, and centralizes reuse-drop classification.packages/tui/src/routes/session/index.tsxcompares each step against the preceding comparable cache sample and renders unexplained drops with warning wording and color.packages/tui/test/cli/tui/session-rows.test.tscovers OpenAI threshold boundaries, non-OpenAI drops, model/variant switches, cross-turn baseline projection, and completed compaction resets.Scope
This changes debug-only reporting. It does not claim a proven cause, alter model requests, change cache policy, modify compaction, or change token accounting.
Testing
bun run test test/cli/tui/session-rows.test.ts: 15 passed, 0 failedbun run testinpackages/tui: 519 passed, 5 skipped, 0 failedbun typecheckinpackages/tui: passedbun turbo typecheck --concurrency=3: 33 tasks passed