Repository navigation
feat(docs-review): render the summary from structured fields - #395
theletterf wants to merge 8 commits into
Conversation
The review agent wrote its summary as free Markdown and drifted from the template in three or four of ten sandbox runs (#394). Follow the pattern elastic/libra uses: the model fills in fields, and code writes the text. - Add a custom safe-output job, docs-review-summary. The agent calls it once with flat fields (content_type, action_required, issue_satisfaction, follow_ups, not_checked). The job renders the summary from a fixed template and posts it as a PR comment. Empty fields omit their section, and placeholder lines such as "None" are dropped. - The job posts agent text outside the built-in handlers, so it applies the same domain allowlist, escapes HTML, neutralizes line-leading headings and rules, and wraps @mentions in code. - It runs only when threat detection reports success. The detection job can succeed even when it finds a threat, so the gate reads its detection_success output. - Inline comments stay in the built-in review, with a fixed one-line body that points to the summary comment. Remove add-comment, and update the prompt to the new contract. Co-Authored-By: Claude Opus 5.5 <[email protected]>
In the sandbox, the summary job was skipped in every run. Threat
detection fails before it analyzes anything ("Cannot connect to
Anthropic API proxy"), so detection_success is false, while the
built-in safe_outputs job still posts because it gates on the
detection job result. Use the same gate so the summary posts whenever
the review does. Tighten both together once detection works.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sandbox run rendered the summary but got 403 "Resource not accessible by integration" when it posted. GITHUB_TOKEN needs pull-requests: write to comment on a pull request, even through the issues endpoint. Match the built-in safe_outputs job permissions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@copilot resolve the merge conflicts in this pull request |
…d-summary # Conflicts: # .github/workflows/gh-aw-docs-review.lock.yml Co-authored-by: theletterf <[email protected]>
Resolved the merge conflicts and merged |
Restore the empty-string detection overrides from #396. Changing them to unusable values belongs in its own PR, so project metadata goes back to main. Escape leading code fences in summary fields so a field cannot open a code block that swallows the later sections and the footer. Merge main to resolve conflicts with #409 and #410. Related to elastic/docs-eng-team#757 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The summary renderer only checked Markdown links whose target started with http:// or https://. Protocol-relative (//host), mailto:, relative, and other-scheme targets passed through unchanged, so a summary field could still emit a link outside the allowlist. Check every link and image target with allowed(), which now accepts only absolute http(s) URLs on an allowed host and rejects backslashes and userinfo. Drop reference-style link definitions, and remove bare www. hosts and email addresses that GitHub would autolink. Related to elastic/docs-eng-team#757 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
There was a problem hiding this comment.
Requesting changes: the summary path currently succeeds when required summary output is missing, which can silently skip posting the summary comment.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
A missing docs_review_summary item or an empty rendered summary made the job exit 0, so a download or parsing problem skipped the summary comment while the run still looked green. Exit non-zero with an error annotation in both cases. Related to elastic/docs-eng-team#757 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
URL and Markdown sanitization bypasses must be fixed, permissions narrowed, and consumer documentation updated.
4 open findings
What changed in this PR
Adds deterministic rendering for docs-review summaries from structured agent fields.
Changes:
- Adds a custom summary safe-output job with sanitization.
- Updates review instructions for structured fields and separate summaries.
- Regenerates the compiled workflow.
| File | Description |
|---|---|
.github/workflows/gh-aw-docs-review.md |
Defines summary rendering and revised agent behavior. |
.github/workflows/gh-aw-docs-review.lock.yml |
Compiles the updated workflow configuration. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…write, update README - Make the bare-URL filter case-insensitive so HTTPS://evil.example no longer bypasses the allowlist. - Remove issues: write from the summary job. It only posts a pull request comment, which pull-requests: write authorizes. - Describe the separate summary comment and the docs-review-summary job in the consumer README. Related to elastic/docs-eng-team#757 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>



Closes #394. Related to elastic/docs-eng-team#757.
The docs review writes its summary as free Markdown, and in three or four of ten sandbox runs it drifted from the template: a missing heading, a section that said only "None.", a praise paragraph, or a coverage list full of checks that found nothing. The prompt already forbids all of these. In #393, I tried catching the drift with a shell checker, but each review round found another way around it, so we removed it.
This PR follows the approach elastic/libra uses: the model fills in fields, and code writes the text.
A new custom safe-output job,
docs-review-summary, gives the agent one tool with flat fields:content_type,action_required,issue_satisfaction,follow_ups, andnot_checked. gh-aw custom inputs at this version can only be strings, booleans, or choices, so multi-item sections take one item per line. The job builds the summary from a fixed template and posts it as a PR comment. An empty field leaves its section out, and placeholder lines such as "None" or "n/a" are dropped, so those drift patterns can't happen anymore.Because this job posts agent text itself, outside the built-in handlers, it repeats their protections. It keeps links only to the allowed domains (
elastic.co,docs-v3-preview.elastic.dev,github.com), escapes HTML, neutralizes line-leading headings, horizontal rules, and code fences so a field can't break the template, and wraps@mentionsin code so they don't ping anyone.The job uses the same gate as the built-in
safe_outputsjob: it runs whenneeds.detection.result == 'success'. That gate is weaker than it looks. The detection job can report success even when it finds a threat, because its conclusion step continues on error, and in the sandbox detection currently fails before it analyzes anything. So a summary can be posted when detection flags a threat or never ran, exactly as the built-in review comments are today. A stricter gate on thedetection_successoutput would have blocked every summary in the sandbox (see c69208c). The two gates should be tightened together once detection works, which I'll track separately.There's one trade-off for reviewers to accept: a review with findings now produces two items, the review with inline comments and a separate summary comment. The review body is a fixed line that points to the summary. A review with no findings still produces one comment, as today.
This PR no longer touches the threat-detection environment overrides from #396. An earlier revision replaced the empty values with unusable ones in the docs review and project metadata workflows. That is a separate fix with its own testing, so I removed it here.
Out of scope here, and worth follow-ups: structured inline comments with a severity scale, a code filter for known noise patterns, and an eval runner for the pinned cases listed in #394.
Next, I'll test it in
docs-actions-sandboxon replicas of elastic/docs-content#8643 and #8617, using the pinned commits from #394. I'll check the comment order, how the review with the one-line body looks, and that the summary follows the template.🤖 Generated with Claude Code