Skip to content

Bind executor temporary-ID resolutions to the authorized snapshot - #79482

Merged
pelikhan merged 6 commits into
mainfrom
pelikhan/automatic-robot
Nov 20, 2026
Merged

pelikhan merged 6 commits into
mainfrom
pelikhan/automatic-robot

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Safe-output authorization should guarantee that native execution stays within the semantics bound by the authority request (workflow hash, input_digest, policy_digest). Tracing the handler-manager path with remove_labels as the concrete case found one demonstrated gap; everything else was already covered and now has focused regressions.

The gap

The manager passed handlers Object.freeze({ ...resolvedTemporaryIds }): a shallow copy whose entries were shared with live temporaryIdMap values (provider temporaryIdEntry objects are stored by reference). Canonical aw_x targets are rewritten to numbers before the digest, but temp-ID spellings only the handler recognizes (AW_x, "aw_x") are resolved from that map at execution time. A test reproduced the request binding aw_target -> #42 while execution removed labels from #99 after an in-place entry change during the authority wait.

Fix

executeInvocation now builds one deep-frozen boundInputs snapshot, uses it as normalizedInputs for the digest, and passes boundInputs.resolvedTemporaryIds to the handler. No new hash, protocol field, or authorization feature.

Trace summary

Value Bound by Executor consumes Class
Repository pinned default, allowed_repos, input/policy digest frozen message/config Covered
Item number + aliases / configured target input/policy digest frozen message Covered
Triggering / * fallback run identity same run context Covered
Temp ID (canonical) normalized pre-digest; unresolved defers pre-decision frozen message Covered
Temp ID (other spellings) input_digest was live entries Gap, fixed
Label trim/sanitize/dedupe/allow/block/max input/policy digest deterministic derivation Covered (narrows only)
required-labels / title prefix live read can only skip Covered
Live temp map 3rd arg (upload_artifact) - - Unverified

Tests and docs

  • New remove_labels cases in safe_output_handler_manager_authorization.test.cjs verify the authority input_digest equals the digest of captured canonical inputs and record actual mutations: targets/aliases/defaults, mutation of message/config/env during the wait, temp-ID variants, single-decision deferral, no-op/invalid input, denial, global and per-output staging.
  • Added a "Semantic consistency" paragraph to the authorization section of the safe-outputs spec, stating permitted post-authorization transformations and the unassessed routes (other handlers' specific transformations, live map argument, queue/Claim adapters, custom executors).

Notes for reviewers

  • Typecheck, prettier, and related suites pass (11 files, 711 tests). Full-suite failures in this environment (git-based and a few others) reproduce identically without the change; a test in the suite also replaced /dev/null with a regular file locally.

pelikhan and others added 3 commits November 20, 2026 09:12
The manager passed handlers a shallow-frozen copy of resolvedTemporaryIds
whose entries were shared with live temporaryIdMap values. Temporary-ID
spellings resolved by the handler (case or quote variants) could therefore
execute against a target changed during the authority wait. Pass the same
deep-frozen snapshot that input_digest binds.

Add remove_labels consistency regressions (targets, aliases, defaults,
filtering, deferral, no-op, denial, staging) and document the guarantee.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Normalize undefined values with JSON semantics so the snapshot remains
digestable: undefined object fields are dropped, undefined array entries
become null, and null values are preserved.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@pelikhan
pelikhan marked this pull request as ready for review November 20, 2026 09:17
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 09:17
@github-actions

github-actions Bot commented Nov 20, 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 · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.7K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Generated by PR Specification Reviewer for #79482 · copilot · gpt56 · ~6 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 20, 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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 20, 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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #79482 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

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

What this change does: It binds temporary-ID resolutions to the snapshot used for authorization. It also adds regression tests and documents the boundary.

Should fix: 1. Reuse the existing JSON clone to avoid a separate recursive normalization helper (see inline comment).

Verdict: fix 1 first.

Lean: -19 lines possible.

Generated by ✂️ Ponytail Reviewer for #79482 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-20T09:21:26Z
review_event: REQUEST_CHANGES
top_themes:
  - authorization input snapshot must match executor input
files_reviewed:
  - actions/setup/js/safe_output_handler_manager.cjs
  - actions/setup/js/safe_output_handler_manager_authorization.test.cjs
  - docs/src/content/docs/specs/safe-outputs-specification.md
comment_count: 1
History

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 · ⌖ ~2 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 authorization-boundary issue: execution uses preparedMessage instead of the exact cloned/undefined-normalized message covered by input_digest, allowing handler semantics to diverge from the reviewed inputs. Please pass the bound snapshot to the handler and add a regression for this equivalence.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~2 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.

Overview

Reviewed PR head 693c9aba31e82843079ed8f41bb931d8e331a151 against base ab34b92385802c8f705134cc2fea1bc44f679e23. The protected manager snapshot change is directionally aligned with the Safe Outputs specification (v1.31.0), but one execution path still violates the added semantic-consistency contract.

Blocking issue

The manager passes the frozen temporary-ID snapshot as the second handler argument, while still passing the live temporaryIdMap as the third argument. safe_output_action_handler.cjs consumes that live map for temporary-ID substitution, so a mutation during the authority wait can redirect a protected custom action. The normative requirement at safe-outputs-specification.md:1754 therefore overclaims the implementation. Please bind/pass a frozen map for all protected executor paths with regression coverage, or narrow the specification scope so custom executors and live-map consumers are not covered by the MUST.

An inline comment was posted on the changed specification line. No specification edit or branch update was made.

References:

Coverage limits

This was a static contract review; tests were not run.

Generated by PR Specification Reviewer for #79482 · copilot · gpt50 · ~6 AIC · ⌖ ~1 AIC · ⊞ 1.7K
Comment /review-specs to run again

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-47b4f9a9-6a7f-49a0-aa2e-529b6da2bad2","parents":[],"payload":{"id":"ldg-49a2c721-33f6-4a8b-8298-257eae3ad778","operation":"append","value":{"finding_count":1,"head_sha":"693c9aba31e82843079ed8f41bb931d8e331a151","outcome":"findings"}},"sha":"sha256:3a5fa219eab4e0618db84829d462c904f9f6ece7110e5c1fa31a765702002013","timestamp":"2026-11-20T09:28:05.922Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-27396fde-0bd5-4869-8f50-7a424cccae27","parents":[],"payload":{"id":"ldg-c74271b1-15ba-4534-b0c9-6bbbefb20b91","operation":"append","value":{"finding_count":1,"head_sha":"693c9aba31e82843079ed8f41bb931d8e331a151","outcome":"regression"}},"sha":"sha256:f8b379c33282dec975c0d5b56801d87b3b7704dc22c7bdd88cfb86a02b26ea6a","timestamp":"2026-11-20T09:28:51.224Z","type":"ledger_append","version":1}
History

@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, /tdd and /codebase-design. Requesting changes on one correctness gap.

The snapshot binding closes the demonstrated mutation gap, and the mutation-during-wait tests are strong. However, the spec's guarantee that unresolved temporary targets defer before consuming a decision does not hold for uppercase or quoted spellings.

📋 Key Themes & Highlights

Key Themes

  • Deferral gap: case-sensitive guard lets AW_later and "aw_later" consume a decision, then fail
  • Binding drift: the handler receives preparedMessage, not the digested boundInputs.message
  • Clone semantics: structuredClone differs from the JSON round-trip it replaces

Positive Highlights

  • ✅ Deep-frozen snapshot is the right binding for the resolvedTemporaryIds argument
  • ✅ Regression tests cover mutation of message, config, env and entries during the authority wait

Not Assessed

  • The live temporaryIdMap third argument and custom executors remain unverified, as the PR notes. I did not run the test suite; these findings come from code reading and direct resolver checks.

@copilot please address the review comments above.

Comments that could not be inline-anchored

actions/setup/js/safe_output_handler_manager.cjs:1234

**[/diagnosing-bugs]** The deferral guard is case-sensitive, so an unresolved `AW_later` or quoted `"aw_later"` skips deferral. The resolver accepts both spellings, so the handler returns `deferred: true` after the authority decision is already consumed, and the post-execution check then throws. This breaks the invariant the spec now states (defer before any decision is consumed). <details> <summary>💡 Suggested fix</summary> Use the resolver's predicate here: strip surrounding quotes, then ap...

actions/setup/js/safe_output_handler_manager.cjs:1325

**[/codebase-design]** The digest covers `boundInputs.message`, but the handler still receives `preparedMessage`, a separate object. The contents match today, but the comment at line 1289 and the spec say the executor consumes the snapshot. Pass `boundInputs.message` so the authorized object is the executed object, keeping the code aligned with the documented invariant. @copilot please address this.

actions/setup/js/safe_output_handler_manager.cjs:1290

**[/diagnosing-bugs]** `structuredClone` is not a drop-in for the JSON round-trip it replaces. Dates stay `Date` objects, which `canonical()` rejects through its plain-prototype check, so the digest fails with `invalid_preparation`. Functions now throw `DataCloneError`, and that call sits outside the `try` at line 1314, so the failure bypasses that block's error handling. Use a JSON-compatible clone, or move this inside the `try` with an explicit `invalid_preparation` result. @copilot please ad...

actions/setup/js/safe_output_handler_manager_authorization.test.cjs:504

**[/tdd]** This case covers only lowercase `aw_later`. Add `it.each` rows for `AW_later` and `"aw_later"` asserting that `authorize` is not called and the result defers. These should fail on the current code, which gives the red step for the fix above. @copilot please address this.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.7K
Comment /matt to run again

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

Protected actions can still target the wrong resource because reused handlers retain stale resolutions and some consumers read the mutable live map rather than the bound snapshot.

3 open issues
What changed in this PR

This PR strengthens gh-aw’s safe-output authorization boundary by passing protected handlers the temporary-ID resolution snapshot used to compute input_digest.

Changes:

  • Creates a detached, deep-frozen authorization-input snapshot.
  • Adds remove_labels regressions for target resolution, mutation during authorization, deferral, denial, and staging.
  • Documents semantic consistency guarantees and assessment limits.
File Description
docs/​src/​content/​docs/​specs/​safe-outputs-specification.md Defines semantic consistency requirements and documents coverage limits.
actions/​setup/​js/​safe_output_handler_manager.cjs Builds the frozen input snapshot and passes its temporary-ID resolutions to handlers.
actions/​setup/​js/​safe_output_handler_manager_authorization.test.cjs Adds authorization-to-execution consistency regressions for remove_labels.

Review effort: Max (adaptive)

- Project inputs to plain JSON data before structuredClone so provider
  temporary-ID entries with methods or Dates stay digestable.
- Execute a writable copy of the bound message.
- Pass protected handlers a temporary-ID map view backed by the bound
  snapshot that writes new IDs through to the shared map.
- Refresh handler-local temporary-ID caches from each invocation.
- Update the semantic consistency spec paragraph.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copy link
Copy Markdown
Collaborator Author

Thanks to the review bots (comments 7035525351, 7035532741, 7035534177, 7035546730, 7035551780, 7035764109, 7035803848, 7035825846). Those are status and memory updates with no separate action items; the inline findings they raised (snapshot/executor consistency and the spec regression) are addressed in 5f3d8df.

pelikhan and others added 2 commits November 20, 2026 09:51
Add JSDoc types for the keymap, keyboard layout and nearest-pair search
so tsc -p tsconfig.cracktro.json passes again after #79486.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@pelikhan
pelikhan merged commit b24ad37 into main Nov 20, 2026
33 checks passed
@pelikhan
pelikhan deleted the pelikhan/automatic-robot branch November 20, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants