Skip to content

Format effective token values in rendered failure messages#31130

Merged
pelikhan merged 5 commits into
mainfrom
copilot/review-effective-tokens-formatting
May 9, 2026
Merged

Format effective token values in rendered failure messages#31130
pelikhan merged 5 commits into
mainfrom
copilot/review-effective-tokens-formatting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 9, 2026

Bug Fix

Rendered message paths still showed raw effective-token integers in ET budget failure context. This change aligns those displays with footer formatting so token values are compact and human-friendly (e.g., 1000000010M).

  • What was the bug?

    • ET budget exhaustion messaging rendered effectiveTokens / maxEffectiveTokens as raw strings in user-facing text, while footer paths already used compact formatting.
  • How did you fix it?

    • Reused the existing footer formatter (formatET from effective_tokens.cjs) in buildEffectiveTokensRateLimitErrorContext.
    • Formatted both:
      • Effective tokens used
      • Configured ET budget
    • Kept safe fallback behavior: if a value is non-numeric, render it unchanged.
    • Exported the helper for direct unit-level coverage.
  • Example

const parsed = Number.parseInt(value || "", 10);
const display = Number.isInteger(parsed) && parsed > 0 ? formatET(parsed) : value;
// "10000000" -> "10M"
  • Testing

    • Added targeted tests for compact formatting, non-numeric fallback behavior, and omission of optional lines when values are missing.
    • Merged latest main and recompiled generated workflow artifacts (.github/workflows/approach-validator.lock.yml) per follow-up feedback.

Copilot AI and others added 3 commits May 9, 2026 02:40
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Format effective tokens in rendered failure messages Format effective token values in rendered failure messages May 9, 2026
Copilot AI requested a review from pelikhan May 9, 2026 02:48
@pelikhan pelikhan marked this pull request as ready for review May 9, 2026 02:54
Copilot AI review requested due to automatic review settings May 9, 2026 02:54
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

Fixes user-facing ET budget exhaustion messaging by rendering effectiveTokens / maxEffectiveTokens in the same compact, human-friendly format already used in footers (e.g., 1000000010M).

Changes:

  • Reuses formatET to compact-format effective token values in buildEffectiveTokensRateLimitErrorContext.
  • Exports buildEffectiveTokensRateLimitErrorContext for direct unit testing.
  • Adds unit tests for compact formatting, fallback behavior, and omission of optional lines; also updates necromancer.lock.yml.
Show a summary per file
File Description
actions/setup/js/handle_agent_failure.cjs Formats ET values in the rate-limit failure context using formatET and exports the helper.
actions/setup/js/handle_agent_failure.test.cjs Adds targeted unit tests for the ET rate-limit context rendering.
.github/workflows/necromancer.lock.yml Updates generated lock workflow content (includes AWF/container version bumps and related config changes).

Copilot's findings

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment on lines 148 to 152
GH_AW_INFO_ALLOWED_DOMAINS: '["defaults","github","node","go"]'
GH_AW_INFO_FIREWALL_ENABLED: "true"
GH_AW_INFO_AWF_VERSION: "v0.25.41"
GH_AW_INFO_AWF_VERSION: "v0.25.42"
GH_AW_INFO_AWMG_VERSION: ""
GH_AW_INFO_FIREWALL_TYPE: "squid"
Comment on lines +855 to +860
const formatEffectiveTokensForMessage = value => {
const parsed = Number.parseInt(value || "", 10);
if (Number.isInteger(parsed) && parsed > 0) {
return formatET(parsed);
}
return value;
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 9, 2026

@copilot Merge main and recompile

Copilot AI and others added 2 commits May 9, 2026 03:20
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 9, 2026

@copilot Merge main and recompile

Done. I merged main (b5403eb) and recompiled the workflows (ab892ca).

@pelikhan pelikhan merged commit 0a2fd45 into main May 9, 2026
@pelikhan pelikhan deleted the copilot/review-effective-tokens-formatting branch May 9, 2026 03:29
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