Skip to content

fix(models): close all MultiProvider children after failures - #4438

Merged
seratch merged 1 commit into
openai:mainfrom
fszcd:fix/multiprovider-close-all-children
Aug 15, 2026
Merged

seratch merged 1 commit into
openai:mainfrom
fszcd:fix/multiprovider-close-all-children

Conversation

@fszcd

@fszcd fszcd commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This pull request fixes MultiProvider.aclose() so one child provider's ordinary cleanup failure does not prevent later child providers from releasing their resources.

  • Closes unique child providers in the existing stable order and preserves identity deduplication.
  • Re-raises the exact first ordinary exception after the remaining close attempts finish.
  • Continues to propagate direct asyncio.CancelledError immediately.
  • Adds regressions for multiple ordinary failures and cancellation after an earlier failure.

Test plan

Passed:

  • uv run pytest -q tests/models/test_map.py (17 passed)
  • uv run pytest -q tests/models/test_responses_websocket_session.py (11 passed)
  • uv run ruff check
  • uv run python .github/scripts/check_optional_truthiness.py src/agents
  • uv run ruff format and uv run ruff check --fix (900 files unchanged)
  • uv run mypy src/agents/models/multi_provider.py

The full Windows test run reached 7,208 passed and 77 skipped, with remaining failures caused by local platform prerequisites unrelated to this change: the Unix tee command is unavailable, symlink creation is not permitted, two UTF-8 examples are decoded with the system GBK code page, and existing realtime Windows tests fail. Full mypy/pyright also report existing errors in untouched sandbox modules; pyright's only error is src/agents/sandbox/util/tar_utils.py:161.

Issue number

N/A

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

@seratch seratch added this to the 0.21.x milestone Aug 15, 2026
@seratch
seratch merged commit 7ab35c3 into openai:main Aug 15, 2026
14 checks passed
@fszcd
fszcd deleted the fix/multiprovider-close-all-children branch September 16, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants