From 1aed4d3575d966e0904da6e93cfe3834fc9aaed2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Apr 2026 18:38:34 +0000 Subject: [PATCH 1/3] fix: add effective token count to noop and detection comment footers 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> --- .github/workflows/agentics-maintenance.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/agentics-maintenance.yml b/.github/workflows/agentics-maintenance.yml index 8c142f3ab1a..6eb35db87c3 100644 --- a/.github/workflows/agentics-maintenance.yml +++ b/.github/workflows/agentics-maintenance.yml @@ -281,7 +281,7 @@ jobs: 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: contents: read issues: write From 00f38b9c8cd07777ddfd12aca94b8bf514eee1e6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Apr 2026 18:49:29 +0000 Subject: [PATCH 2/3] fix: include effective token count in noop and detection comment footers 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> --- actions/setup/js/handle_detection_runs.cjs | 8 +++ actions/setup/js/handle_noop_message.cjs | 8 +++ actions/setup/js/handle_noop_message.test.cjs | 61 ++++++++++++++++++- actions/setup/md/detection_runs_comment.md | 2 +- actions/setup/md/noop_comment.md | 2 +- 5 files changed, 78 insertions(+), 3 deletions(-) diff --git a/actions/setup/js/handle_detection_runs.cjs b/actions/setup/js/handle_detection_runs.cjs index e0a595b0c0d..81f3da59fb7 100644 --- a/actions/setup/js/handle_detection_runs.cjs +++ b/actions/setup/js/handle_detection_runs.cjs @@ -7,6 +7,7 @@ const { ERR_API } = require("./error_codes.cjs"); const { sanitizeContent } = require("./sanitize_content.cjs"); const { generateFooterWithExpiration } = require("./ephemerals.cjs"); const { renderTemplateFromFile } = require("./messages_core.cjs"); +const { formatET } = require("./effective_tokens.cjs"); /** * Search for or create the parent issue for all agentic workflow detection runs. @@ -107,11 +108,18 @@ async function main() { // Load and render comment template from file const commentTemplatePath = `${process.env.RUNNER_TEMP}/gh-aw/prompts/detection_runs_comment.md`; + + // Compute effective tokens suffix from environment variable (set by parse_token_usage.cjs / parse_mcp_gateway_log.cjs) + const rawET = process.env.GH_AW_EFFECTIVE_TOKENS; + const parsedET = rawET ? parseInt(rawET, 10) : NaN; + const effectiveTokensSuffix = !isNaN(parsedET) && parsedET > 0 ? ` · ● ${formatET(parsedET)}` : ""; + const commentBody = renderTemplateFromFile(commentTemplatePath, { workflow_name: workflowName, conclusion: detectionConclusion, reason: detectionReason || "unknown", run_url: runUrl, + effective_tokens_suffix: effectiveTokensSuffix, }); // Sanitize the full comment body diff --git a/actions/setup/js/handle_noop_message.cjs b/actions/setup/js/handle_noop_message.cjs index 0a3b8a8db8a..c27d0f9a9a7 100644 --- a/actions/setup/js/handle_noop_message.cjs +++ b/actions/setup/js/handle_noop_message.cjs @@ -9,6 +9,7 @@ const { generateFooterWithExpiration } = require("./ephemerals.cjs"); const { renderTemplateFromFile } = require("./messages_core.cjs"); const { loadAgentOutput } = require("./load_agent_output.cjs"); const { isStagedMode } = require("./safe_output_helpers.cjs"); +const { formatET } = require("./effective_tokens.cjs"); /** * Search for or create the parent issue for all agentic workflow no-op runs @@ -184,10 +185,17 @@ async function main() { // Load and render comment template from file const commentTemplatePath = `${process.env.RUNNER_TEMP}/gh-aw/prompts/noop_comment.md`; + + // Compute effective tokens suffix from environment variable (set by parse_token_usage.cjs / parse_mcp_gateway_log.cjs) + const rawET = process.env.GH_AW_EFFECTIVE_TOKENS; + const parsedET = rawET ? parseInt(rawET, 10) : NaN; + const effectiveTokensSuffix = !isNaN(parsedET) && parsedET > 0 ? ` · ● ${formatET(parsedET)}` : ""; + const commentBody = renderTemplateFromFile(commentTemplatePath, { workflow_name: workflowName, message: noopMessage, run_url: runUrl, + effective_tokens_suffix: effectiveTokensSuffix, }); // Sanitize the full comment body diff --git a/actions/setup/js/handle_noop_message.test.cjs b/actions/setup/js/handle_noop_message.test.cjs index b52ae831124..67790ca2aec 100644 --- a/actions/setup/js/handle_noop_message.test.cjs +++ b/actions/setup/js/handle_noop_message.test.cjs @@ -76,7 +76,7 @@ This issue helps you: {message} -> Generated from [{workflow_name}]({run_url})`; +> Generated from [{workflow_name}]({run_url}){effective_tokens_suffix}`; } return originalReadFileSync.call(fs, filePath, encoding); }); @@ -669,4 +669,63 @@ This issue helps you: // Verify XSS attempt was sanitized (specific behavior depends on sanitizeContent implementation) expect(commentCall.body).not.toContain("