Repository navigation
fix: include effective tokens count in PR comment generated footer - #32215
Merged
Merged
Conversation
…ffectiveTokens not in context Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
May 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes missing effective-token counts (· ● …) in generated footer messages by making getFooterMessage independently resolve the effective token count from GH_AW_EFFECTIVE_TOKENS when callers don’t provide ctx.effectiveTokens.
Changes:
- Update
getFooterMessageto fall back togetEffectiveTokensFromEnv()whenctx.effectiveTokensis absent (with context still taking precedence). - Ensure the computed
effective_tokens_suffixis available to custom footer templates even when tokens only come from env. - Add test coverage for env fallback behavior, ordering relative to the history link, and precedence rules.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/messages_footer.cjs | Adds env-var fallback for effectiveTokens in getFooterMessage and threads the computed value into template context + default footer rendering. |
| actions/setup/js/messages.test.cjs | Adds test cases validating env fallback, correct placement, omission when unset, precedence over env, and template placeholder behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
getFooterMessagerelied on callers passingctx.effectiveTokens, but callers likeupdate_activation_comment.cjsomit it — so the· ● NMtoken count was never shown in those footers. Every sibling function (getFooterWorkflowRecompileMessage,getFooterAgentFailureIssueMessage, etc.) already callsgetEffectiveTokensFromEnv()internally;getFooterMessagewas the odd one out.Changes
messages_footer.cjs—getFooterMessagenow callsgetEffectiveTokensFromEnv()and uses it as a fallback whenctx.effectiveTokensis absent. Callers that already supplyctx.effectiveTokens(e.g.generateFooterWithMessages) are unaffected — context value takes precedence via??.messages.test.cjs— six new cases covering: env-var fallback, ordering before history link, no-tokens when env unset, context precedence over env, and{effective_tokens_suffix}placeholder in custom templates via env.