Repository navigation
[low] fix(cache-timer): stop reporting HOT after interrupts and local slash commands - #628
Merged
sirmalloc merged 1 commit intoOct 9, 2026
Conversation
scanTailForState treated any trailing main-chain user row as an in-flight request. Claude Code also writes user-role rows that never reach the API: the "[Request interrupted by user]" marker left by Esc, and the bookkeeping rows of local slash commands such as /cost or /model (<local-command-caveat>, <command-name>, <local-command-stdout>). A session ending on one of those showed HOT indefinitely, even after the prompt cache had gone cold, which is the state the widget exists to warn about. Treat those rows like an assistant row that refreshed nothing: they end the turn, and the countdown keeps anchoring on the newest assistant row with cache activity. Rows with any other content (including isMeta prompt-command expansions and hook context, which are sent to the model) still count as in flight. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 10, 2026
Closed
This was referenced Oct 17, 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.
BLUF
/cost,/model, ...), even once the prompt cache had gone cold.userrow counted as in flight, but Claude Code writes severaluserrows that never reach the API.Details
Failure scenario.
scanTailForStatewalks the transcript tail newest-first and returns{ isWorking: true }for the firsttype: "user"row it meets before any assistant row. It never looks at what that row is. Claude Code also appendsuserrows that do not start or continue an API request:[Request interrupted by user](or... for tool use]), written after Esc;isMeta<local-command-caveat>row, a<command-name>/cost</command-name>...row, and usually a<local-command-stdout>row. Some commands record asystemrow instead of the stdout row.If a session ends on one of these, the tail finishes with a user row that has no assistant row after it. The widget then shows HOT until the next real prompt, including after the 5-minute TTL has passed, which is the moment the widget is meant to warn about.
Fix. A small
endsTurnWithoutResponsehelper recognizes those rows by content prefix ([Request interrupted by user,<command-name>,<local-command-stdout>,<local-command-stderr>,<local-command-caveat>). In the scan they setturnFinishedand continue, the same handling as an assistant row that refreshed no cache. They never anchor the countdown. Rows whose content is missing or unrecognized still count as in flight, so the existing behaviour and fixtures are unchanged.Deliberately not skipped:
isMetarows in general. Prompt-based slash commands (<command-message>first) and hook or skill context are written asisMetauser rows, and they are sent to the model. A guard test pins this: a prompt command still shows HOT.isCompactSummaryrows. A manual/compactalready ends in local-command rows, which this change handles. An auto-compact mid-turn continues with a real request.Checks
bun run lint(tsc + eslint--max-warnings=0): clean.bun test src/widgets/__tests__/CacheTimer.test.ts:🔥 HOT.bun test: CacheTimer and CacheWidgets suites all pass. Remaining failures are time-limit-sensitive suites that already fail on unmodifiedmainon the same heavily loaded machine:fetchUsageData error handlinghits its 5 s timeout, and there are custom-command capture and TUI menu tests. None of them touch the cache timer.main(same machine): 2306 pass, 52 fail, in the same 12 suites. The pass count differs by exactly the 3 new tests.bun run build: succeeds, anddist/ccstatusline.jsis present.🤖 Generated with Claude Code