Skip to content

Render compressed model alias before AIC in generated footers - #47018

Merged
pelikhan merged 2 commits into
mainfrom
copilot/render-compressed-model-name
Jul 21, 2026
Merged

Render compressed model alias before AIC in generated footers#47018
pelikhan merged 2 commits into
mainfrom
copilot/render-compressed-model-name

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Footer cost attribution was emitting only numeric AIC, which obscured which model generated the spend. This update prepends the compressed model alias (for example sonnet46) immediately before the AIC value across generated issue/comment/body footer paths.

  • Core footer AIC suffix formatting

    • Updated messages_footer.cjs to derive compressedModelName from GH_AW_ENGINE_MODEL and include it in AIC suffix construction.
    • Applied this consistently for:
      • default AIC suffix (GH_AW_AIC)
      • split agent + detection suffixes (GH_AW_AGENT_AIC, GH_AW_THREAT_DETECTION_AIC)
      • explicit context AIC overrides.
  • No-op comment footer parity

    • Updated handle_noop_message.cjs footer suffix generation to use the same compressed model prefix before total AIC.
  • Behavioral coverage updates

    • Adjusted footer expectations in JS tests so model-prefixed AIC output is validated in standard footer, failure footer, and noop comment footer flows.
// before
"> Generated by [Workflow](...) · 1.25 AIC"

// after
"> Generated by [Workflow](...) · sonnet46 1.25 AIC"

Run: https://github.com/github/gh-aw/actions/runs/29816999996

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 12.4 AIC · ⌖ 6.12 AIC · ⊞ 5.5K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Render compressed model name before AIC in generated footers Render compressed model alias before AIC in generated footers Jul 21, 2026
Copilot AI requested a review from pelikhan July 21, 2026 08:01
@pelikhan
pelikhan marked this pull request as ready for review July 21, 2026 08:21
Copilot AI review requested due to automatic review settings July 21, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds compressed model aliases to AIC footer attribution.

Changes:

  • Prefixes AIC values with compressed model names.
  • Applies formatting to standard, failure, and no-op footers.
  • Updates footer tests.
Show a summary per file
File Description
actions/setup/js/messages_footer.cjs Adds model-prefixed AIC formatting.
actions/setup/js/handle_noop_message.cjs Adds model attribution to no-op footers.
actions/setup/js/messages.test.cjs Updates standard and failure footer expectations.
actions/setup/js/handle_noop_message.test.cjs Tests no-op attribution.
actions/setup/js/handle_agent_failure.test.cjs Tests generated failure issue attribution.

Review details

Tip

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

  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Medium

aiCredits,
aiCreditsFormatted,
aiCreditsSuffix,
compressedModelName,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in the latest commit. compressedModelName: string|undefined is now included in the getAICFromEnv() JSDoc @returns type, resolving the TS2353/TS2339 errors.

Comment thread actions/setup/js/messages_footer.cjs Outdated
* }}
*/
function getAICFromEnv() {
const compressedModelName = reduceModelNameToIdentifier(process.env.GH_AW_ENGINE_MODEL);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. parse_token_usage.cjs now exports GH_AW_PRIMARY_MODEL via core.exportVariable (using the actual model observed in token-usage logs). getAICFromEnv() in messages_footer.cjs now reads process.env.GH_AW_PRIMARY_MODEL || process.env.GH_AW_ENGINE_MODEL, so the display reflects the real spending model rather than the configured alias.

const detectionRaw = process.env.GH_AW_THREAT_DETECTION_AIC;
const agentAIC = agentRaw ? Number.parseFloat(agentRaw) : NaN;
const detectionAIC = detectionRaw ? Number.parseFloat(detectionRaw) : NaN;
const compressedModelName = reduceModelNameToIdentifier(process.env.GH_AW_ENGINE_MODEL);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. buildAICSuffix() in handle_noop_message.cjs now uses process.env.GH_AW_PRIMARY_MODEL || process.env.GH_AW_ENGINE_MODEL for the same accurate attribution, consistent with the regular footer path.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #47018 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review: Render compressed model alias before AIC in generated footers

The change is clean and consistent across footer paths. Existing inline comments capture the two substantive concerns:

  1. Model attribution accuracyGH_AW_ENGINE_MODEL may hold a logical alias (e.g. agent) rather than the observed model from token usage, so the displayed prefix could be misleading.

  2. JSDoc return type gapcompressedModelName is now included in the getAICFromEnv return object but is absent from the declared @returns typedef.

No blocking issues beyond what is already flagged in existing inline comments.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 17.9 AIC · ⌖ 4.37 AIC · ⊞ 4.9K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review

Applied /diagnosing-bugs and /codebase-design. The three existing inline comments from Copilot already surface the key concerns. No new blocking issues found.

Positive highlights: clean consistent application across all footer paths, backwards-compatible buildAICEntry extension, tests updated with proper env teardown.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 14.8 AIC · ⌖ 4.35 AIC · ⊞ 6.6K
Comment /matt to run again

@github-actions github-actions Bot mentioned this pull request Jul 21, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non-blocking observations

The PR consistently prepends compressedModelName before the AIC value. The logic is correct for the happy path, but three pre-existing review comments (JSDoc return-type gap, GH_AW_ENGINE_MODEL attribution reliability) and one new finding (redundant buildAICEntry call on the non-breakdown path) are worth addressing before merge.

Summary of findings
  • JSDoc return type (messages_footer.cjs ~line 125): compressedModelName is now returned but not declared — callers using // @ts-check`` will see a type error.
  • Attribution correctness (messages_footer.cjs ~line 109): GH_AW_ENGINE_MODEL may hold the logical alias (agent) rather than the resolved model name; the suffix could display misleading identifiers.
  • Same gap in noop path (handle_noop_message.cjs ~line 91): identical attribution concern applies there.
  • Redundant buildAICEntry call (messages_footer.cjs line 173): non-breakdown path builds a second entry with the same args instead of reusing agentEntry, which is a silent divergence risk.

None of these are data-loss or crash-level bugs, but the first two affect output correctness.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 26.2 AIC · ⌖ 4.59 AIC · ⊞ 5.6K
Comment /review to run again

Comments that could not be inline-anchored

actions/setup/js/messages_footer.cjs:173

Redundant buildAICEntry call on the non-breakdown path discards already-computed entry: agentEntry was just built with the same (\&quot;\&quot; , agentAIC, compressedModelName) args; when totalAIC is used as the aiCredits value these two can silently diverge.

<details>
<summary>💡 Suggested fix</summary>

Either reuse agentEntry.suffix directly (valid when aiCredits === agentAIC), or extract the entry into a named variable so it is computed only once:

const aiCreditsEntry = buil…

</details>

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 70/100 — Acceptable

Analyzed 6 test(s): 6 design, 0 implementation, 0 violation(s).

📊 Metrics (6 tests)
Metric Value
Analyzed 6 (Go: 0, JS: 6)
Design 6 (100%)
Implementation 0 (0%)
Edge/error coverage 0 (0%)
Duplicate clusters 0
Inflation No
Violations 0
Test File Classification Issues
AIC + model in failure issue footer handle_agent_failure.test.cjs:297 design_test Happy-path only
AIC + model in noop comment footer handle_noop_message.test.cjs:778 design_test Happy-path only
AI Credits without effective tokens messages.test.cjs:412 design_test Happy-path only
AIC + ambient in default footer messages.test.cjs:1152 design_test Happy-path only
AIC + ambient in failure comment footer messages.test.cjs:1252 design_test Happy-path only
AIC + ambient in failure comment (alt) messages.test.cjs design_test Happy-path only

Verdict

Passed. 0% implementation tests (threshold: 30%).

All 6 modified tests verify user-visible footer output with the new sonnet46 model alias prefix before AIC, matching the production change in messages_footer.cjs. No violations detected. Score is 70/100 due to 0% edge/error coverage — no modified test exercises the case where GH_AW_ENGINE_MODEL is absent or set to an unmapped model name (though those paths may be covered by pre-existing unmodified tests).

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 43.6 AIC · ⌖ 10.6 AIC · ⊞ 6.9K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 70/100. 0% implementation tests (threshold: 30%). All 6 modified tests verify user-visible footer output. No violations detected.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, update the branch, address these unresolved review threads (newest first):

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • pi.dev

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "pi.dev"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · 12.4 AIC · ⌖ 6.12 AIC · ⊞ 5.5K ·
Comment /souschef to run again

…footer display

- Add `compressedModelName: string|undefined` to `getAICFromEnv()` JSDoc return
  type, fixing TS2353/TS2339 errors that broke js-typecheck and impacted-js-tests
- Export `GH_AW_PRIMARY_MODEL` env var from `parse_token_usage.cjs` so the
  actual observed model (from token-usage logs) is available downstream
- Update `messages_footer.cjs` and `handle_noop_message.cjs` to read
  `GH_AW_PRIMARY_MODEL` first, falling back to `GH_AW_ENGINE_MODEL`, so the
  displayed model reflects what actually incurred the AIC rather than the
  configured logical alias (e.g. 'agent')
- Add `GH_AW_PRIMARY_MODEL` to messages.test.cjs beforeEach cleanup
- Add assertions in parse_token_usage.test.cjs for the new export

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot July 21, 2026 09:42
@pelikhan
pelikhan merged commit 5ced33a into main Jul 21, 2026
8 checks passed
@pelikhan
pelikhan deleted the copilot/render-compressed-model-name branch July 21, 2026 10:00
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.0

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.

4 participants