Render /list-claude-pr-status output as a markdown table#1437
Conversation
The command previously left table rendering to the assistant. Move formatting into the script itself so output is a complete, ready-to-show markdown table with clickable PR links, READY rows first then RUNNING. Add an explicit fallback message for the empty-result case. Verified locally against current open claude/* PRs and against an empty TSV before opening the PR. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
LGTM — small, self-contained renderer change in a developer slash command.
Extended reasoning...
Overview
This PR rewrites Step 3 of .claude/commands/list-claude-pr-status.md so the slash command emits a complete markdown table directly from a bash/awk pipeline rather than delegating rendering to the assistant. It also adds an empty-input fallback message. Only one file changed.
Security risks
None. This is a documentation-style slash command file consumed by the Claude Code harness. No production code, no auth/crypto/permissions surface, no external inputs that affect runtime behavior outside the user's local shell.
Level of scrutiny
Low. The file is a developer-facing slash command used informationally (the command explicitly does not auto-merge). The renderer is a few lines of awk that read a TSV produced earlier in the same command. Logic is straightforward — sort by state group, prepend header, format each row as a table row.
Other factors
One nit was flagged: PR titles containing a literal | will corrupt the rendered table because $4 is interpolated without escaping. It is cosmetic only, and an easy follow-up fix. Not worth blocking on for an informational tool.
| {printf "| [#%s](https://github.com/SemiAnalysisAI/InferenceX/pull/%s) | %s | `%s` | %s |\n", $1, $1, $2, $3, $4}' | ||
| ``` |
There was a problem hiding this comment.
🟡 PR titles containing a literal | will corrupt the rendered markdown table. The awk printf at line 64 interpolates the title field ($4) directly into a table cell with no escaping, so a title like Fix foo | refactor bar produces a row with extra column boundaries and a misaligned table. Easy fix: gsub(/\|/, "\\|", $4) inside the awk action before printing.
Extended reasoning...
What the bug is
In Step 3 (lines 55-66), the renderer pipes the TSV through awk and emits each data row with:
printf "| [#%s](https://github.com/SemiAnalysisAI/InferenceX/pull/%s) | %s | `%s` | %s |\n", $1, $1, $2, $3, $4The title column ($4) is interpolated verbatim. GitHub PR titles are free-form user input coming from gh pr list --json title and can legitimately contain a literal | (e.g. frontend | use new API, Fix foo | refactor bar).
How it manifests
For a PR titled Fix foo | refactor bar, the emitted row is:
| [#123](https://github.com/SemiAnalysisAI/InferenceX/pull/123) | READY | `SUCCESS=44` | Fix foo | refactor bar |
Markdown parses pipes as column separators, so that row becomes 6 cells in a 4-column table and the row is misaligned in the rendered output.
Why existing code doesn't prevent it
The previous Step 3 was prose that delegated rendering to the assistant, which could escape pipes when constructing the table. This PR moves rendering into a deterministic bash/awk pipeline that emits raw field values. The check-breakdown column ($3) is wrapped in backticks which incidentally tolerates pipes inside it, but the title column has no such protection.
Step-by-step proof
- Author opens a PR on a
claude/...branch with titleFix foo | refactor bar. - Step 1 stores
123\tFix foo | refactor barinto/tmp/claude_pr_candidates.tsv. - Step 2 classifies it as READY and appends
123\tREADY\tSUCCESS=44\tFix foo | refactor barto/tmp/claude_pr_status.tsv. - Step 3's awk reads that line with
-F'\t', so$4 = "Fix foo | refactor bar". - The
printfemits| [#123](...) | READY |SUCCESS=44| Fix foo | refactor bar |. - The markdown renderer sees 6
|-delimited segments and produces a misaligned 6-cell row under a 4-column header.
Impact
Cosmetic / display-only. The link and information are still present and readable in raw form, and this is an informational developer slash command. Pipes in PR titles are uncommon — but not impossible — for Claude-authored PRs.
How to fix
Escape pipes in the title before printing, e.g.:
{ gsub(/\|/, "\\|", $4);
printf "| [#%s](https://github.com/SemiAnalysisAI/InferenceX/pull/%s) | %s | `%s` | %s |\n", $1, $1, $2, $3, $4 }
Summary
Test plan
/tmp/claude_pr_status.tsv(RUNNING row for Update qwen3.5-bf16-b300-sglang and -mtp SGLang image to v0.5.12-cu130 #1422).🤖 Generated with Claude Code