Repository navigation
Preserve hidden reference markers in PR review bodies - #76805
Conversation
Co-authored-by: pelikhan <[email protected]>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ 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 Specification Reviewer completed successfully! PR Specification ReviewerOutcome: 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.
|
|
✅ 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.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
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.
Found one high-confidence correctness issue: agent-authored reference definitions are exempted from report size fitting without a length cap, allowing oversized review bodies and publication failure. Please cap or otherwise constrain these protected definitions before merging.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| const SIZE_NOTICE = "Content redacted to fit size limit."; | ||
| const PROTECTED_TYPES = new Set(["xml_marker", "json_marker", "review_marker", "marker", "expiration", "closing_reference"]); | ||
| const PROTECTED_TYPES = new Set(["xml_marker", "json_marker", "review_marker", "reference_definition", "marker", "expiration", "closing_reference"]); | ||
|
|
There was a problem hiding this comment.
This makes unbounded agent-authored reference definitions size-protected, so a single definition can exceed MAX_BODY_LENGTH and cause review publication to fail or bypass the intended size limit.
💡 Cap protected metadata before exempting it from fitting
REPORT_REFERENCE_DEFINITION accepts an arbitrary-length destination, while PROTECTED_TYPES prevents the fitter from redacting it. Add a maximum length during AST normalization (and a regression test larger than the body limit), or otherwise ensure oversized definitions are rejected/escaped before publication.
There was a problem hiding this comment.
Implemented in aba9ba4b37: agent-authored reference definitions are now eligible for whole-node size fitting, while trusted framework definitions remain protected. Added overflow coverage with 3,000 definitions and a required framework marker.
There was a problem hiding this comment.
🟡 Changes recommended
Marker normalization can corrupt payloads or invalidate definitions, while unbounded reference definitions can exceed the size budget, causing review publication to fail.
2 open issues
What changed in this PR
This PR addresses #76600 by adding typed support for hidden, fragment-only reference definitions in review bodies, preserving underscores and avoiding Markdown escaping.
Changes:
- Parse supported reference definitions into dedicated AST nodes and render them directly.
- Apply redaction while protecting these markers from size fitting; keep other destinations escaped.
- Add parser, renderer, size-fitting, and review-submission regression coverage.
| File | Description |
|---|---|
actions/setup/js/report_size.test.cjs |
Tests reference definitions as protected metadata. |
actions/setup/js/report_size.cjs |
Exempts reference definitions from size fitting. |
actions/setup/js/report_markdown.cjs |
Parses supported definitions into typed nodes. |
actions/setup/js/report_ast.test.cjs |
Tests payload preservation and destination validation. |
actions/setup/js/report_ast.cjs |
Defines, validates, normalizes, and renders reference nodes. |
actions/setup/js/pr_review_buffer.test.cjs |
Tests marker preservation in submitted reviews. |
Review effort: Balanced (auto)
| const normalized = normalizeReportText(value); | ||
| if (!isReportReferenceDefinition(normalized)) throw new TypeError("Invalid report reference definition"); |
| const MAX_BODY_LENGTH = 65536; | ||
| const SIZE_NOTICE = "Content redacted to fit size limit."; | ||
| const PROTECTED_TYPES = new Set(["xml_marker", "json_marker", "review_marker", "marker", "expiration", "closing_reference"]); | ||
| const PROTECTED_TYPES = new Set(["xml_marker", "json_marker", "review_marker", "reference_definition", "marker", "expiration", "closing_reference"]); |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /codebase-design, and /tdd. Requesting changes because two reproduced failure modes can fail review publication.
📋 Key Themes and Findings
Key Themes
- Render-time throw: entity-encoded or redacted reference labels that leave the charset throw
Invalid report reference definition, with no fallback. Thereview_markerbranch already falls back. - Unbounded protected definitions:
reference_definitionis protected from size redaction even when agent-authored, so oversized input makesrenderSizedReportthrowERR_VALIDATION. - Test gaps: no coverage for entity-encoded or secret-shaped labels or for overflow. Assertions use
toContain, which misses the blank line rendering adds between definitions.
Positive Highlights
- ✅ Gating the parser branch on
allowMetadatakeeps fenced code and footer-off paths escaped. - ✅ Fragment-only charset rejects
<,>, and whitespace, so the injection surface stays narrow. - ✅ Redaction runs before validation, so secrets never leak into a definition.
Limits
- The vitest suite could not run here:
npm installfailed on a sandbox TLS error. Findings come from Node reproductions of the changed modules. - Base-branch diffing was unavailable, so this review uses the pre-fetched diff only.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| const MAX_BODY_LENGTH = 65536; | ||
| const SIZE_NOTICE = "Content redacted to fit size limit."; | ||
| const PROTECTED_TYPES = new Set(["xml_marker", "json_marker", "review_marker", "marker", "expiration", "closing_reference"]); | ||
| const PROTECTED_TYPES = new Set(["xml_marker", "json_marker", "review_marker", "reference_definition", "marker", "expiration", "closing_reference"]); |
There was a problem hiding this comment.
[/codebase-design] reference_definition is now in PROTECTED_TYPES even when it is agent-authored. Reproduced: a single 70 KB fragment definition, or about 3000 short definitions (about 120 KB), makes renderSizedReport throw ERR_VALIDATION, so the whole review fails. Protecting only non-agent definitions would fix this. Otherwise, bound the agent-authored count and bytes at parse time so oversized input is redacted or rejected per definition.
💡 Suggested fix
Keep reference_definition out of PROTECTED_TYPES when agentTainted is true, or cap agent-authored definitions at parse time. Add a report_size test with an oversized agent-authored definition set.
@copilot please address this.
There was a problem hiding this comment.
Implemented in aba9ba4b37: size fitting can now replace agent-authored reference definitions while preserving trusted framework markers. Added coverage for aggregate overflow and trusted-marker protection.
| nodes.push(fromSource({ type: "paragraph", children: inline(line) })); | ||
| } | ||
| index++; | ||
| } else if (allowMetadata && isReportReferenceDefinition(line)) { |
There was a problem hiding this comment.
[/tdd] The new parser branch has no failure path and the tests only cover the happy path. report_ast.test.cjs never feeds entity-encoded or redacted-label definitions, and pr_review_buffer.test.cjs uses toContain per line, so it does not pin the blank line that rendering inserts between adjacent definitions. Add a failing test for each edge case first, then make it pass. Assert the exact rendered body for the multi-definition case.
@copilot please address this.
There was a problem hiding this comment.
Implemented in aba9ba4b37: added entity-like payload cases and an exact rendered-body assertion, including spacing between adjacent definitions.
| /** @param {string} value */ | ||
| function normalizeReportReferenceDefinition(value) { | ||
| const normalized = normalizeReportText(value); | ||
| if (!isReportReferenceDefinition(normalized)) throw new TypeError("Invalid report reference definition"); |
There was a problem hiding this comment.
[/diagnosing-bugs] Reproduced: validation runs after normalization, so any entity-decoded or redacted value that leaves the label/fragment charset throws at render time. [x]: #a<b>@admin parses, then renderReport throws Invalid report reference definition. A secret-shaped label such as [ghp_...]: #x is redacted to [******] and throws the same way. The review_marker branch falls back to an escaped paragraph for this case; this branch should do the same.
💡 Suggested fix
On normalization or validation failure in normalizeBlocks, emit an escaped paragraph instead of throwing. Add a regression test that feeds an entity-encoded definition and a secret-shaped label, and asserts the review still renders.
@copilot please address this.
There was a problem hiding this comment.
Implemented in aba9ba4b37: valid marker bytes are preserved, and markers changed by secret redaction fall back to escaped text instead of aborting rendering. Added a secret-shaped label regression test.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "aae6e8624b01187841cd9659b29ceebc45b85f82",
"kind": "requested",
"schema_version": "1",
"state": "4cb2d1ae3455dbf212da0b6c0779eb652f2c0bc6551accf8e4f51d659ff566f0",
"work": [
"2aa5e1226927fcf5eaca0daead28e092f0121b38d93ae1ca13c98d630fb5a6cf",
"6e665438426628adf7cf85cb93cb1fdfb24b72419eae1e46c73275078c0a0958",
"ae3f6ffa2a7ce54bc85d074a7be0ef480355b5326e5f83361f9f874b76c9c9fb",
"f9689edd084320e8eb394eb61151b8e4517fda68b379e247a28cc4d2e3f47b8f"
],
"workflow": "pr-sous-chef"
}
|
…link-escaping Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
|
Category: bug | Risk: medium | Score: 67/100 (impact 34 + urgency 18 + quality 15). Recommended action: auto_merge. Batch: pr-batch:copilot-runtime. Reason: small correctness fix, narrow blast radius, and all checks passed.
|
|
@copilot do an RAI / adverserial agent review of this change |
…link-escaping Co-authored-by: pelikhan <[email protected]>
Merged current
Adversarial review found no confirmed new vulnerabilities in the six-file PR delta. Existing limitation: encoded secrets can evade redaction; this change can make such content less visible in rendered reference definitions, though it remains in the raw body. Live GitHub rendering and exhaustive resource-exhaustion testing were not performed. CodeQL timed out. |
|
Category: bug | Risk: medium | Priority: medium | Score: 67/100 (impact 34 + urgency 18 + quality 15)
|
|
🎉 This pull request is included in a new release. Release: |

Agent review bodies escaped reference definitions, making hidden markers visible and corrupting payloads containing underscores.
The definition is preserved in the submitted review body, including
abc_def_ghi.