fix: harden codex responses preflight and stream error handling - #4283
Closed
curtitoo wants to merge 2 commits into
Closed
fix: harden codex responses preflight and stream error handling#4283curtitoo wants to merge 2 commits into
curtitoo wants to merge 2 commits into
Conversation
Contributor
|
Merged via PR #4313 — your commits were cherry-picked onto current main with authorship preserved. Both fixes verified with live E2E testing against the Codex API. Thanks for the contribution! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This patch fixes two Codex Responses failure modes in
run_agent.py:toolsentirely when no tools are present in_preflight_codex_api_kwargs()_run_codex_stream()and fall back tocreate(stream=True)after retryProblem
Hermes had two Codex-specific failure paths:
tools=Nonecould be passed through the Codex Responses preflight pathhttpx.RemoteProtocolErrorfromresponses.stream()were not handled inside_run_codex_stream()That meant Codex stream failures could escape the inner recovery path instead of retrying/falling back cleanly.
Fix
toolsin normalized Codex kwargs whennormalized_tools is not None_run_codex_stream()create(stream=True)Verification
Added regression coverage in
tests/test_streaming.pyfor:httpx.RemoteProtocolErrorfallback behaviorLocal verification:
pytest -q tests/test_streaming.py20 passed