Skip to content

fix: stop native tool queues during function failure cleanup - #5446

Merged
jbeckwith-oai merged 2 commits into
mainfrom
fix/guardrail-native-cancellation
Oct 27, 2026
Merged

jbeckwith-oai merged 2 commits into
mainfrom
fix/guardrail-native-cancellation

Conversation

@jbeckwith-oai

@jbeckwith-oai jbeckwith-oai commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This pull request fixes queued native tools continuing to run while a selected function-tool failure drains completed output, including after a parallel input guardrail rejects the input.

Selecting a function failure now cancels active native categories and closes their invocation queues. Cleanup preserves the selected error, bounded finalization of completed outputs, genuine caller cancellation, existing approvals, and rejected-input history exclusion. Native error conversion also enters bounded cleanup when cancellation occurred before finalization started. Already-cancelled native tasks receive the existing finalization grace period, then another cancellation if they remain pending; caller cancellation bypasses this grace. Public APIs, configuration, and persisted state are unchanged.

Test plan

  • Added streaming and non-streaming regressions for queued native calls, input admission, converted and propagated cleanup errors, caller cancellation, and late finalization timeouts.
  • 226 focused tests passed.
  • Full verification wrapper passed: formatting, lint, mypy, Pyright, 12,321 parallel tests and 107 serial tests (36 skips across the two runs).
  • Local verification used a byte-identical source export under /tmp and a writable XDG_STATE_HOME. The original checkout path contains user, which collides with credential-redaction test fixtures; its default state directory is read-only. All 1,686 tracked files were compared by SHA-256 after verification. No test assertions or source files were changed for this environment adjustment.
  • Seven adversarial-review rounds with two independent fresh-context reviewers each, including two rounds for PR feedback. The final two rounds were clean; a subsequent runtime-neutral private typing.cast correction passed the repository type-erasure check and full verification.

Issue number

No public issue.

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

@jbeckwith-oai
jbeckwith-oai requested review from a team, rm-openai and seratch as code owners October 27, 2026 18:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T19:11:09.551989Z 54ba662 New commits
🔒 Security Review ✅ Completed 2026-10-27T19:11:49.682477Z 54ba662 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed8fa0e004

ℹ️ 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".

Comment thread src/agents/util/_asyncio_tasks.py Outdated
@jbeckwith-oai
jbeckwith-oai added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit cd26bbb Oct 27, 2026
27 checks passed
@jbeckwith-oai
jbeckwith-oai deleted the fix/guardrail-native-cancellation branch October 27, 2026 19:39
@openai-sdks openai-sdks Bot mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants