fix(codex): classify content-filter incomplete responses as terminal refusals - #65061
Merged
Conversation
Map Codex Responses status=incomplete with incomplete_details.reason=content_filter to finish_reason=content_filter so the existing refusal/fallback path runs instead of burning incomplete continuation attempts.
This was referenced Jul 15, 2026
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
Codex Responses content-filter refusals (
status="incomplete"+incomplete_details.reason="content_filter", typically withoutput=[]) are now classified as terminalfinish_reason="content_filter"and routed through the existing content-policy refusal path — instead of falling into invalid-response retries plus 3 continuation attempts that end in the misleading "Codex response remained incomplete after 3 continuation attempts".Salvages #55639 (@sk-holmes, fixes #55637) with authorship preserved. Chosen over duplicates #55682 (loop-only — misses the empty-output validation gap, so the refusal dies in invalid-response retries before its branch runs) and #55718 (adapter-only + unrelated STT change); @sk-holmes's was both first-submitted and the only one covering all three layers.
Changes (@sk-holmes)
agent/transports/codex.py:validate_responseaccepts the empty-output content-filter shape as a valid terminal response so it reaches normalization; empty-output non-filter responses still fail validationagent/codex_responses_adapter.py: the refusal outranks every other finish reason; empty-output refusals synthesize an empty message instead of raising "no output items"agent/conversation_loop.py: the codex_responses status check maps the refusal tofinish_reason="content_filter"(case-normalized), joining the existing refusal handling (ContentPolicyBlocked, provider fallback)Validation
output=[]content_filter, refusal path + fallbackcontent_filter(refusal outranks)output=[]scripts/run_tests.shon adapter + transport + run_agent + codex_responses suites: 625/625 passed on current main (post-fix(codex): trust response.status for reasoning-only turns on unrecognized Responses backends #64764/fix(codex): rescue reasoning-only turns from the 3-attempt continuation death loop #64768)incomplete_detailsverifiedInfographic