Skip to content

Preserve hidden reference markers in PR review bodies - #76805

Merged
pelikhan merged 5 commits into
mainfrom
copilot/fix-markdown-link-escaping
Nov 11, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/fix-markdown-link-escaping

Conversation

Copilot AI commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Agent review bodies escaped reference definitions, making hidden markers visible and corrupting payloads containing underscores.

  • Change: Parse safe fragment-only definitions as typed AST markers and render their contents unchanged. Keep them redacted and protected from size fitting; other destinations remain escaped text.
  • Example:
[my-data]: #v=1,data=H4sIAAAA-abc_def_ghi

The definition is preserved in the submitted review body, including abc_def_ghi.

Copilot AI changed the title [WIP] Fix escaping of link reference definitions in review body Preserve hidden reference markers in PR review bodies Nov 11, 2026
Copilot AI requested a review from pelikhan November 11, 2026 08:50
@pelikhan
pelikhan marked this pull request as ready for review November 11, 2026 09:07
Copilot AI adaptive review requested due to automatic review settings November 11, 2026 09:07
@github-actions

github-actions Bot commented Nov 11, 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 commented Nov 11, 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 · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

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 PR Specification Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76805

@github-actions

github-actions Bot commented Nov 11, 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 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

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 Ponytail Reviewer · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76805

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

Generated from PR Code Quality Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-11T09:11:17Z
review_event: REQUEST_CHANGES
top_themes: oversized protected reference definitions can bypass report body size limits
files_reviewed: actions/setup/js/report_size.cjs, actions/setup/js/report_ast.cjs, actions/setup/js/report_markdown.cjs, actions/setup/js/pr_review_buffer.test.cjs, actions/setup/js/report_ast.test.cjs, actions/setup/js/report_size.test.cjs
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 · ~3 AIC · ⌖ ~1 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.

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"]);

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

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.

🟡 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)

Comment thread actions/setup/js/report_ast.cjs Outdated
Comment on lines +168 to +169
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"]);

@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 🧠

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. The review_marker branch already falls back.
  • Unbounded protected definitions: reference_definition is protected from size redaction even when agent-authored, so oversized input makes renderSizedReport throw ERR_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 allowMetadata keeps 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 install failed 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"]);

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.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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)) {

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.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implemented in aba9ba4b37: added entity-like payload cases and an exact rendered-body assertion, including spacing between adjacent definitions.

Comment thread actions/setup/js/report_ast.cjs Outdated
/** @param {string} value */
function normalizeReportReferenceDefinition(value) {
const normalized = normalizeReportText(value);
if (!isReportReferenceDefinition(normalized)) throw new TypeError("Invalid report reference definition");

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] 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/report_size.cjs:14): address unresolved feedback - Review comment
  3. Review (actions/setup/js/report_size.cjs:13): address unresolved feedback - Review comment
  4. Review (actions/setup/js/report_markdown.cjs:451): address unresolved feedback - Review comment
  5. Review (actions/setup/js/report_ast.cjs:169): address unresolved feedback - Review comment

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"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

@github-actions

Copy link
Copy Markdown
Contributor

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.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~5 AIC · ⌖ ~2 AIC · ⊞ 15.9K · ◷

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot do an RAI / adverserial agent review of this change

Copilot AI commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged current main in dfdb07db. The linked feedback was addressed in aba9ba4b; its existing thread replies remain in place. Focused tests and the final validation gate passed.

@copilot do an RAI / adverserial agent review of this change

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.

@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: medium | Priority: medium | Score: 67/100 (impact 34 + urgency 18 + quality 15)
Recommended action: auto_merge | Batch: pr-batch:runtime-safety

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~6 AIC · ⌖ ~2 AIC · ⊞ 15.9K · ◷

@pelikhan
pelikhan merged commit 33f1b17 into main Nov 11, 2026
33 checks passed
@pelikhan
pelikhan deleted the copilot/fix-markdown-link-escaping branch November 11, 2026 21:37
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

submit_pull_request_review escapes reference definitions in the review body (hidden markers become visible text)

4 participants