8000
Skip to content

[q] fix: show effective tokens (ET) in discussion footer#24320

Merged
pelikhan merged 1 commit intomainfrom
fix/discussion-footer-effective-tokens-ba0799d8b27fde43
Apr 3, 2026
Merged

[q] fix: show effective tokens (ET) in discussion footer#24320
pelikhan merged 1 commit intomainfrom
fix/discussion-footer-effective-tokens-ba0799d8b27fde43

Conversation

@github-actions
Copy link
Copy Markdown
Contributor
@github-actions github-actions bot commented Apr 3, 2026

Root Cause

create_discussion.cjs was building the footer with a hardcoded string:

const footerText = historyLink
  ? `> AI generated by [${workflowName}](${runUrl}) · ${historyLink}`
  : `> AI generated by [${workflowName}](${runUrl})`;

This bypassed generateFooterWithMessages(), which is the shared helper that reads GH_AW_EFFECTIVE_TOKENS from the environment and appends the ET value (e.g. ● 3.6M) to the footer.

Both create_issue.cjs and add_comment.cjs already use generateFooterWithMessages() correctly, so this was an inconsistency in create_discussion.cjs.

Investigation

Audited run #23947396770 (Documentation Noob Tester) which produced discussion #24309. The run consumed 3.56M effective tokens but the footer showed no ET:

AI generated by Documentation Noob Tester · history

Fix

Switch create_discussion.cjs to use the same pattern as create_issue.cjs:

  • Use generateFooterWithMessages() for the footer body (reads ET from GH_AW_EFFECTIVE_TOKENS)
  • Use addExpirationToFooter() to inject the expiration line
  • Use generateHistoryUrl() (raw URL) instead of generateHistoryLink() (markdown link)
  • Extract triggering context (triggeringIssueNumber, triggeringPRNumber, triggeringDiscussionNumber) and workflow source from env/context

After the fix, discussion footers will show:

Generated by Documentation Noob Tester · ● 3.6M ·

Validation

  • make fmt-cjs
  • make lint-cjs
  • All create_discussion*.test.cjs tests pass ✅ (44 + 10 + 5 + 9 tests)

🎩 Equipped by Q · ● 3.8M ·

  • expires on Apr 5, 2026, 2:02 PM UTC

create_discussion.cjs was building the footer with a hardcoded string
instead of using generateFooterWithMessages(), which reads
GH_AW_EFFECTIVE_TOKENS and appends the ET value (e.g. '● 3.6M').

Switch to the same pattern used by create_issue.cjs and add_comment.cjs:
- Use generateFooterWithMessages() for the footer body
- Use addExpirationToFooter() to inject the expiration line
- Use generateHistoryUrl() (raw URL) instead of generateHistoryLink()
- Extract triggering context and workflow source from env/context

This ensures discussions show ET in their footer alongside the
workflow run link and history link.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan merged commit 31fd584 into main Apr 3, 2026
@pelikhan pelikhan deleted the fix/discussion-footer-effective-tokens-ba0799d8b27fde43 branch April 3, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0