Skip to content

Commit af77762

Browse files
Validate request editors against delegated session transport
2 parents 41d1f49 + a1b704a commit af77762

5 files changed

Lines changed: 56 additions & 639 deletions

File tree

‎.github/scripts/codeql-cargo-cache.py‎

Lines changed: 0 additions & 294 deletions
This file was deleted.

‎.github/workflows/codeql.yml‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
timeout-minutes: ${{ matrix.language == 'rust' && 180 || 45 }}
2323
permissions:
2424
contents: read
25-
actions: read
2625
security-events: write
2726
strategy:
2827
fail-fast: false
@@ -40,47 +39,17 @@ jobs:
4039
rustup toolchain install 1.95.0 --profile minimal
4140
echo "RUSTUP_TOOLCHAIN=1.95.0" >> "$GITHUB_ENV"
4241
43-
- name: Select dedicated CodeQL Cargo directories
44-
if: matrix.language == 'rust'
45-
run: |
46-
echo "CARGO_HOME=$RUNNER_TEMP/agents-codeql-cargo" >> "$GITHUB_ENV"
47-
echo "CODEQL_EXTRACTOR_RUST_OPTION_CARGO_TARGET_DIR=$RUNNER_TEMP/agents-codeql-target" >> "$GITHUB_ENV"
48-
4942
- name: Prepare verified native sources for Rust analysis
5043
if: matrix.language == 'rust'
5144
run: make native-prepare
5245

5346
- name: Initialize CodeQL
54-
id: codeql
5547
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
5648
with:
5749
languages: ${{ matrix.language }}
5850
build-mode: none
5951

60-
- name: Restore verified CodeQL Cargo cache
61-
if: matrix.language == 'rust' && github.repository == 'openai/openai-agents-python'
62-
env:
63-
GH_TOKEN: ${{ github.token }}
64-
CODEQL_CLI_VERSION: ${{ steps.codeql.outputs.codeql-version }}
65-
run: python .github/scripts/codeql-cargo-cache.py restore
66-
6752
- name: Perform CodeQL analysis
6853
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
6954
with:
7055
category: /language:${{ matrix.language }}
71-
72-
- name: Pack CodeQL Cargo cache
73-
if: matrix.language == 'rust' && github.repository == 'openai/openai-agents-python' && github.event_name == 'push' && github.ref == 'refs/heads/feat/codex-harness'
74-
env:
75-
CODEQL_CLI_VERSION: ${{ steps.codeql.outputs.codeql-version }}
76-
run: python .github/scripts/codeql-cargo-cache.py pack
77-
78-
- name: Publish CodeQL Cargo cache
79-
if: matrix.language == 'rust' && github.repository == 'openai/openai-agents-python' && github.event_name == 'push' && github.ref == 'refs/heads/feat/codex-harness'
80-
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
81-
with:
82-
name: codeql-cargo-cache-Linux-X64
83-
path: ${{ runner.temp }}/codeql-cargo-publication/
84-
compression-level: 1
85-
retention-days: 7
86-
if-no-files-found: error

‎src/agents/agent.py‎

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -844,26 +844,22 @@ async def run(
844844
if prepare_request is not None:
845845
if not callable(prepare_request):
846846
raise TypeError("prepare_request must be callable")
847-
_check_output(_prepare_spec(self.output_type))
848-
effective_provider = self.provider if provider is None else provider
849-
if effective_provider is not None and not isinstance(
850-
effective_provider, NativeProvider
851-
):
852-
raise TypeError("provider must be a NativeProvider or None")
853-
_check_profile(
854-
self,
855-
websockets=True
856-
if effective_provider is None
857-
else effective_provider._websockets_enabled,
858-
environment=environment,
859-
)
860-
if (
861-
tools is None
862-
and before_step is None
863-
and state is None
864-
and getattr(self.session, "__func__", None) is Agent.session
865-
):
866-
_check_tools(self.tools)
847+
if getattr(self.session, "__func__", None) is Agent.session:
848+
_check_output(_prepare_spec(self.output_type))
849+
effective_provider = self.provider if provider is None else provider
850+
if effective_provider is not None and not isinstance(
851+
effective_provider, NativeProvider
852+
):
853+
raise TypeError("provider must be a NativeProvider or None")
854+
_check_profile(
855+
self,
856+
websockets=True
857+
if effective_provider is None
858+
else effective_provider._websockets_enabled,
859+
environment=environment,
860+
)
861+
if tools is None and before_step is None and state is None:
862+
_check_tools(self.tools)
867863
if on_interaction is not None and not callable(on_interaction):
868864
raise TypeError("on_interaction must be callable")
869865
if not isinstance(return_state, bool):

0 commit comments

Comments
 (0)