Implement the following plan: Fix: E2E Triage Output Not Showing in GitHub Actions Job…
- User
Implement the following plan:
Fix: E2E Triage Output Not Showing in GitHub Actions Job Summary
Context
The triage workflow runs successfully and produces good output (visible in the "Run triage" step logs and in the uploaded artifact). But the "Summarize triage output" step writes to
GITHUB_STEP_SUMMARYand nothing renders in the GitHub Actions UI summary tab.Root cause:
claude -poutputs text with ANSI escape codes and terminal control sequences (cursor movements, color codes like[36;1m,[?2026h). Whenteewrites this to the triage log file, the raw bytes go into$GITHUB_STEP_SUMMARY, which expects clean markdown. GitHub silently drops or corrupts the summary when it contains control characters.Fix
1. Strip ANSI/control codes from the triage log before writing to summary
File:
.github/workflows/e2e-triage.yml(Summarize triage output step)In the summary step, strip ANSI escape codes when writing to
GITHUB_STEP_SUMMARY:bash# Strip ANSI escape codes and control characters before writing to summary sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\x1b\[[?][0-9]*[a-zA-Z]//g' "$TRIAGE_OUTPUT_FILE" >> "$GITHUB_STEP_SUMMARY"2. Use
--output-format textin claude invocationFile:
scripts/run-e2e-triage.shAdd
--output-format textto theclaudecommand to get cleaner output without tool-use formatting:bashclaude \ --plugin-dir .claude/plugins/e2e \ --output-format text \ --allowedTools "Read" "Grep" "Glob" \ -p "$triage_args" \ 2>&1 | tee "$TRIAGE_OUTPUT_FILE"3. Also strip in the tee pipeline as belt-and-suspenders
File:
scripts/run-e2e-triage.shPipe through
sedto strip ANSI beforeteeso the file itself is clean:bashclaude ... -p "$triage_args" 2>&1 \ | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\x1b\[[?][0-9]*[a-zA-Z]//g' \ | tee "$TRIAGE_OUTPUT_FILE" Assistant
★ Insight ─────────────────────────────────────ANSI escape codes (like\x1b[36;1mfor cyan bold) are emitted by CLI tools that detect a TTY. When piped throughteeto a file, these raw bytes persist. GitHub Actions'GITHUB_STEP_SUMMARYexpects clean markdown — control characters cause silent rendering failures. The fix uses two layers:--output-format textreduces noise at the source, andsedstripping provides defense-in-depth.─────────────────────────────────────────────────Let me read the two files to modify.
Assistant
Now I'll apply both changes.
Assistant
The hook flagged a security reminder for the workflow edit — this change is safe since we're only replacing
catwithsedon a local file path (no untrusted input in therun:command). Let me retry the edit.Assistant
Also need to strip ANSI from the summary extraction (
grepline) since it parses the same file:Assistant
Good — the workflow file looks correct. Now let me verify the script file too:
Assistant
Both files look good. Let me verify there are no syntax issues with the sed patterns by doing a quick test:
Assistant
Both changes are applied and the sed patterns work correctly.
★ Insight ─────────────────────────────────────Why two layers of stripping?--output-format texttells the Claude CLI to skip tool-use JSON formatting and reduce decorative output, but it doesn't guarantee zero escape codes — the underlying terminal detection may still emit some. Thesedpipeline is the actual guarantee. Having it in both the script (clean file on disk) and the workflow (clean summary) follows defense-in-depth: if either layer fails or is bypassed, the other catches it.The sed pattern explained:
\x1b\[[0-9;]*[a-zA-Z]matches standard CSI sequences (colors, bold, etc.) and\x1b\[[?][0-9]*[a-zA-Z]matches private-mode sequences (like?2026hfor synchronized output). Together they cover the escape codes that Claude CLI and terminal emulators produce.─────────────────────────────────────────────────Summary of changes:
-
scripts/run-e2e-triage.sh— Added--output-format textto get cleaner Claude output, and piped through to strip any remaining ANSI escape codes before writing to the log file.
-