Skip to content

[rendering-scripts] Extract token counts from new Copilot CLI footer#34192

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
fix/copilot-parser-new-footer-tokens-4c022f50a3f60e61
Draft

[rendering-scripts] Extract token counts from new Copilot CLI footer#34192
github-actions[bot] wants to merge 1 commit into
mainfrom
fix/copilot-parser-new-footer-tokens-4c022f50a3f60e61

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

The Copilot CLI 1.0.48 pretty-print log now emits a single-line footer such as

Tokens    ↑ 163.9k • ↓ 567 • 149.2k (cached)

with no preceding Breakdown by AI model: section. parse_copilot_log.cjs already recognised this line and stripped it from the agent text body, but the actual token counts were never extracted — so generateInformationSection rendered with no token usage at all.

What changed

  • parse_copilot_log.cjs: parse the Tokens ↑X • ↓Y • Z (cached) line into input_tokens, output_tokens, and cache_read_input_tokens on the result entry. k suffixes 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 produced usage: {}, and the Information section dropped tokens.

After the fix the Information section renders:

**Token Usage:**
- Total: 313,667
- Input: 163,900
- Cache Read: 149,200
- Output: 567

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 passed
  • Re-ran the parser against the real run-26328075922/agent-stdio.log and confirmed the Information section now shows the expected token totals.

References

Generated by ✅ Daily Rendering Scripts Verifier · ● 32.4M ·

  • expires on May 26, 2026, 8:40 AM UTC

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>
@github-actions github-actions Bot added automated-fix javascript Pull requests that update javascript code rendering labels May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix javascript Pull requests that update javascript code rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants