[rendering-scripts] Extract token counts from new Copilot CLI footer#34192
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[rendering-scripts] Extract token counts from new Copilot CLI footer#34192github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Copilot CLI 1.0.48 emits a single-line footer Tokens ↑ 163.9k • ↓ 567 • 149.2k (cached) with no preceding "Breakdown by AI model:" section. The pretty-print parser already recognised this line and stripped it from the agent text body, but the actual token counts were never extracted, so the Information section rendered with no token usage. Parse the arrow form into input/output/cache_read_input_tokens so the totals reach generateInformationSection (and the per-conversation summary). Discovered while verifying run 26328075922 (Weekly Editors Health Check, copilot engine). Co-Authored-By: Claude Opus 4.7 (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.
Summary
The Copilot CLI 1.0.48 pretty-print log now emits a single-line footer such as
with no preceding
Breakdown by AI model:section.parse_copilot_log.cjsalready recognised this line and stripped it from the agent text body, but the actual token counts were never extracted — sogenerateInformationSectionrendered with no token usage at all.What changed
parse_copilot_log.cjs: parse theTokens ↑X • ↓Y • Z (cached)line intoinput_tokens,output_tokens, andcache_read_input_tokenson the result entry.ksuffixes are normalised the same way as the existing model-breakdown path.parse_copilot_log.test.cjs: two new tests (with-cached, without-cached) and the existing suppression test still passes.How this was discovered
Daily verifier ran the parser against run §26328056329 which had inspected the most recent agentic run, §26328075922 (Weekly Editors Health Check, copilot engine, CLI version
1.0.48). The agent-stdio log contained the new footer, the parser producedusage: {}, and the Information section dropped tokens.After the fix the Information section renders:
Test plan
npm run test:js -- parse_copilot_log— 35 passed (33 prior + 2 new)npm run test:js -- render_template log_parser_shared parse_copilot_log— 222 passedrun-26328075922/agent-stdio.logand confirmed the Information section now shows the expected token totals.References