Skip to content

Complete turn abort callbacks before emitting terminal events - #49475

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/f34d7e94d04c02544178dc445b85abc65a6ce499
Sep 30, 2026
Merged

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

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Complete turn abort callbacks before emitting terminal events

Why

TurnAborted could be emitted before extension abort callbacks finished, allowing consumers to observe a terminal event while lifecycle cleanup was still pending.

What changed

Await on_turn_abort within task abort handling before emitting TurnAborted, retaining callback delivery for already-cancelled tasks. Document that on_turn_stop and on_turn_abort complete before their corresponding terminal events, if emitted.

Testing

Add regression coverage for interrupt, conditional interrupt, and shutdown. Hold the abort callback open to verify that TurnAborted waits for completion, then verify that the callback runs exactly once with the expected turn ID and abort reason.

## Why

`TurnAborted` could be emitted before extension abort callbacks finished, allowing consumers to observe a terminal event while lifecycle cleanup was still pending.

## What changed

Await `on_turn_abort` within task abort handling before emitting `TurnAborted`, retaining callback delivery for already-cancelled tasks. Document that `on_turn_stop` and `on_turn_abort` complete before their corresponding terminal events, if emitted.

## Testing

Add regression coverage for interrupt, conditional interrupt, and shutdown. Hold the abort callback open to verify that `TurnAborted` waits for completion, then verify that the callback runs exactly once with the expected turn ID and abort reason.

GitOrigin-RevId: f34d7e94d04c02544178dc445b85abc65a6ce499
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/f34d7e94d04c02544178dc445b85abc65a6ce499 branch from 9dd6fbd to 9ef9cb1 Compare September 30, 2026 03:45
@copyberry
copyberry Bot merged commit 9ef9cb1 into main Sep 30, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/f34d7e94d04c02544178dc445b85abc65a6ce499 branch September 30, 2026 03:45
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 30, 2026

This branch was successfully deployed

1 active deployment
issue-triage — 9ef9cb1d Deployed Sep 30, 2026 by ChubbyFungus via Generate label suggestions #49980
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.

3 participants