Skip to content

Complete dynamic tool lifecycles on cancellation - #51556

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/0112fc74c8652c91503ed5bbfb334ae2e26930ef
Oct 7, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/0112fc74c8652c91503ed5bbfb334ae2e26930ef

Conversation

@copyberry

@copyberry copyberry Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Complete dynamic tool lifecycles on cancellation

Why

Interrupting a turn or terminating a Code Mode cell can drop a pending dynamic tool handler before it publishes its completion. Cancellation needs to settle the call in live events and persisted history without allowing a late response into model context.

What changed

  • Let dynamic tool handlers observe cancellation and publish their terminal item before dispatch finishes. Calls cancelled while awaiting a response complete with a failed item and a cancellation error.
  • Keep readiness, dispatch admission, registry lock waits, hooks, and output processing cancellable so cancellation can finish even when a hook is blocked.
  • Report an aborted tool lifecycle outcome when cancellation interrupts dispatch, including before handler execution.

Testing

Add regression tests for turn interruption with pending calls or blocked hooks, cell termination with persisted failure and late-response exclusion, cancellation before dispatch admission, and exactly one completion when a response races cancellation.

## Why

Interrupting a turn or terminating a Code Mode cell can drop a pending dynamic tool handler before it publishes its completion. Cancellation needs to settle the call in live events and persisted history without allowing a late response into model context.

## What changed

- Let dynamic tool handlers observe cancellation and publish their terminal item before dispatch finishes. Calls cancelled while awaiting a response complete with a failed item and a cancellation error.
- Keep readiness, dispatch admission, registry lock waits, hooks, and output processing cancellable so cancellation can finish even when a hook is blocked.
- Report an aborted tool lifecycle outcome when cancellation interrupts dispatch, including before handler execution.

## Testing

Add regression tests for turn interruption with pending calls or blocked hooks, cell termination with persisted failure and late-response exclusion, cancellation before dispatch admission, and exactly one completion when a response races cancellation.

GitOrigin-RevId: 0112fc74c8652c91503ed5bbfb334ae2e26930ef
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/0112fc74c8652c91503ed5bbfb334ae2e26930ef branch from 6759117 to 18e28fe Compare October 7, 2026 03:08
@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-07T03:08:02.484437Z 6759117 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@copyberry
copyberry Bot merged commit 18e28fe into main Oct 7, 2026
1 check failed
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/0112fc74c8652c91503ed5bbfb334ae2e26930ef branch October 7, 2026 03:08
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 7, 2026
@warm-july
warm-july deployed to issue-triage October 7, 2026 03:11 — with Image GitHub Actions Active
@warm-july
warm-july deployed to issue-triage October 7, 2026 03:11 — with Image GitHub Actions Active
@warm-july
warm-july deployed to issue-triage October 7, 2026 03:11 — with Image GitHub Actions Active
@warm-july
warm-july deployed to issue-triage October 7, 2026 03:12 — with Image GitHub Actions Active
@CharGrnmn
CharGrnmn deployed to issue-triage October 7, 2026 03:33 — with Image GitHub Actions Active
@CharGrnmn
CharGrnmn deployed to issue-triage October 7, 2026 03:33 — with Image GitHub Actions Active
@CharGrnmn
CharGrnmn deployed to issue-triage October 7, 2026 03:33 — with Image GitHub Actions Active
@CharGrnmn
CharGrnmn deployed to issue-triage October 7, 2026 03:34 — with Image GitHub Actions Active
@zackciou
zackciou deployed to issue-triage October 7, 2026 03:36 — with Image GitHub Actions Active
@zackciou
zackciou deployed to issue-triage October 7, 2026 03:36 — with Image GitHub Actions Active
@zackciou
zackciou deployed to issue-triage October 7, 2026 03:36 — with Image GitHub Actions Active
@ChengYJ818
ChengYJ818 deployed to issue-triage October 7, 2026 03:40 — with Image GitHub Actions Active
@ChengYJ818
ChengYJ818 deployed to issue-triage October 7, 2026 03:40 — with Image GitHub Actions Active
@ChengYJ818
ChengYJ818 deployed to issue-triage October 7, 2026 03:40 — with Image GitHub Actions Active
@FaceWaller
FaceWaller deployed to issue-triage October 7, 2026 03:55 — with Image GitHub Actions Active
@BhanuVikram
BhanuVikram deployed to issue-triage October 7, 2026 04:04 — with Image GitHub Actions Active
@BhanuVikram
BhanuVikram deployed to issue-triage October 7, 2026 04:04 — with Image GitHub Actions Active
@BhanuVikram
BhanuVikram deployed to issue-triage October 7, 2026 04:04 — with Image GitHub Actions Active
@BhanuVikram
BhanuVikram deployed to issue-triage October 7, 2026 04:05 — with Image GitHub Actions Active
@Edogg608
Edogg608 deployed to issue-triage October 7, 2026 04:05 — with Image GitHub Actions Active
@Edogg608
Edogg608 deployed to issue-triage October 7, 2026 04:05 — with Image GitHub Actions Active
@Edogg608
Edogg608 deployed to issue-triage October 7, 2026 04:05 — with Image GitHub Actions Active
@Edogg608
Edogg608 deployed to issue-triage October 7, 2026 04:06 — with Image GitHub Actions Active
@FelixToday
FelixToday deployed to issue-triage October 7, 2026 04:16 — with Image GitHub Actions Active
@FelixToday
FelixToday deployed to issue-triage October 7, 2026 04:16 — with Image GitHub Actions Active
@FelixToday
FelixToday deployed to issue-triage October 7, 2026 04:16 — with Image GitHub Actions Active
@grtninja
grtninja deployed to issue-triage October 7, 2026 04:17 — with Image GitHub Actions Active
@grtninja
grtninja deployed to issue-triage October 7, 2026 04:17 — with Image GitHub Actions Active
@grtninja
grtninja deployed to issue-triage October 7, 2026 04:17 — with Image GitHub Actions Active
@Xirubah
Xirubah deployed to issue-triage October 7, 2026 04:18 — with Image GitHub Actions Active
@Xirubah
Xirubah deployed to issue-triage October 7, 2026 04:18 — with Image GitHub Actions Active
@Xirubah
Xirubah deployed to issue-triage October 7, 2026 04:18 — with Image GitHub Actions Active
@grtninja
grtninja deployed to issue-triage October 7, 2026 04:18 — with Image GitHub Actions Active
@dean1012
dean1012 deployed to issue-triage October 7, 2026 04:23 — with Image GitHub Actions Active
@dean1012
dean1012 deployed to issue-triage October 7, 2026 04:23 — with Image GitHub Actions Active

This branch was successfully deployed

1 active deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.