fix(core): close all cached websocket models when one close fails #8547
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| # All PRs, including stacked PRs | |
| permissions: | |
| contents: read | |
| env: | |
| UV_FROZEN: "1" | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| - name: Install dependencies | |
| if: steps.changes.outputs.run == 'true' | |
| run: make sync | |
| - name: Verify formatting | |
| if: steps.changes.outputs.run == 'true' | |
| run: make format-check | |
| - name: Run lint | |
| if: steps.changes.outputs.run == 'true' | |
| run: make lint | |
| - name: Skip lint | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping lint for non-code changes." | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 12 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| - name: Restore mypy cache | |
| if: steps.changes.outputs.run == 'true' | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: .mypy_cache | |
| key: mypy-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'Makefile') }}-${{ github.sha }} | |
| restore-keys: | | |
| mypy-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('uv.lock', 'pyproject.toml', 'Makefile') }}- | |
| - name: Install dependencies | |
| if: steps.changes.outputs.run == 'true' | |
| run: make sync | |
| - name: Run typecheck | |
| if: steps.changes.outputs.run == 'true' | |
| run: make typecheck | |
| - name: Skip typecheck | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping typecheck for non-code changes." | |
| tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - "3.10" | |
| - "3.11" | |
| - "3.12" | |
| - "3.13" | |
| - "3.14" | |
| env: | |
| OPENAI_API_KEY: fake-for-tests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| if: steps.changes.outputs.run == 'true' | |
| run: make sync | |
| - name: Run tests with coverage | |
| if: steps.changes.outputs.run == 'true' && matrix.python-version == '3.12' | |
| run: make coverage | |
| - name: Run tests | |
| if: steps.changes.outputs.run == 'true' && matrix.python-version != '3.12' | |
| run: make tests | |
| - name: Run async teardown stability tests | |
| if: steps.changes.outputs.run == 'true' && (matrix.python-version == '3.10' || matrix.python-version == '3.14') | |
| run: make tests-asyncio-stability | |
| - name: Skip tests | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping tests for non-code changes." | |
| mcp-v1-compat: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| env: | |
| OPENAI_API_KEY: fake-for-tests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| python-version: "3.12" | |
| - name: Run packaged MCP v1 compatibility tests | |
| if: steps.changes.outputs.run == 'true' | |
| run: make integration-tests-mcp-v1 | |
| - name: Skip MCP v1 compatibility tests | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping MCP v1 compatibility tests for non-code changes." | |
| packaged-contract: | |
| needs: prospective-release-contract | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - "3.10" | |
| - "3.14" | |
| env: | |
| OPENAI_AGENTS_INTEGRATION_PYTHON: ${{ matrix.python-version }} | |
| OPENAI_API_KEY: fake-for-tests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Download prospective release contract | |
| if: steps.changes.outputs.run == 'true' | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: prospective-release-contract | |
| path: .tmp | |
| - name: Run packaged and prospective compatibility contracts | |
| if: steps.changes.outputs.run == 'true' | |
| env: | |
| OPENAI_AGENTS_PROSPECTIVE_RELEASE_CONTRACT: ${{ github.workspace }}/.tmp/prospective_released_api_contract.json | |
| run: make integration-tests-prospective-contract | |
| - name: Skip packaged compatibility contracts | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping packaged compatibility contracts for non-code changes." | |
| packaged-contract-windows: | |
| needs: prospective-release-contract | |
| runs-on: windows-latest | |
| timeout-minutes: 15 | |
| env: | |
| OPENAI_AGENTS_INTEGRATION_PYTHON: "3.13" | |
| OPENAI_API_KEY: fake-for-tests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| shell: bash | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| python-version: "3.13" | |
| - name: Download prospective release contract | |
| if: steps.changes.outputs.run == 'true' | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: prospective-release-contract | |
| path: .tmp | |
| - name: Run Windows prospective contract smoke test | |
| if: steps.changes.outputs.run == 'true' | |
| env: | |
| OPENAI_AGENTS_PROSPECTIVE_RELEASE_CONTRACT: ${{ github.workspace }}/.tmp/prospective_released_api_contract.json | |
| run: uv run python .github/scripts/run_integration_tests.py --profile prospective-platform | |
| - name: Skip Windows prospective contract smoke test | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping Windows prospective contract smoke test for non-code changes." | |
| prospective-release-contract: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| env: | |
| OPENAI_AGENTS_INTEGRATION_PYTHON: "3.12" | |
| OPENAI_API_KEY: fake-for-tests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| python-version: "3.12" | |
| - name: Install all optional dependencies | |
| if: steps.changes.outputs.run == 'true' | |
| run: make sync | |
| - name: Validate source and generate prospective release contract | |
| if: steps.changes.outputs.run == 'true' | |
| run: make prepare-prospective-released-api-contract | |
| - name: Upload prospective release contract | |
| if: steps.changes.outputs.run == 'true' | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: prospective-release-contract | |
| path: .tmp/prospective_released_api_contract.json | |
| if-no-files-found: error | |
| include-hidden-files: true | |
| retention-days: 1 | |
| - name: Skip prospective release contract | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping prospective release contract for non-code changes." | |
| tests-windows: | |
| runs-on: windows-latest | |
| timeout-minutes: 10 | |
| env: | |
| OPENAI_API_KEY: fake-for-tests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect code changes | |
| id: changes | |
| shell: bash | |
| run: ./.github/scripts/detect-changes.sh code "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| python-version: "3.13" | |
| - name: Install dependencies | |
| if: steps.changes.outputs.run == 'true' | |
| run: uv sync --all-extras --all-packages --group dev | |
| - name: Run tests | |
| if: steps.changes.outputs.run == 'true' | |
| run: uv run pytest | |
| - name: Skip tests | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping tests for non-code changes." | |
| build-docs: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| env: | |
| OPENAI_API_KEY: fake-for-tests | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | |
| - name: Detect docs changes | |
| id: changes | |
| run: ./.github/scripts/detect-changes.sh docs "${{ github.event.pull_request.base.sha || github.event.before }}" "${{ github.sha }}" | |
| - name: Setup uv | |
| if: steps.changes.outputs.run == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # setup-uv v9.0.0; uv 0.11.14 | |
| with: | |
| version: "0.11.14" | |
| enable-cache: true | |
| prune-cache: true | |
| - name: Install dependencies | |
| if: steps.changes.outputs.run == 'true' | |
| run: make sync | |
| - name: Build docs | |
| if: steps.changes.outputs.run == 'true' | |
| run: make build-docs | |
| - name: Skip docs build | |
| if: steps.changes.outputs.run != 'true' | |
| run: echo "Skipping docs build for non-docs changes." |