Include effective token count in agent failure issue/comment footer#24196
Include effective token count in agent failure issue/comment footer#24196
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ce790b60-0ef3-4dcc-b31a-13a21079fc23 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the default agent-failure footers to display the effective token count (when GH_AW_EFFECTIVE_TOKENS is set), bringing getFooterAgentFailureIssueMessage and getFooterAgentFailureCommentMessage into parity with the regular footer behavior.
Changes:
- Append
{effective_tokens_suffix}to the default agent-failure issue/footer templates when effective tokens are available. - Add/extend unit tests covering default vs custom templates and ordering with the history link.
- Ensure
GH_AW_EFFECTIVE_TOKENSis cleared between tests to avoid cross-test contamination.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| actions/setup/js/messages_footer.cjs | Adds effective-token suffix insertion to the default agent-failure issue/comment footer rendering. |
| actions/setup/js/messages.test.cjs | Adds new tests for agent-failure footers and resets GH_AW_EFFECTIVE_TOKENS between tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| describe("getFooterAgentFailureIssueMessage", () => { | ||
| it("should return default footer without effective tokens when env var is not set", async () => { | ||
| const { getFooterAgentFailureIssueMessage } = await import("./messages.cjs"); | ||
|
|
||
| const result = getCloseOlderDiscussionMessage({ | ||
| newDiscussionUrl: "https://github.com/test/repo/discussions/10", | ||
| newDiscussionNumber: 10, | ||
| const result = getFooterAgentFailureIssueMessage({ |
There was a problem hiding this comment.
The existing tests for getCloseOlderDiscussionMessage appear to have been removed from this suite (the previous describe("getCloseOlderDiscussionMessage") block is no longer present, and there are no remaining references to getCloseOlderDiscussionMessage in this file). Please restore equivalent coverage here or add a dedicated test file for messages_close_discussion.cjs so the message formatting and custom-template behavior remain covered.
getFooterAgentFailureIssueMessageandgetFooterAgentFailureCommentMessagealready readGH_AW_EFFECTIVE_TOKENSand populated it into the template context for custom templates, but neither default footer rendered it. The regulargetFooterMessagedefault footer does include it — this brings the agent failure footers into parity.Changes
messages_footer.cjs: BothgetFooterAgentFailureIssueMessageandgetFooterAgentFailureCommentMessagenow append{effective_tokens_suffix}(e.g.,· ● 12.5K) in their default footer whenGH_AW_EFFECTIVE_TOKENSis set, inserted before the history linkmessages.test.cjs: Added tests for both functions covering: no ET env var, ET present, ET + history URL ordering, custom template suppressing ET, and custom template opting-in via{effective_tokens_suffix}Before:
After (when effective tokens available):