Skip to content

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

Done

Description

@lbenie

Summary

Since the AST-based review body rendering, submit_pull_request_review escapes every Markdown link reference definition in the agent's review body, except [gh-aw-workflow-call-id]: # "...". Definitions that used to be hidden by GitHub now show up as visible text, and _..._ runs inside them are rewritten as *...*, which corrupts any data carried in them.

Workflows that round-trip state through the review body (a hidden reference definition is the documented way, since the handler notes that GitHub strips HTML comments from review bodies) can no longer read it back.

Reproduction

Agent review body passed to submit_pull_request_review:

Body text.

[my-marker]: #score=85,run_id=1,run_attempt=1
[my-data]: #v=1,data=H4sIAAAA-abc_def_ghi

Rendered body that is posted:

Body text.

\[my-marker\]: \#score=85,run\_id=1,run\_attempt=1
\[my-data\]: \#v=1,data=H4sIAAAA-abc\_def\_ghi

GitHub renders both lines as visible text instead of hiding them. In real data, some _x_ pairs came back as *x* (emphasis), so a base64url payload is not recoverable by simply unescaping.

To reproduce without a workflow, call the parser and renderer that pr_review_buffer.cjs uses:

const { parseReportMarkdown } = require('./report_markdown.cjs');
const { renderSizedReport } = require('./report_size.cjs');
const nodes = parseReportMarkdown(body, { minimumHeadingLevel: 2, allowMetadata: true, agentTainted: true });
console.log(renderSizedReport({ type: 'report', title: 'r', children: nodes }, 60000).body);

Run against github/gh-aw-actions at v1.0.1, v1.2.0 and v1.2.2; all three give the escaped output above. The submit handler logs bodyLength of the agent's body, and the posted review is longer by the number of added backslashes.

Cause

parseReportMarkdown (report_markdown.cjs) only recognizes ^\[gh-aw-workflow-call-id\]: # "([^"]+)"$ as a metadata definition. Any other reference definition is parsed as paragraph text, and renderInlines passes text through escapeMarkdown.

Expected

Reference definitions in an agent body should pass through unchanged, or there should be a supported way to carry hidden metadata in a review body, for example a generic marker node that the renderer emits verbatim. Link titles are already stripped by the sanitizer, so definitions with a URL-only destination carry no extra injection surface beyond what the existing marker has.

Environment

  • gh-aw compiler and gh-aw-actions v1.0.1; also reproduced with v1.2.0 and v1.2.2
  • Safe output: submit-pull-request-review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions