GeezerVison is showing github.com — Restore GITHUB_OUTPUT when the session ends by mhegazy · Pull Request #2121 · anthropics/claude-code-action
Conversation
mhegazy
commented
Nov 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
When a session left an unfinished multi-line value in GITHUB_OUTPUT, the runner could not read the outputs the action wrote after it, so the "Revoke app token" step was skipped. The action now restores GITHUB_OUTPUT when the session ends, as it already does for GITHUB_ENV. Follow-up to #2112.
- The whole file is restored rather than only the unfinished value removed. The action passes on only outputs with its own names, so a value the session wrote under another name never reached a later step. Behavior change: a session that wrote one of those names itself, such as
structured_output without --json-schema, no longer passes it on.
- The file is also restored if the session changed its mode or owner, because the action's own writes would fail then. Restored files get their old mode and owner back.
GITHUB_STEP_SUMMARY still keeps what the session wrote.
- The cancel path no longer needs its own option for dropping outputs.
docs/security.md and a warning in the log now say to pass results on with --json-schema.
Not covered: a session that makes the file's directory read-only, and a process the session left running that writes to the file, or recreates it during the restore.
Test plan
- Ran the step with a real CLI against a local API. With an unfinished output, with a read-only output file, and on a cancel,
GITHUB_OUTPUT held only the action's own outputs, github_token included. As root with umask 077, the restored file kept its mode and owner.
- Repeated those three runs after merging main.
bun test, bun run typecheck and bun run format:check pass.
- Not tried on a hosted runner, Windows or macOS.
Generated by Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
An output that a session left unfinished kept the runner from reading the action's
own outputs after it, so the app token wasn't revoked.
Co-authored-by: mhegazy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.
Beyond the inline findings, I also checked whether restoring GITHUB_OUTPUT can drop the action's own outputs. It does not on the paths I read: github_token, skipped_due_to_workflow_validation_mismatch and the comment id from create-initial.ts are written before the snapshot at run.ts:458, and nothing under runClaude calls core.setOutput before the restore at run.ts:475.
No caller still passes the removed cancelled option (run.ts is the only non-test caller), and base-action/src/index.ts does not use the guard, so the standalone base action is unaffected.
Extended reasoning...
The change touches the session guard that restores files later steps trust (src/github/operations/session-guard.ts), its call sites in src/entrypoints/run.ts, the security doc and the guard's tests. That is security-sensitive code, because app token revocation depends on the outputs it protects, and three findings are posted inline, so this is not an approval. The note records only the additional output-loss and caller checks, which were made by reading the code; no tests were run in this review.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…-ovdqki
Co-authored-by: mhegazy <[email protected]>
# Conflicts:
# docs/security.md
# src/entrypoints/run.ts
The warning now points to --json-schema for passing results on.
Co-authored-by: mhegazy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the commits pushed since my last review and found no new bugs. Because this changes the session guard that the app-token revocation step depends on, a human look is still worthwhile.
What was reviewed:
- The new warning in
src/github/operations/session-guard.ts:311-315: it fires only when the session itself changed GITHUB_OUTPUT, and it now points to --json-schema, as the structured_output thread asked.
- Whether restoring the whole file can drop the action's own outputs: in
src/entrypoints/run.ts nothing writes an output between the snapshot at :482 and the restore at :500, and the cancel handlers write theirs after the restore.
- The pre-existing symlink case: the link is kept and its target gets the saved content back.
- The restore sequence itself (
rmSync, then the wx create) is the same as in the version I reviewed before. I read the code only and did not run the tests.
Extended reasoning...
The diff touches four files (+154/-65): the session guard, its call sites in run.ts, the security doc and the guard's tests. The surface is security-sensitive, since the guard decides what a session can leave in GITHUB_OUTPUT and the "Revoke app token" step reads its inputs from that file. This run reported no findings, and the only code change since the previous review is an added warning plus one test assertion. Approval is not appropriate for a change to this path, and the earlier inline threads were resolved by the PR author only, which is not independent confirmation. No CODEOWNERS or OWNERS file was found in the checkout.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
poteat
poteat approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|