Repository navigation
Preserve cancellation when a synchronous tool raises - #6374
Merged
Merged
Conversation
markstuart-oai
requested review from
a team,
rm-openai and
seratch
as code owners
December 2, 2026 19:31
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
jbeckwith-oai
approved these changes
Dec 2, 2026
jbeckwith-oai
left a comment
Contributor
There was a problem hiding this comment.
Comprehensive static review including independent review. Checked repeated cancellation, late worker success and failure, exception-context handling, async handler dispatch, and unchanged storage and approval behavior. No actionable findings. Hosted CI observed: {"success": 19, "skipped": 2, "in_progress": 1}. No candidate code or local tests were executed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This pull request fixes a case where a cancelled
@function_toolhandler raised the worker's exception instead ofCancelledError. This happened when a caller awaitedtool.handler(...)directly and the synchronous function failed after cancellation.The handler still waits for the worker to finish. Cancellation now takes precedence over a late tool failure. Uncancelled calls and the storage and approval paths keep their existing error handling.
Test plan
All 60 focused tests passed. The new cases cover repeated cancellation, late success and failure, and an uncancelled exception. I also checked cancellation in normal agent turns and approval callbacks.
Formatting, lint, and type checks passed. The test suite passed 296 tests in the local sandbox. Five tests that start their own sandbox failed there. All five passed when I ran them separately on Linux.
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR