Repository navigation
Defer supported temporary targets before authorization - #79498
Conversation
Reuse target resolvers at the manager guard, cover accepted variants across native consumers, clarify the mutable handler copy, and add a reusable deferral skill. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Temporary-ID handling regressions cause indefinite deferrals, prevent retries for project updates, and reject valid cross-repository targets.
5 open issues
Restore draft_issue_id deferral for update_project · New Guard effective project-content aliases before authorization · New Use the strict resolver for merge_pull_request · New Preserve recognized target IDs during input normalization · New Check only effective handler targets before deferring · New
What changed in this PR
This follow-up to #79482 updates safe-output target detection so supported unresolved temporary targets defer before authorization, while preserving invocation binding and snapshot-backed execution.
Changes:
- Reuse existing target resolvers and replace suffix-based detection with explicit target fields.
- Expand regression coverage for accepted spellings, aliases, deferred execution, malformed IDs and unrelated fields.
- Clarify handler-input mutability and add reusable target-deferral guidance.
| File | Description |
|---|---|
docs/src/content/docs/specs/safe-outputs-specification.md |
Clarifies snapshot immutability, mutable handler messages and target deferral. |
actions/setup/js/safe_output_handler_manager.cjs |
Uses existing resolvers to detect unresolved targets before authorization. |
actions/setup/js/safe_output_handler_manager_authorization.test.cjs |
Adds guard-level and real-handler authorization regressions. |
.github/skills/safe-output-target-deferral/SKILL.md |
Documents deferral contracts, investigation steps and validation guidance. |
Review effort: Max (adaptive)
| /** @type {Set<string>} Project-safe-output handlers that should default to GH_AW_PROJECT_GITHUB_TOKEN when no per-handler github-token is configured. */ | ||
| const PROJECT_HANDLER_TYPES = new Set(["create_project", "create_project_status_update", "update_project"]); | ||
| const MENTION_HANDLER_TYPES = new Set(["add_comment", "close_discussion", "create_discussion", "create_issue", "create_pull_request", "create_pull_request_review_comment", "reply_to_pull_request_review_comment"]); | ||
| const TEMPORARY_TARGET_FIELDS = new Set(["item_number", "issue_number", "pr_number", "pull_number", "pull_request_number", "pr-number", "parent_issue_number", "sub_issue_number", "discussion_number", "content_number"]); |
There was a problem hiding this comment.
Fixed in cfc1de8. The guard now defers a valid unresolved draft_issue_id when no title fallback is available, using the existing draftItemId mapping; consumer-before-producer coverage was added.
| // Targets that are still temporary cannot consume an authority decision. | ||
| for (const [key, value] of Object.entries(message)) { |
There was a problem hiding this comment.
Fixed in cfc1de8. The guard follows update_project's effective content_number/contentNumber > issue > pull_request precedence and ignores those fields in draft_issue mode; alias regressions were added.
| if (typeof value !== "string" || !/(?:number|_id)$/.test(key) || key === "temporary_id" || key === "output_id") continue; | ||
| if (/^#?aw_[A-Za-z0-9_]+$/.test(value) && !temporaryIdMap.has(normalizeTemporaryId(value))) { | ||
| if (typeof value !== "string" || !TEMPORARY_TARGET_FIELDS.has(key)) continue; | ||
| const target = key === "discussion_number" ? resolveNumberFromTemporaryId(value, resolvedTemporaryIds) : resolveIssueNumber(value, temporaryIdMap); |
There was a problem hiding this comment.
Fixed in cfc1de8. merge_pull_request.pull_request_number now uses resolveNumberFromTemporaryId in the guard, preserving the handler's rejection of quoted targets instead of deferring them.
| const target = key === "discussion_number" ? resolveNumberFromTemporaryId(value, resolvedTemporaryIds) : resolveIssueNumber(value, temporaryIdMap); | ||
| if (target.wasTemporaryId && !target.resolved) { |
There was a problem hiding this comment.
Fixed in cfc1de8. Recognized effective temporary targets remain intact for the snapshot-bound native resolver instead of being rewritten as body-text repository/number strings; cross-repository resolver coverage was added.
| if (typeof value !== "string" || !TEMPORARY_TARGET_FIELDS.has(key)) continue; | ||
| const target = key === "discussion_number" ? resolveNumberFromTemporaryId(value, resolvedTemporaryIds) : resolveIssueNumber(value, temporaryIdMap); | ||
| if (target.wasTemporaryId && !target.resolved) { |
There was a problem hiding this comment.
Fixed in cfc1de8. The guard checks only effective targets, respecting wildcard alias precedence and configured parent selection; regressions cover ignored remove_labels and link_sub_issue fields.
|
🍳 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": "e30bfce8b2506708885b659a44333be36a38a8a6",
"kind": "requested",
"schema_version": "1",
"state": "f9ee6dc26f6dcc0003641a92c57814729eaf24d7391a6e0ffd7994a35e0bda77",
"work": [
"23027a7a3ebe972cffc3eabad4a22e44dac70312f0e8b312d61f867187f7f01d",
"3d63b100a8a02eec93a50a1ce2eb6adb12851120ace9470e7100dabca2616edb",
"43282e7f5b3023b8c8cf9099eab79e7b99f650965f08b47d3df33cde5589879d",
"527a2f09f2ef6206ba1bf3012b5c6c5a04280157c5b7a19bb0475c5dddb8e25d",
"52b4439d964c2fb3c6c3a5830f072f28abd3ce8f0fa9d191354747f3bfb53b4f",
"660689bfe433762235cb5831afe1ff78e2258be888b99e773d8f1112d0e24817",
"ad80fc8e9dbede03337726bec209112a7e5133c55b246116a76c3f9170a64f8b"
],
"workflow": "pr-sous-chef"
}
|
…rget-deferral Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Completed in cfc1de8; the latest-main merge is 1bd228c. The five target-handling findings are fixed with regression coverage. |

Unresolved temporary targets accepted by the issue resolver could consume an allow decision before the handler deferred. This follow-up to #79482 fixes that pre-existing mismatch without changing the authorization protocol or snapshot-backed execution boundary.
Changes
item_number,issue_number,pr_numberandpull_number. The realremove-labelshandler obtains exactly one decision after production and mutates only the literal expected repository/number; permanently unresolved targets consume none.safe-output-target-deferralskill.Validation
The original guard reproduced five consumer-before-producer failures with one authority call before production, plus premature authorization for a permanently unresolved quoted target. The canonical control passed.
The focused manager-authorization, bound-temporary-ID and resolver suites pass: 228 tests. JavaScript typecheck, changed-file ESLint, formatting and the skill prefix check pass. The repository final gate initially encountered missing linter dependencies; after restoring them, the failed lint check passed. No Go files or workflow sources changed.
Coverage limits
Other native handlers have guard-level coverage, not exhaustive authorization-to-effect coverage. Custom executors and queue/Claim adapters remain outside the assessed scope. No new hashes, configuration, authorization service or effect framework; snapshot-backed map and per-invocation cache refreshes remain unchanged.