Skip to content

Commit 076f02b

Browse files
theletterfGPT-5.5
andauthored
Harden docs-review substitution suggestions (#118)
Require a pre-output checklist before creating suggestion blocks so Elastic substitution syntax is never included in apply-ready review suggestions. Made-with: Cursor Co-authored-by: GPT-5.5 <gpt-5.5@openai.com>
1 parent 2e97d2a commit 076f02b

2 files changed

Lines changed: 45 additions & 17 deletions

File tree

.github/workflows/gh-aw-docs-review.lock.yml

Lines changed: 28 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/gh-aw-docs-review.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Report only findings that are:
207207

208208
Use line-level review comments when you can point to an exact changed line or nearby changed hunk. Keep each inline comment narrowly scoped.
209209

210-
When helpful, include a concrete replacement sentence, frontmatter snippet, or markdown wording in the comment body. Prefer GitHub suggestion blocks whenever the proposed edit cleanly maps to the reviewed line or hunk and can be applied directly. Fall back to plain prose only when the change is too large, crosses multiple distant hunks, or the exact replacement range is ambiguous.
210+
When helpful, include a concrete replacement sentence, frontmatter snippet, or markdown wording in the comment body. Prefer GitHub suggestion blocks only after passing the pre-output checklist below, and only when the proposed edit cleanly maps to the reviewed line or hunk and can be applied directly. Fall back to plain prose when the change is too large, crosses multiple distant hunks, includes protected substitution syntax, or the exact replacement range is ambiguous.
211211

212212
The review comment safe output allows a maximum of 20 inline comments. Use that budget carefully:
213213

@@ -218,11 +218,25 @@ The review comment safe output allows a maximum of 20 inline comments. Use that
218218

219219
For inline comments with concrete replacements:
220220

221-
- prefer one apply-ready GitHub suggestion over a prose description,
221+
- prefer one apply-ready GitHub suggestion over a prose description only after passing the pre-output checklist below,
222222
- keep the suggested replacement as small as possible while still fixing the issue, and
223223
- avoid suggestion blocks only when GitHub would not be able to apply them cleanly.
224224

225-
Do not use GitHub suggestion blocks when the proposed replacement contains Elastic substitution syntax such as `{{...}}`. Safe-output sanitization may escape the braces before GitHub applies the suggestion. In those cases, provide the exact replacement as prose, or suggest only the part of the line that does not include the substitution.
225+
Before creating any inline review comment, inspect the exact comment body you are about to send.
226+
227+
If the comment body would contain a GitHub suggestion block and either the original reviewed line or the proposed replacement contains Elastic substitution syntax such as `{{...}}`, do not create the suggestion block. This is a hard rule. Safe-output sanitization can escape curly braces and corrupt substitutions when GitHub applies the suggestion.
228+
229+
For these cases, use one of these alternatives instead:
230+
231+
- Leave a prose-only inline comment with the exact replacement text outside a suggestion block.
232+
- If only part of the line needs changing, suggest only the substring that does not include `{{`, `}}`, or escaped variants such as `\{\{`.
233+
- If every useful replacement would include substitution syntax, do not include an apply-ready suggestion.
234+
235+
Pre-output checklist for every `create_pull_request_review_comment` call:
236+
237+
1. Does the comment body include a fenced `suggestion` block?
238+
2. Does the original reviewed line or suggested replacement include `{{`, `}}`, `\{\{`, or `\}\}`?
239+
3. If both are true, rewrite the comment before calling the tool so it has no `suggestion` block.
226240

227241
Treat low-priority nits differently:
228242

0 commit comments

Comments
 (0)