fix: include effective token count in noop and detection comment footers#25941
fix: include effective token count in noop and detection comment footers#25941
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b494317c-7e3b-42c6-ac61-f8b598231d31 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b494317c-7e3b-42c6-ac61-f8b598231d31 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…to avoid duplication Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b494317c-7e3b-42c6-ac61-f8b598231d31 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates noop and detection-run issue comment footers to include the effective token count suffix (· ● N) when available, matching other safe-output footers.
Changes:
- Append
{effective_tokens_suffix}to the footer line in noop and detection comment templates. - Add
getEffectiveTokensSuffix()helper and passeffective_tokens_suffixinto template rendering for noop/detection handlers. - Extend noop handler tests to cover presence/absence of
GH_AW_EFFECTIVE_TOKENS(plus an unrelated workflow runner change).
Show a summary per file
| File | Description |
|---|---|
| actions/setup/md/noop_comment.md | Appends {effective_tokens_suffix} to the generated footer. |
| actions/setup/md/detection_runs_comment.md | Appends {effective_tokens_suffix} to the generated footer. |
| actions/setup/js/effective_tokens.cjs | Adds getEffectiveTokensSuffix() for env-driven footer suffix formatting. |
| actions/setup/js/handle_noop_message.cjs | Computes/passes effective_tokens_suffix into noop comment template context. |
| actions/setup/js/handle_detection_runs.cjs | Computes/passes effective_tokens_suffix into detection comment template context. |
| actions/setup/js/handle_noop_message.test.cjs | Adds tests for footer suffix inclusion/omission. |
| .github/workflows/agentics-maintenance.yml | Changes validate_workflows runner from ubuntu-slim to ubuntu-latest. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 7/7 changed files
- Comments generated: 2
| function getEffectiveTokensSuffix() { | ||
| const raw = process.env.GH_AW_EFFECTIVE_TOKENS; | ||
| const parsed = raw ? parseInt(raw, 10) : NaN; | ||
| if (!isNaN(parsed) && parsed > 0) { | ||
| return ` · ● ${formatET(parsed)}`; | ||
| } | ||
| return ""; |
There was a problem hiding this comment.
getEffectiveTokensSuffix() duplicates the env-parsing/suffix-formatting logic that already exists in actions/setup/js/messages_footer.cjs (getEffectiveTokensFromEnv() returns effectiveTokensSuffix). To avoid two implementations drifting (e.g., formatting or validation changes), consider extracting a single shared helper (or exporting/reusing getEffectiveTokensFromEnv/suffix logic) and using it from both places.
| validate_workflows: | ||
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.operation == 'validate' && !github.event.repository.fork }} | ||
| runs-on: ubuntu-slim | ||
| runs-on: ubuntu-latest | ||
| permissions: |
There was a problem hiding this comment.
This workflow job changes runs-on from ubuntu-slim to ubuntu-latest, but the PR description is focused on comment footers/effective token suffixes and doesn't mention a runner change. If this is intentional (e.g., ubuntu-slim is deprecated/unsupported for this job), please document the rationale in the PR description; otherwise consider reverting to keep runner usage consistent with the rest of the workflow.
🧪 Test Quality Sentinel ReportTest Quality Score: 75/100
Test Classification Details
Flagged Tests — Requires Review
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 75/100. Test quality is acceptable — 0% of new tests are implementation tests (threshold: 30%). Both tests verify observable behavioral contracts on the comment body output. Minor suggestion: add an edge-case for invalid GH_AW_EFFECTIVE_TOKENS values.
The
> Generated from [Workflow](url)footer in noop and detection run issue comments was missing the effective token count (● N) that other safe-output footers include.Before:
> Generated from [Workflow](url)After:
> Generated from [Workflow](url) · ● 12.5KChanges
actions/setup/md/noop_comment.md,detection_runs_comment.md): Append{effective_tokens_suffix}to footer lineactions/setup/js/effective_tokens.cjs): NewgetEffectiveTokensSuffix()readsGH_AW_EFFECTIVE_TOKENSenv var and returns formatted suffix or""handle_noop_message.cjs,handle_detection_runs.cjs): Import helper, pass suffix to template contexthandle_noop_message.test.cjs): Two new cases covering presence and absence of effective tokens