Skip to content

Fix PR reviewer safe-output payload quoting guidance - #70913

Merged
pelikhan merged 2 commits into
mainfrom
pelikhan-super-disco
Oct 21, 2026
Merged

pelikhan merged 2 commits into
mainfrom
pelikhan-super-disco

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Clarify how PR Code Quality Reviewer must quote JSON publication payloads: JSON-escape content, encode apostrophes as \u0027, and retain the existing single-quoted printf '%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 sibling inside a shell single-quoted argument. This prematurely terminated quoting; the SDK reported an unexpected start command segment and correctly denied both publication attempts. report_incomplete then 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.cjs packaging bug already fixed by #70738; no duplicate fix is included.

Validation

  • Replayed the exact archived failing command as data against existing permission/parser helpers: original denied, corrected payload approved.
  • Five payload cases round-trip unchanged through actual Bash printf: original review, apostrophe, quotes/backslashes/control characters, backticks/command substitutions/redirections/operators, and Unicode/literal escape sequences. Never executed safeoutputs or a publication call.
  • Read-only security review passed with no findings. Generated lock inspected: only prompt/body and admission hashes changed.
  • 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.
  • Current repository-built ./gh-aw compile pr-code-quality-reviewer --no-check-update: passed. The installed older gh aw CLI cannot parse current repository config.
  • Strict diagnostic dry-run cannot compile the existing imported 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.

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>
@pelikhan
pelikhan marked this pull request as ready for review October 21, 2026 16:27
Copilot AI max review requested due to automatic review settings October 21, 2026 16:27
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #70913

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · haiku45 · 9.74 AIC · ⌖ 7.03 AIC · ◇ 2.64 AIC · ⊞ 9.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗️ · opus55 · 11.2 AIC · ⌖ 32 AIC · ◇ 15.8 AIC · ⊞ 1.9K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-21T16:31:28Z
review_event: COMMENT
top_themes: [publication payload JSON escaping, control-character quoting]
files_reviewed: [.github/workflows/pr-code-quality-reviewer.md, .github/workflows/pr-code-quality-reviewer.lock.yml]
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · 1.6 AIC · ⌖ 0.549 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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>
@pelikhan
pelikhan merged commit 93f2d33 into main Oct 21, 2026
22 checks passed
@pelikhan
pelikhan deleted the pelikhan-super-disco branch October 21, 2026 16:48
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.93.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants