fix: exclude null acknowledged_safety_checks from GA ComputerCallOutput#2742
fix: exclude null acknowledged_safety_checks from GA ComputerCallOutput#2742guoyangzhen wants to merge 1 commit intoopenai:mainfrom
Conversation
seratch
left a comment
There was a problem hiding this comment.
@guoyangzhen I've verified your fix works for the runtime behavior correction. The type checker is claiming some errors, so can you quickly fix it? You can run make typecheck to verify if it's fixed. With that, this is good to go.
Run make typecheck
Running make mypy and make pyright in parallel...
make[1]: Entering directory '/home/runner/work/openai-agents-python/openai-agents-python'
uv run pyright --project pyrightconfig.json
make[1]: Entering directory '/home/runner/work/openai-agents-python/openai-agents-python'
uv run mypy . --exclude site
0 errors, 0 warnings, 0 informations
make[1]: Leaving directory '/home/runner/work/openai-agents-python/openai-agents-python'
src/agents/run_internal/tool_actions.py:173: error: Missing keys ("call_id", "output", "type") for TypedDict "ComputerCallOutput" [typeddict-item]
src/agents/run_internal/tool_actions.py:175: error: Missing keys ("call_id", "output", "type") for TypedDict "ComputerCallOutput" [typeddict-item]
Found 2 errors in 1 file (checked 500 source files)
make[1]: *** [Makefile:20: mypy] Error 1
make[1]: Leaving directory '/home/runner/work/openai-agents-python/openai-agents-python'
make: *** [Makefile:28: typecheck] Error 2
Error: Process completed with exit code 2.
|
Thanks for sending this patch. This is definitely a breaking change on the server-side, so I've escalated the issue to the relevant team. The server-side fix should come soon. So, let's hold off bypassing the type issue just for the workaround for now. |
|
@seratch Thanks for the review. I understand — if the server-side fix is coming, it makes sense to wait rather than work around the type checker. Let me know when it's appropriate to revisit; happy to update the PR once the server-side changes land. |
|
Thanks for the update! I'll keep this PR as a draft until the server-side fix lands. If the server-side fix resolves the issue completely, I'll close this PR. Let me know if you'd like me to adjust the approach in the meantime. |
Problem
When using the GA
computertool withgpt-5.4, the SDK serializesacknowledged_safety_checks: nullinComputerCallOutputwhen there are no pending safety checks. The GA computer endpoint rejects this:Root Cause
In
ComputerAction.execute(),acknowledged_safety_checksdefaults toNone. For GA requests without pending safety checks, it staysNoneand is passed directly toComputerCallOutput. Pydantic serializesNoneas"acknowledged_safety_checks": null, which the GA endpoint rejects.Fix
Only include
acknowledged_safety_checksin theComputerCallOutputwhen it is notNone, using a conditional spread:This omits the field entirely when there are no safety checks to acknowledge, avoiding the 400 error.
Testing
acknowledged_safety_checksisNone, the field is excluded from the dictacknowledged_safety_checkshas values, it is included as beforeFixes #2741