1- name : Check the managed local command in the Python wheel
1+ name : Qualify the final Python SDK wheel on macOS
22on :
33 push :
44 branches : [test/managed-macos-command-qualification-20261104]
@@ -9,9 +9,9 @@ permissions:
99
1010jobs :
1111 build :
12- name : Build and test the exact Python SDK package
12+ name : Qualify final Python SDK wheel and tests
1313 runs-on : macos-latest
14- timeout-minutes : 120
14+ timeout-minutes : 180
1515 defaults :
1616 run :
1717 shell : bash
@@ -24,12 +24,12 @@ jobs:
2424 steps :
2525 - uses : actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803
2626 with :
27- ref : 902b813d72a79ab325defa61c6c77fd1a90b1a94
27+ ref : 2c3046ca903a513548c847b6a85f16c365efd750
2828 persist-credentials : false
2929 - name : Verify exact SDK checkout
3030 run : |
31- test "$(git rev-parse HEAD)" = '902b813d72a79ab325defa61c6c77fd1a90b1a94 '
32- test "$(git rev-parse HEAD^{tree})" = 'f2d7539c176cc795ae826b531dfd40fc8cdb3863 '
31+ test "$(git rev-parse HEAD)" = '2c3046ca903a513548c847b6a85f16c365efd750 '
32+ test "$(git rev-parse HEAD^{tree})" = '88d2ef6d320399e0f9d11994a21ad4dbb398ecd3 '
3333 git show -s --format='%H %T %s' HEAD
3434 - name : Select shared Cargo directories
3535 run : |
@@ -156,39 +156,102 @@ jobs:
156156 PYTHON
157157 - name : Build the SDK and native runtime together
158158 run : uv build --wheel "$OPENAI_AGENTS_BUILD_SOURCE" --out-dir "$GITHUB_WORKSPACE/dist"
159- - name : Run public local Session tests against the installed wheel
159+ - name : Build the shared test executor
160+ if : steps.native-source.outputs.run_id == ''
161+ run : |
162+ python - <<'PYTHON'
163+ import os
164+ import shutil
165+ import subprocess
166+ import sys
167+ from pathlib import Path
168+ root = Path(os.environ["OPENAI_AGENTS_BUILD_SOURCE"]) / "packages/codex"
169+ fixture = Path("tests/fixtures/exec_server.rs")
170+ (root / fixture).parent.mkdir(parents=True, exist_ok=True)
171+ shutil.copy2(Path("packages/codex") / fixture, root / fixture)
172+ sys.path.insert(0, str(root / "scripts"))
173+ from native_env import build_environment, cargo_build_options
174+ environment = build_environment(root)
175+ options, build_target = cargo_build_options(root, environment)
176+ subprocess.run(["cargo", "build", "--release", "--locked", "--timings", *options, "--example", "exec-server-fixture"], cwd=root, env=environment, check=True)
177+ target = Path(environment["CARGO_TARGET_DIR"])
178+ if not target.is_absolute():
179+ target = root / target
180+ if build_target:
181+ target /= Path(build_target).stem
182+ name = "exec-server-fixture" + (".exe" if os.name == "nt" else "")
183+ shutil.copy2(target / "release" / "examples" / name, Path("dist") / name)
184+ PYTHON
185+ - name : Test native macOS Unix socket policy with the installed wheel
186+ if : runner.os == 'macOS'
187+ run : |
188+ stage=$(mktemp -d "$RUNNER_TEMP/macos-ipc.XXXXXX")
189+ mkdir -p "$stage/tests/qualification" "$stage/home"
190+ cp tests/{__init__,_asyncio,native_executor_fixtures,native_fixtures}.py "$stage/tests"
191+ cp tests/qualification/{macos_ipc,offline_ipc,unix_socket_command}.py "$stage/tests/qualification"
192+ uv venv --seed --python "$(command -v python)" "$stage/venv"
193+ uv export --frozen --group dev --no-emit-workspace --no-hashes \
194+ --format requirements.txt --output-file "$stage/constraints.txt" > /dev/null
195+ python="$stage/venv/bin/python"
196+ "$python" -m pip install --constraint "$stage/constraints.txt" dist/*.whl aiohttp pytest pytest-asyncio
197+ fixture="$GITHUB_WORKSPACE/dist/exec-server-fixture"
198+ chmod +x "$fixture"
199+ cd "$stage"
200+ env -i PATH=/usr/bin:/bin HOME="$stage/home" SHELL=/bin/sh \
201+ "$python" -I -B -u -c 'import os,runpy,sys; sys.path.insert(0,os.getcwd()); runpy.run_module("tests.qualification.macos_ipc",run_name="__main__")' "$fixture"
202+ - name : Run SDK acceptance with the installed wheel
160203 env :
161204 OPENAI_API_KEY : fake-for-tests
205+ CODEX_EXEC_SERVER_TEST_BINARY : ${{ github.workspace }}/dist/exec-server-fixture
206+ RUST_MIN_STACK : ' 16777216'
162207 run : |
163208 set -eu
164209 sw_vers
165210 uv sync --frozen --group dev --no-install-project
166211 uv pip install --python .venv/bin/python --no-deps dist/*.whl
167- .venv/bin/python -I -B - "$RUNNER_TEMP/local-session.xml" <<'PYTEST'
168- import os, pathlib, platform, sys, sysconfig
169- import agents._native, pytest
170- assert sys.platform == "darwin" and platform.machine() == "arm64"
171- assert pathlib.Path(agents._native.__file__).resolve().is_relative_to(pathlib.Path(sysconfig.get_path("platlib")).resolve())
212+ env -u PYTHONPATH -u OPENAI_AGENTS_TEST_IN_CODEX_SANDBOX .venv/bin/python -I -B - "$RUNNER_TEMP/local-session.xml" <<'PYTEST'
213+ import hashlib, os, pathlib, platform, sys, sysconfig, xml.etree.ElementTree as ET
214+ import agents._native, agents.session, pytest
215+ assert sys.platform == 'darwin' and platform.machine() == 'arm64'
216+ installed = pathlib.Path(sysconfig.get_path('platlib')).resolve()
217+ for module in (agents, agents._native, agents.session):
218+ assert pathlib.Path(module.__file__).resolve().is_relative_to(installed), module.__file__
219+ assert hashlib.sha256(pathlib.Path(agents.session.__file__).read_bytes()).hexdigest() == '69954f1f52e07e323fd99d7354c044a2d566c5d1decec48c98a867e2eaed3797'
172220 sys.path.insert(0, os.getcwd())
173- sys.exit(pytest.main(["-q", "-rA", "tests/test_native_executor_local.py", "--junitxml="+sys.argv[1]]))
221+ junit = sys.argv[1]
222+ status = pytest.main([
223+ '-q', '-rA', '--junitxml=' + junit,
224+ 'tests/test_native_executor_local.py',
225+ 'tests/test_native_yielded_executor_owner.py',
226+ 'tests/test_native_executor_policies.py::test_force_stop_fences_sampling_before_executor_result_settles',
227+ 'tests/test_supervised_worker_example.py::test_two_workers_revise_reconnect_recover_and_publish_once',
228+ ])
229+ if status:
230+ sys.exit(status)
231+ required = {
232+ 'test_macos_session_close_stops_child_after_command_exit',
233+ 'test_macos_local_command_cannot_delegate_execution_to_launchd',
234+ 'test_local_write_root_replacement_survives_portable_resume',
235+ 'test_turn_write_policy_and_reopen_checks_the_applied_policy',
236+ 'test_two_workers_revise_reconnect_recover_and_publish_once',
237+ }
238+ required.update(
239+ f'test_force_stop_fences_sampling_before_executor_result_settles[{case}]'
240+ for case in ('turn-False', 'turn-True', 'continuation-False', 'graph-False', 'close-False')
241+ )
242+ passed = {
243+ case.attrib['name'] for case in ET.parse(junit).findall('.//testcase')
244+ if all(case.find(tag) is None for tag in ('skipped', 'failure', 'error'))
245+ }
246+ assert required <= passed, sorted(required - passed)
247+ print('Verified installed-wheel cases:', sorted(required))
174248 PYTEST
175- python3 - "$RUNNER_TEMP/local-session.xml" <<'VERIFY'
176- import sys
177- import xml.etree.ElementTree as ET
178- cases = ET.parse(sys.argv[1]).findall(".//testcase")
179- required = {"test_macos_session_close_stops_child_after_command_exit",
180- "test_local_write_root_replacement_survives_portable_resume",
181- "test_turn_write_policy_and_reopen_checks_the_applied_policy"}
182- passed = {c.get("name","").split("[")[0] for c in cases if all(c.find(tag) is None for tag in ("skipped","failure","error"))}
183- assert required <= passed, sorted(required-passed)
184- print("Verified installed-wheel cases:", sorted(required))
185- VERIFY
186249 - uses : actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
187250 with :
188- name : verified-managed-local- python-wheel
251+ name : verified-final- python-wheel-macos
189252 path : |
190253 dist/*.whl
191- dist/*.json
254+ dist/*.pristine. json
192255 ${{ runner.temp }}/local-session.xml
193256 if-no-files-found : error
194257 retention-days : 7
0 commit comments