Skip to content

fix: use actual model name from token-usage.jsonl in effective tokens footer prefix#34303

Closed
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-tokens-footer-model-name
Closed

fix: use actual model name from token-usage.jsonl in effective tokens footer prefix#34303
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-tokens-footer-model-name

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 23, 2026

When a user configures a model alias (e.g. agent) in their workflow frontmatter, the ET footer suffix showed age00 — the reduced form of the alias — instead of the real model identifier resolved by the API (e.g. son46 for claude-sonnet-4-6).

Root cause

GH_AW_ENGINE_MODEL stores the user-supplied alias. Footer rendering read that variable for the compact ● <model> <ET> prefix, with no access to the actual model name reported in token-usage.jsonl.

Changes

  • parse_mcp_gateway_log.cjs — Added getPrimaryModel(byModel) to pick the model with the highest ET from token-usage.jsonl data; exports it as a new effective_tokens_model step output alongside effective_tokens.

  • compiler_main_job.go — Exposes effective_tokens_model as an agent job output.

  • compiler_safe_outputs_job.go / notify_comment.go — Passes GH_AW_EFFECTIVE_TOKENS_MODEL env var (from agent job output) to the safe-outputs and failure-notification jobs.

  • messages_footer.cjs — Added resolveEffectiveTokensModelName() (GH_AW_EFFECTIVE_TOKENS_MODEL || GH_AW_ENGINE_MODEL); all ET-prefix paths use it. The XML model: marker intentionally keeps GH_AW_ENGINE_MODEL — it records the configured alias.

  • effective_tokens.cjsgetEffectiveTokensSuffix() prefers GH_AW_EFFECTIVE_TOKENS_MODEL over GH_AW_ENGINE_MODEL.

  • Lock files / golden snapshots — Recompiled 234 workflows; golden files updated with new effective_tokens_model job output.

Result

// Before — user configured model: "agent"
> Generated by [Daily Team Evolution Insights](...) · ● age00 7.1M

// After — actual model from token-usage.jsonl: "claude-sonnet-4-6-20250514"
> Generated by [Daily Team Evolution Insights](...) · ● son46 7.1M

Copilot AI and others added 2 commits May 23, 2026 21:19
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
When a user configures an alias like "agent" as the model name,
the effective tokens footer was showing "age00" (the reduced form
of "agent") instead of the real model identifier (e.g. "son46"
for claude-sonnet-4-6).

Fix:
- Export the primary actual model name from token-usage.jsonl as
  `effective_tokens_model` step output in parse_mcp_gateway_log.cjs
- Expose it as an agent job output in compiler_main_job.go
- Pass it as GH_AW_EFFECTIVE_TOKENS_MODEL env var in
  compiler_safe_outputs_job.go and notify_comment.go
- Prefer GH_AW_EFFECTIVE_TOKENS_MODEL over GH_AW_ENGINE_MODEL
  in messages_footer.cjs and effective_tokens.cjs when building
  the compact model prefix for effective-token suffixes
- Recompile all 234 workflow lock files
- Update golden test snapshots

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title fix: use actual model name in effective tokens footer entry fix: use actual model name from token-usage.jsonl in effective tokens footer prefix May 23, 2026
Copilot AI requested a review from pelikhan May 23, 2026 21:25
@pelikhan pelikhan marked this pull request as ready for review May 23, 2026 21:49
Copilot AI review requested due to automatic review settings May 23, 2026 21:49
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile, fix conflicts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes effective-token (ET) footer rendering when workflows use a model alias (e.g., agent) by propagating the actual resolved model name from token-usage.jsonl through job outputs/env vars so the compact ● <model> <ET> prefix uses the real model identifier (e.g., son46) instead of the alias-derived identifier.

Changes:

  • Add a new effective_tokens_model step/job output sourced from token-usage.jsonl (selecting the model with the highest ET).
  • Propagate GH_AW_EFFECTIVE_TOKENS_MODEL into safe-outputs and failure-notification paths and prefer it over GH_AW_ENGINE_MODEL for ET suffix/prefix rendering.
  • Recompile/update workflow lockfiles to include the new output and env var wiring.
Show a summary per file
File Description
actions/setup/js/parse_mcp_gateway_log.cjs Exports effective_tokens_model based on the primary model from token-usage.jsonl (highest ET).
actions/setup/js/messages_footer.cjs Prefers GH_AW_EFFECTIVE_TOKENS_MODEL for ET model-prefix rendering (with fallback).
actions/setup/js/effective_tokens.cjs Uses GH_AW_EFFECTIVE_TOKENS_MODEL (fallback to GH_AW_ENGINE_MODEL) when building the ET suffix.
actions/setup/js/messages.test.cjs Adds coverage ensuring the ET model prefix prefers the actual model over a configured alias.
pkg/workflow/compiler_main_job.go Exposes effective_tokens_model as an agent job output.
pkg/workflow/compiler_safe_outputs_job.go Passes GH_AW_EFFECTIVE_TOKENS_MODEL into the safe-outputs job environment.
pkg/workflow/notify_comment.go Passes GH_AW_EFFECTIVE_TOKENS_MODEL into failure-notification/conclusion job environment.
.github/workflows/*.lock.yml (many files) Updates generated workflow lockfiles to include the new effective_tokens_model output and env var propagation.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 251/251 changed files
  • Comments generated: 0

@pelikhan pelikhan closed this May 23, 2026
Copilot stopped work on behalf of pelikhan due to an error May 23, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants