Repository navigation
Fix Markdown-escaped temporary ID resolution in safe outputs - #75688
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ 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.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ 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 Specification Reviewer completed successfully!
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection results could not be parsed. Review the workflow run logs to troubleshoot the error. 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.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
There was a problem hiding this comment.
Reviewed the changed temporary-ID matching and regression coverage. I found no merge-blocking correctness issues in the changed lines. Static review only; tests were not run per review constraints.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
Reviewed head 255ef84e2d088296d5249abf23246f871060ea22 against base 983d462a96bb14b1a78365698b7ba5c535a05317. The PR is aligned with its stated intent and preserves unresolved/malformed references, complete-token matching, and existing authorization/deferral behavior. No blocking contract violation found.
Applicable contract: docs/src/content/docs/specs/safe-outputs-specification.md v1.29.19, Section 7.1 item 2 (issue-body temporary-ID resolution), Section 7.3 item 5 (comment-memory rewrite), Section 4.2 Phase 8 item 5, and Stage 6. The implementation and added tests provide evidence for an intentional lexical expansion, but the contract should be synchronized.
Proposed update (not applied): bump version to 1.29.20, status Working Draft, publication date 2026-11-07, and add this changelog entry:
**Version 1.29.20** (2026-11-07):
- **Specified**: Temporary-ID resolution recognizes Markdown-escaped and partially escaped hashes and underscores across dependency extraction, unresolved detection, replacement, supported URL patch handling, and artifact/project URL replacement.
- **Specified**: Implementations remove only escapes immediately preceding `#` or `_` for lookup and output, preserve unrelated escapes, leave unresolved or malformed references unchanged, and reject valid-prefix matching.
- **Clarified**: Issue-body and comment-memory rewrites apply the same normalization and complete-identifier requirements before replacement or comment upsert.
- **Updated**: Publication metadata to 1.29.20.Proposed normative replacement for the Temporary ID definition:
**Temporary ID**: A workflow-scoped placeholder identifier using the form `aw_<id>` for a not-yet-created resource. A temporary-ID reference MAY appear in ordinary Markdown form or with a Markdown escape immediately before `#`, `_`, or both (for example, `#aw_track1`, `\#aw_track1`, `#aw\_track1`, or `\#aw\_track1`). Implementations MUST remove only those backslash escapes immediately preceding `#` or `_` when normalizing a reference for lookup or emitted replacement. They MUST preserve unrelated backslash escapes. A valid temporary-ID candidate MUST match the complete identifier form; implementations MUST NOT match a valid prefix of a longer or malformed identifier.Replace Section 7.1 item 2 with:
2. **Temporary ID Resolution**: References to temporary IDs in issue bodies MUST be recognized in ordinary Markdown form and in Markdown-escaped or partially escaped forms, including `#aw_track1`, `\#aw_track1`, `#aw\_track1`, and `\#aw\_track1`. Implementations MUST remove only backslash escapes immediately preceding `#` or `_` for lookup and replacement, then replace resolved references with the actual resource numbers. Unresolved references and malformed identifiers MUST remain unchanged. Implementations MUST require a complete valid identifier and MUST NOT replace a valid prefix within a longer or malformed identifier.Replace Section 7.3 item 5 with:
5. **Temporary ID Rewrite**: If temporary IDs are resolved during processing, comment-memory content MUST recognize ordinary and Markdown-escaped or partially escaped references, remove only escapes immediately preceding `#` or `_` for lookup and output, and rewrite resolved references before final upsert. Unresolved references, malformed identifiers, and unrelated backslash escapes MUST remain unchanged; valid prefixes MUST NOT be rewritten.Also update Phase 8 item 5 and Stage 6 with the same normalization, preservation, and complete-token requirements, while retaining the existing repository authorization checks and deferred-retry semantics. This is a synchronization proposal, not a security relaxation. Review was static; no tests or conformance scripts were run.
Generated by PR Specification Reviewer for #75688 · copilot · gpt50 · ~5 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review-specs to run again
| * Markdown rendering may escape the hash and underscores; consume those escapes too. | ||
| */ | ||
| const TEMPORARY_ID_PATTERN = /#(aw_[A-Za-z0-9_]{3,12})\b/gi; | ||
| const TEMPORARY_ID_PATTERN = /\\?#(aw\\?_(?:[A-Za-z0-9]|\\?_){3,12})(?![A-Za-z0-9_-]|\\_)/gi; |
There was a problem hiding this comment.
Specification synchronization is needed for this intentional lexical expansion. The current contract Section 7.1 item 2 and Section 7.3 item 5 only specify canonical #aw_<id> references, so they do not define the escaped and partially escaped forms implemented here. Please apply the exact proposed replacements and version/changelog update in the final review body; preserve the existing authorization and deferral requirements.
There was a problem hiding this comment.
Updated the specification to define ordinary, escaped, and partially escaped temporary-ID references, including the requested Section 7.1/7.3 wording, Phase 8 and Stage 6 semantics, and v1.29.20 changelog. Existing authorization and deferred-retry requirements remain intact. Commit: 1f02512.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the Markdown-escaped temporary-ID resolution changes.
No open issues 🎉
What changed in this PR
This PR fixes temporary-ID resolution in safe outputs when Markdown escapes hashes or underscores, including references awaiting later resource creation.
Changes:
- Recognize and normalize escaped references for detection, dependency extraction, and replacement.
- Preserve unresolved references and unrelated escapes while preventing partial matches of malformed IDs.
- Add regression coverage for escaped issue, artifact, project, and patch URL references, plus deferred comment updates.
| File | Description |
|---|---|
actions/setup/js/temporary_id.test.cjs |
Adds escaped-reference resolution and preservation tests. |
actions/setup/js/temporary_id.cjs |
Updates matching and normalization to handle Markdown escapes. |
actions/setup/js/safe_output_handler_manager.test.cjs |
Extends deferred comment tracking and update tests to escaped references. |
Review effort: Balanced (auto)
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /tdd, and /codebase-design. The fix is well targeted, and the tests cover the main escaped-reference paths. I found one coverage gap and one design concern.
📋 Key Themes & Highlights
Key Themes
- Structured-field coverage gap:
normalizeTemporaryIdstrips escapes, butisTemporaryId(line 76) andextractTemporaryIdReferences(issue_number,blocked_by,item_url) still reject escaped IDs. I reproduced this. The gap predates the PR, so it is not a regression, but the new tests stop at text fields. - Duplicated URL regex: the URL-context pattern at line 142 (
replaceTemporaryIdReferencesInPatch) copiesTEMPORARY_ID_PATTERNinstead of sharing it. Both now carry the same escape rules, so they can drift. My earlier inline comment was anchored to line 58, which is outside the diff, so treat this note as the applicable one. - Trailing-hyphen behavior: the new lookahead changes unescaped text such as
#aw_abc-def. This is intended and covered by the malformed-ID test near line 250, so it is a nit only.
Positive Highlights
- ✅ Escape handling is applied consistently across the text, patch-URL, and artifact paths.
- ✅ Malformed-ID warnings are tested for escaped and unescaped forms.
- ✅ The
safe_output_handler_managertests useit.eachover escaped and unescaped IDs, which keeps the two forms in sync.
Limitations
I could not run the vitest suites because the npm registry rejects its TLS certificate in this environment. The results above come from standalone Node probes and an assertion script covering the 14 expectations in the test files. Please run make test-unit to confirm.
@copilot please address the structured-field gap and the duplicated URL regex. The trailing-hyphen point is optional.
Comments that could not be inline-anchored
actions/setup/js/temporary_id.cjs:90
**[/diagnosing-bugs]** `normalizeTemporaryId` now strips `\#` and `\_`, but `isTemporaryId` (line 76) still accepts only the unescaped form. `extractTemporaryIdReferences` also has no escape coverage for structured fields (`issue_number`, `blocked_by`, `item_url`). I reproduced that escaped IDs in those fields are not extracted. This is a coverage gap rather than a regression, since those paths never handled escapes. Normalize before validating on those paths, and add regression tests that pin t...
actions/setup/js/temporary_id.cjs:58
**[/codebase-design]** This inline regex copies `TEMPORARY_ID_PATTERN` (line 32) rather than reusing it, so the two can drift. The duplication predates this PR, but the PR extends it with the same escape rules, so the next escape change has to be made in two places. Build both from one shared source string, or add a comment explaining why the URL form needs its own boundary. @copilot please address this.
actions/setup/js/temporary_id.cjs:32
**[/tdd]** The new lookahead `(?![A-Za-z0-9_-]|(redacted))` also rejects a trailing hyphen, which is intended and already covered by the malformed-ID test near line 250. It is worth confirming that `#aw_abc-def` and `\#aw\_abc-def` have the expected behavior in one place. This is a nit, not a blocker. @copilot please address this.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again
|
Copilot assignment requested for the following outstanding work:
Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI. Sous-chef requested-head: 255ef84
|
…-id-resolution Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot avoid escaping temporary ids in markdown as they need to be expanded |
Assignment running:
Sous-chef requested-head: 255ef84
Updated Markdown rendering to preserve complete temporary IDs for expansion while retaining other escaping. Commit: |
…-id-resolution Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |
Markdown rendering escapes temporary references such as
\#aw\_track1, causing resolution and deferred-update detection to miss them.