Repository navigation
Conversation
Every render parsed the whole session transcript, even when no configured widget uses anything from it. Token metrics are the usual reason for the scan, but the context widgets (context-length, context-percentage, context-percentage-usable, context-bar) and the full-until-compact flex mode only fall back to them when the status JSON lacks the matching context_window field, and the cache widgets only read them in session scope. The render now asks for token metrics only in those cases and skips the scan entirely when nothing else (session clock, speed, compaction, thinking effort, session name) needs it. getTranscriptAnalysis gains an includeTokenMetrics option (default true, tokenMetrics is null when it is false). A property test renders every data-only widget with and without transcript metrics for several payload shapes and fails if the output differs while the gate says the scan can be skipped. Measured (node dist, 20 interleaved passes, load1 ~57 on 6 cores), CPU median per render: default config 1575 -> 1270 ms on a 5 MB transcript (-19%), 2837 -> 1222 ms on 50 MB (-57%); a config with token widgets is unchanged. Output is byte-identical on 90 config/payload pairs, including payloads without context_window, without context_window_size, and with a missing transcript. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 30, 2026
whycantfindaname
pushed a commit
to whycantfindaname/ccstatusline
that referenced
this pull request
Oct 1, 2026
Merged from the jason/beta4-local-fixes Trellis build (compat-repair base): bounded stdin reads in shared hooks (sirmalloc#590), research dispatch may write the task research dir (sirmalloc#634), scoped archive commits (sirmalloc#622, sirmalloc#630), list filter traversal (sirmalloc#631), remove-subtask link check (sirmalloc#632), hooks.local.json ignore (sirmalloc#633).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
full-until-compactflex mode fall back to transcript token metrics only when the status JSON lacks the matchingcontext_windowfield. Cache widgets read them only in session scope.Details
Which widgets and modes read which part of the transcript analysis (at 35440e4):
tokens-input,tokens-outputtokenMetricscontext_windowtotals)tokens-cached,tokens-totaltokenMetricscache-hit-rate,cache-read,cache-writetokenMetricscontext-length,context-percentage-usabletokenMetrics.contextLengthcontext_windowgives no context lengthcontext-percentage, flexfull-until-compacttokenMetrics.contextLengthcontext_windowgives no used percentagecontext-bartokenMetricscontext_window_size(it uses the mere presence of metrics to choose the model's default window)session-clocksessionDurationhasSessionClock && !hasSessionDurationInStatusJson)speedMetricsCollection(+ subagent files)hasSpeedItems)compaction-counter,thinking-effort,session-nameneedsTranscriptTokenMetrics(lines, settings, data)(src/utils/transcript-requirements.ts) implements the token-metrics rows. It reads the samegetContextWindowMetricsfields the widgets test, and it resolves legacy widget types.renderMultipleLinespassesincludeTokenMetricsthrough. It skipsgetTranscriptAnalysiswhen no flag is set, andtokenMetricsis thennull.getTranscriptAnalysisgainsincludeTokenMetrics(defaulttrue, so other callers are unchanged).TranscriptAnalysis.tokenMetricsisnullonly when a caller turns it off.includeSubagents: trueis hard-coded, but it has no effect without speed widgets: the agent-id walk and the subagent re-reads only run whenincludeSpeedMetricsis set. When speed widgets are configured they need that data, so this PR leaves it alone.Tests:
null. It covers five payload shapes and both cache scopes. It fails if the outputs differ while the gate says the scan can be skipped. It also checks the flex-mode percentage. It fails if thecontext-barwindow-size case or any token widget is dropped from the gate (verified by mutation).jsonl-metricstest checks thatincludeTokenMetrics: falsegivestokenMetrics === nulland still collects the other fields.Overlap: #591 (ours) and #622 touch token counting in
src/utils/jsonl-metrics.ts. This PR only adds the option and the nullable return there, so any conflict is trivial. #640 (ours, transcript pre-filter) edits the scan loop in the same file. It is independent of this PR: this one skips the scan when nothing reads it, and #640 makes the scans that remain cheaper.Measurements
node dist/ccstatusline.js. Base and patched arms were interleaved round-robin in one run with 20 passes plus anode -e 0control. CPU is user+sys including children, in ms. Settings usegitCacheTtlSeconds: 0. Payloads carry a fullcontext_window. Transcripts are synthetic (5 MB and 50 MB, Claude Code record mix).node -e 0Load1 during the run was min 48.6, median 56.6, max 64.2 on 6 cores. The host was heavily loaded, so compare ratios, not absolute times. With the patch, the default-config cost no longer depends on transcript size. The all-widgets config still scans (it has token and speed widgets), and its p90s overlap, so it is unchanged within noise.
Byte-identity: I compared stdout of base and patched on 90 config 脳 payload pairs. That covers every benchmark config, a config with every context/cache widget plus
full-until-compact, and a config with token widgets. Payloads include ones withoutcontext_window, withoutcontext_window_size, with onlyused_percentage, and with a missing transcript. All 90 pairs are identical.Checks
bun run lint: clean.bun run build: OK.bun test: the new and changed suites pass. On this loaded host the full run also failed infetchUsageData error handling,custom command capture, and some TUI menu suites (timeouts). Running those 9 files on unmodifiedmainon the same host at the same time gave 62 failures, against 58 with this branch. They are load flakes, and none of them touch the changed code.馃 Generated with Claude Code