Repository navigation
Fix PR reviewer safe-output payload quoting guidance - #70913
Conversation
Encode apostrophes as JSON Unicode escapes before single-quoting safe-output payloads, preserving review text and existing tool permissions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ Ponytail Reviewer completed successfully!
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
There was a problem hiding this comment.
One prompt-level simplification opportunity: retain the concrete apostrophe rule while deleting duplicated quoting guidance.
net: -70 lines possible.
Generated by ✂️ Ponytail Reviewer for #70913 · codex · gpt56 · 6.4 AIC · ⌖ 5.45 AIC · ⊞ 14.8K
Comment /ponytail to run again
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Verdict
One non-blocking robustness issue found: the new guidance should spell out control-character escape forms to avoid another malformed JSON publication. The prompt-only approach is otherwise within the stated scope.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · 1.6 AIC · ⌖ 0.549 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
Skills-Based Review ᾞ0
Applied /diagnosing-bugs — one actionable suggestion, no blocking issues.
📋 Key Themes & Highlights
Key Themes
- Missing regression test: The fix adds a single prompt-guidance paragraph to prevent a real, documented production failure (apostrophe breaking shell single-quoting in safe-output JSON payloads), but there is no test pinning the new guidance text. The same file already has an established pattern for this (
pkg/cli/pr_code_quality_reviewer_workflow_contract_test.go), so extending it is low-cost and closes the loop against silent regression if the guidance is edited or dropped later.
Positive Highlights
- ✅ Root cause is clearly identified and tied to a specific failed run with evidence, not speculation.
- ✅ Scope is tight: prompt-only change plus mechanical hash regeneration in the lock file — no permission or tool-surface expansion.
- ✅ The PR description documents thorough validation (round-trip payload cases, security review, full recompile, drift check) which is exactly the rigor this kind of prompt-engineering fix needs.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 55.9 AIC · ⌖ 13.9 AIC · ⊞ 10.2K
Comment /matt to run again
|
|
||
| Keep publication commands stdout-only: construct JSON inline with `printf '%s'` and pipe it directly to `safeoutputs`. Do not write temporary payload files, use shell redirection or heredocs, or invoke `jq`, `python`, or `node`; they are not authorized by this workflow. JSON-escape content and shell-quote it correctly without shell expansion. Send each safe-output command separately from analysis commands. Invoke the documented pipeline directly; do not prepend availability probes or other commands. | ||
|
|
||
| For every publication payload, JSON-escape double quotes, backslashes, and control characters, then encode every literal apostrophe in JSON string values as `\u0027` before enclosing the JSON in shell single quotes. For example, the body `The caller's input` must appear as `"body":"The caller\u0027s input"` inside the single-quoted payload. Never put a literal apostrophe inside that shell-quoted JSON or switch to shell double quotes: review text containing backticks, `$()`, or redirection characters must remain inert data. If a publication command is denied, check its JSON and shell quoting before the single corrected attempt described below; do not widen permissions. |
There was a problem hiding this comment.
[/diagnosing-bugs] This fix addresses an observed production failure (apostrophe breaking shell single-quoting) but ships with no regression test, even though pkg/cli/pr_code_quality_reviewer_workflow_contract_test.go already pins other publication-guidance strings from this exact file verbatim.
Ὂ1 Suggested test addition
Without a pinned assertion, a future edit to this file could silently drop the \u0027 escaping guidance and no test would catch the regression — defeating the purpose of this PR. Extend TestPRCodeQualityReviewerWorkflowPublicationContract (or add a new test) with something like:
assert.Contains(t, text, "encode every literal apostrophe in JSON string values as `(u0027/redacted)`")
assert.Contains(t, text, "Never put a literal apostrophe inside that shell-quoted JSON")This mirrors the existing convention in the same file (e.g. the without widening permissions and safeoutputs report_incomplete . assertions) and keeps the fix enforceable going forward.
@copilot please address this.
There was a problem hiding this comment.
🟢 Approval recommended
The focused quoting guidance preserves existing controls, with no blocking issues identified.
1 open issue
What changed in this PR
Clarifies JSON quoting in the PR reviewer workflow to prevent malformed safe-output publication commands.
Changes:
- Adds apostrophe encoding and safe shell-quoting guidance without changing permissions or review behavior.
- Refreshes generated workflow body and admission hashes.
| File | Description |
|---|---|
.github/workflows/pr-code-quality-reviewer.md |
Adds payload escaping guidance and an example. |
.github/workflows/pr-code-quality-reviewer.lock.yml |
Updates generated body and admission hashes. |
Review effort: Max
|
|
||
| Keep publication commands stdout-only: construct JSON inline with `printf '%s'` and pipe it directly to `safeoutputs`. Do not write temporary payload files, use shell redirection or heredocs, or invoke `jq`, `python`, or `node`; they are not authorized by this workflow. JSON-escape content and shell-quote it correctly without shell expansion. Send each safe-output command separately from analysis commands. Invoke the documented pipeline directly; do not prepend availability probes or other commands. | ||
|
|
||
| For every publication payload, JSON-escape double quotes, backslashes, and control characters, then encode every literal apostrophe in JSON string values as `\u0027` before enclosing the JSON in shell single quotes. For example, the body `The caller's input` must appear as `"body":"The caller\u0027s input"` inside the single-quoted payload. Never put a literal apostrophe inside that shell-quoted JSON or switch to shell double quotes: review text containing backticks, `$()`, or redirection characters must remain inert data. If a publication command is denied, check its JSON and shell quoting before the single corrected attempt described below; do not widen permissions. |
Address both review comments with two focused sentences covering apostrophe encoding and explicit control-character escapes, including a multiline body example. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |

Summary
Clarify how PR Code Quality Reviewer must quote JSON publication payloads: JSON-escape content, encode apostrophes as
\u0027, and retain the existing single-quotedprintf '%s' ... | safeoutputs ...transport. Do not expand permissions or change review semantics. Regenerate the workflow lock (body/admission hashes only).Root cause and evidence
Run 39546578499 failed because the generated inline-comment JSON contained the literal apostrophe in
selected key's following siblinginside a shell single-quoted argument. This prematurely terminated quoting; the SDK reported an unexpectedstartcommand segment and correctly denied both publication attempts.report_incompletethen succeeded. Both current main workflow source and lock matched the investigated checkout before editing.A fresh Oct 20–21 15:27 UTC 24-hour query returned 19 failure-conclusion runs: 15 missing-head-branch checkout failures after PR merge, two jobless failures with no check runs, this incomplete publication, and one gateway failure. Ignore the merge/deleted-head interruptions as requested; jobless metadata alone does not establish a fixable defect. The gateway failure in run 39529635864 was the missing
safe_output_names.cjspackaging bug already fixed by #70738; no duplicate fix is included.Validation
printf: original review, apostrophe, quotes/backslashes/control characters, backticks/command substitutions/redirections/operators, and Unicode/literal escape sequences. Never executedsafeoutputsor a publication call.make recompile: all 346 workflows compiled.PATH=/opt/homebrew/bin:$PATH make agent-report-progress: passed, including workflow drift. No Go changes, so impacted Go tests were appropriately skipped../gh-aw compile pr-code-quality-reviewer --no-check-update: passed. The installed oldergh awCLI cannot parse current repository config.pre-agent-steps, which are intentionally prohibited in dry-run; those imports and protections remain unchanged. No live workflow dispatched.This is prompt-level prevention for an observed malformed publication command, not a change to the permission checker or a guarantee about future model behavior.