Skip to content

Include effective token count in agent failure issue/comment footer#24196

Merged
pelikhan merged 1 commit intomainfrom
copilot/review-agent-failure-footer
Apr 3, 2026
Merged

Include effective token count in agent failure issue/comment footer#24196
pelikhan merged 1 commit intomainfrom
copilot/review-agent-failure-footer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

getFooterAgentFailureIssueMessage and getFooterAgentFailureCommentMessage already read GH_AW_EFFECTIVE_TOKENS and populated it into the template context for custom templates, but neither default footer rendered it. The regular getFooterMessage default footer does include it — this brings the agent failure footers into parity.

Changes

  • messages_footer.cjs: Both getFooterAgentFailureIssueMessage and getFooterAgentFailureCommentMessage now append {effective_tokens_suffix} (e.g., · ● 12.5K) in their default footer when GH_AW_EFFECTIVE_TOKENS is set, inserted before the history link

  • messages.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:

> Generated from [My Workflow](https://github.com/.../agentic_workflow)

After (when effective tokens available):

> Generated from [My Workflow](https://github.com/.../agentic_workflow) · ● 12.5K

@pelikhan pelikhan marked this pull request as ready for review April 3, 2026 00:44
Copilot AI review requested due to automatic review settings April 3, 2026 00:44
@pelikhan pelikhan merged commit 78f2a16 into main Apr 3, 2026
50 checks passed
@pelikhan pelikhan deleted the copilot/review-agent-failure-footer branch April 3, 2026 00:44
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 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_TOKENS is 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.

Comment on lines +680 to +684
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({
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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