From 34edb5c8516c17cf56131164bbe93d74d2b1b181 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 19 Jul 2026 08:51:24 +0000 Subject: [PATCH 1/2] fix(copilot-parser): strip 'Resume' CLI footer hint from rendered reasoning The Copilot CLI pretty-print footer emits a columnar "Resume copilot --resume=" hint alongside Changes/Duration/Tokens. Only the latter three were matched by USAGE_LINES_RE, so the Resume line fell through to agentTextLines and leaked into the rendered "Reasoning" section as if it were agent output. Extend USAGE_LINES_RE to also skip the columnar Resume hint (matched via 2+ aligned spaces to avoid false-positives on natural prose) and add a regression test mirroring a real run's footer. Found by the daily rendering-scripts verifier against Copilot run 29679546543. Co-Authored-By: Claude Opus 4.8 (1M context) --- actions/setup/js/parse_copilot_log.cjs | 10 ++++++---- actions/setup/js/parse_copilot_log.test.cjs | 22 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/actions/setup/js/parse_copilot_log.cjs b/actions/setup/js/parse_copilot_log.cjs index d6c950e71ac..c06c8132b94 100644 --- a/actions/setup/js/parse_copilot_log.cjs +++ b/actions/setup/js/parse_copilot_log.cjs @@ -229,10 +229,12 @@ function parsePrettyPrintFormat(logContent) { const MODEL_BREAKDOWN_RE = /^Breakdown by AI model:/; const MODEL_LINE_RE = /^ +(\S+)\s+([\d.]+k?)\s+in,\s+([\d.]+k?)\s+out(?:,\s+([\d.]+k?)\s+cached)?/; // Recognise both legacy ("Total usage est:" / "API time spent:" / …) and the - // newer Copilot CLI footer ("Changes +N -N", "Duration Ns", "Tokens ↑N ↓N (cached)"). - // The newer footer omits a colon and uses arrow glyphs, so we extend the regex rather than - // relying on the legacy "Total …:" prefix alone. - const USAGE_LINES_RE = /^(?:Total usage est:|API time spent:|Total session time:|Total code changes:|Changes\s+[+-]?\d|Duration\s+\d|Tokens\s+[↑↓])/; + // newer Copilot CLI footer ("Changes +N -N", "Duration Ns", "Tokens ↑N ↓N (cached)", + // "Resume copilot --resume=…"). The newer footer omits a colon and uses arrow glyphs, so we + // extend the regex rather than relying on the legacy "Total …:" prefix alone. The "Resume" + // hint is columnar CLI chrome (aligned with 2+ spaces); skip it so it does not leak into the + // rendered agent reasoning section. + const USAGE_LINES_RE = /^(?:Total usage est:|API time spent:|Total session time:|Total code changes:|Changes\s+[+-]?\d|Duration\s+\d|Tokens\s+[↑↓]|Resume\s{2,}\S)/; const parseTokenCount = s => { const n = parseFloat(s); diff --git a/actions/setup/js/parse_copilot_log.test.cjs b/actions/setup/js/parse_copilot_log.test.cjs index e03da170ce8..7e3dadc86fc 100644 --- a/actions/setup/js/parse_copilot_log.test.cjs +++ b/actions/setup/js/parse_copilot_log.test.cjs @@ -392,6 +392,28 @@ describe("parse_copilot_log.cjs", () => { expect(result.markdown).toContain("375,000"); }); + it("strips the columnar 'Resume' footer hint from rendered pretty-print output", () => { + // Copilot CLI footer includes a "Resume copilot --resume=" line aligned in the + // same column block as Changes/Duration/Tokens. It is CLI chrome, not agent reasoning, + // and must not leak into the rendered reasoning/agent-text section. + const prettyLog = [ + "● Bash", + " └ ok", + "The work is done.", + "", + "Changes +0 -0", + "Duration 1m 0s", + "Tokens ↑ 195.4k (166.2k cached) • ↓ 2.9k", + "Resume copilot --resume=d21d3356-9296-4d1b-a392-49e5069e4e3f", + ].join("\n"); + + const result = parseCopilotLog(prettyLog); + + expect(result.markdown).toContain("The work is done."); + expect(result.markdown).not.toContain("--resume="); + expect(result.markdown).not.toMatch(/^Resume\s+copilot/m); + }); + it("handles the new footer without a cached segment", () => { const prettyLog = ["● Bash", " └ ok", "", "Tokens ↑ 1.2k • ↓ 50"].join("\n"); From 8af2452723390ca391f3b5a87c0c71f553295a2f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 19 Jul 2026 09:59:39 +0000 Subject: [PATCH 2/2] fix(copilot-parser): narrow Resume footer regex to exact CLI command syntax Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/parse_copilot_log.cjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/actions/setup/js/parse_copilot_log.cjs b/actions/setup/js/parse_copilot_log.cjs index c06c8132b94..7289e2e6718 100644 --- a/actions/setup/js/parse_copilot_log.cjs +++ b/actions/setup/js/parse_copilot_log.cjs @@ -232,9 +232,9 @@ function parsePrettyPrintFormat(logContent) { // newer Copilot CLI footer ("Changes +N -N", "Duration Ns", "Tokens ↑N ↓N (cached)", // "Resume copilot --resume=…"). The newer footer omits a colon and uses arrow glyphs, so we // extend the regex rather than relying on the legacy "Total …:" prefix alone. The "Resume" - // hint is columnar CLI chrome (aligned with 2+ spaces); skip it so it does not leak into the - // rendered agent reasoning section. - const USAGE_LINES_RE = /^(?:Total usage est:|API time spent:|Total session time:|Total code changes:|Changes\s+[+-]?\d|Duration\s+\d|Tokens\s+[↑↓]|Resume\s{2,}\S)/; + // hint is matched against the exact CLI command syntax to avoid false-positives on prose + // that happens to start with "Resume ". + const USAGE_LINES_RE = /^(?:Total usage est:|API time spent:|Total session time:|Total code changes:|Changes\s+[+-]?\d|Duration\s+\d|Tokens\s+[↑↓]|Resume\s{2,}copilot\s+--resume=)/; const parseTokenCount = s => { const n = parseFloat(s);