fix: preserve streamed cancellation and pending guardrail cleanup - #5224
Conversation
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 211fe74d44
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
markstuart-oai
left a comment
There was a problem hiding this comment.
Reviewed the full diff at 846e167. The terminal waits now distinguish consumer cancellation from child cancellation, preserve guardrail cancellation before output persistence, and reach the existing registered cleanup owners. The event-gated regressions cover the intended lifecycle boundaries. No actionable correctness or structural findings within the stated scope; interruption of cleanup already in progress remains outside this fix.
Validation: pinned-source review and all 22 successful checks on this commit, including Windows and native macOS sandbox coverage. I did not run tests locally.
|
@jbeckwith-oai, thanks for landing the fix. The If our reproduction informed that coverage or scope, could you add a short acknowledgment of @gomission in the PR description, linked to that comment? The attribution would be for the additional reproduction and boundary check; @hsusul supplied the original report and proposed fix, and you implemented and landed the merged change. |
This pull request fixes consumer cancellation being swallowed while
stream_events()waits for a pending input guardrail or run-loop finalization. It also prevents cancellation of a pending parallel input guardrail from skipping computer disposal and trace/span completion.Terminal waits distinguish consumer cancellation from child cancellation, settle the cancelled child, and await registered provider/sandbox cleanup before propagating cancellation. The guardrail-verdict helper tolerates cancelled children only during final cleanup, preserving cancellation before turn-output persistence. Explicit
result.cancel()behavior and existing late-error handling remain intact.Five event-gated regressions exercise the public runner's terminal waits, disposal, trace closure, registered cleanup, and session persistence. Cancellation during already-running asynchronous cleanup and repeated cancellation remain separate work; this change does not guarantee that interrupted cleanup completes.
Test plan
Issue number
Closes #5213
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PRThe implementation-final-review workflow completed with two independent clean reviews; the separate
/reviewcommand was not invoked.