mirror of
https://github.com/openai/codex.git
synced 2026-04-30 17:36:40 +00:00
python-sdk: align pinned runtime bootstrap and drop sample image (2026-03-16)
- bump the repo-managed runtime bootstrap to rust-v0.116.0-alpha.1 so example and integration paths match the current SDK thread/start schema - make release artifact download more robust by retrying metadata lookups without stale auth and preferring deterministic release asset URLs - refresh generated Python artifacts and signature expectations so artifact drift tests pass on the current branch shape - replace the checked-in local image asset with a generated temporary PNG used by the examples and notebook local-image flow - add lightweight tests for pinned runtime doc drift and invalid-auth fallback in runtime metadata resolution Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -133,6 +133,24 @@ def _run_python(
|
||||
)
|
||||
|
||||
|
||||
def _runtime_compatibility_hint(
|
||||
runtime_env: PreparedRuntimeEnv,
|
||||
*,
|
||||
stdout: str,
|
||||
stderr: str,
|
||||
) -> str:
|
||||
combined = f"{stdout}\n{stderr}"
|
||||
if "ThreadStartResponse" in combined and "approvalsReviewer" in combined:
|
||||
return (
|
||||
"\nCompatibility hint:\n"
|
||||
f"Pinned runtime {runtime_env.runtime_version} returned a thread/start payload "
|
||||
"that is older than the current SDK schema and is missing "
|
||||
"`approvalsReviewer`. Bump `sdk/python/_runtime_setup.py` to a matching "
|
||||
"released runtime version.\n"
|
||||
)
|
||||
return ""
|
||||
|
||||
|
||||
def _run_json_python(
|
||||
runtime_env: PreparedRuntimeEnv,
|
||||
source: str,
|
||||
@@ -142,7 +160,10 @@ def _run_json_python(
|
||||
) -> dict[str, object]:
|
||||
result = _run_python(runtime_env, source, cwd=cwd, timeout_s=timeout_s)
|
||||
assert result.returncode == 0, (
|
||||
f"Python snippet failed.\nSTDOUT:\n{result.stdout}\nSTDERR:\n{result.stderr}"
|
||||
"Python snippet failed.\n"
|
||||
f"STDOUT:\n{result.stdout}\n"
|
||||
f"STDERR:\n{result.stderr}"
|
||||
f"{_runtime_compatibility_hint(runtime_env, stdout=result.stdout, stderr=result.stderr)}"
|
||||
)
|
||||
return json.loads(result.stdout)
|
||||
|
||||
@@ -389,6 +410,7 @@ def test_real_examples_run_and_assert(
|
||||
f"Example failed: {folder}/{script}\n"
|
||||
f"STDOUT:\n{result.stdout}\n"
|
||||
f"STDERR:\n{result.stderr}"
|
||||
f"{_runtime_compatibility_hint(runtime_env, stdout=result.stdout, stderr=result.stderr)}"
|
||||
)
|
||||
|
||||
out = result.stdout
|
||||
|
||||
Reference in New Issue
Block a user