litellm/tests/e2e/codex
ryan-crabbe-berri 4e1cd40ac5
fix(responses): answer Codex compaction_trigger on the chat-completions bridge (#53266)
* fix(responses): answer Codex compaction_trigger on the chat-completions bridge

Codex's remote compaction v2 ends the Responses input with a compaction_trigger
item and expects exactly one compaction output item back. The Responses to chat
completions bridge dropped the trigger as a content-less item, so Claude on
Bedrock (and every other bridged provider) answered a normal turn and Codex
failed with "expected exactly one compaction output item, got 0".

When the input ends in a compaction_trigger, the bridge handler now swaps it
for the gateway's existing compact summary prompt in the same upstream call and
returns the reply as one summary-only compaction item, streamed or not. That
item is the shape the bridge already replays as a summary on later turns. Text
and tool calls from the summary turn stay out of the output, and a reply with no
summary is a 502 so the client retries. Requests without a trailing trigger are
unchanged.

The strict claude_bedrock xfail on the Codex auto-compaction e2e row is removed.

* fix(responses): let a compaction summary turn write text when the caller forces a tool

A forced tool_choice on a request ending in compaction_trigger made the model
call a tool instead of writing the summary, so every retry came back as a 502.
The summary turn now relaxes a forced choice to auto and keeps the tools.

* fix(responses): bill, scan and parse compaction summaries safely

Three gaps around the summary a compaction_trigger turn returns.

A client that disconnected mid-summary was billed no output tokens, because
the bridge saved each streamed chunk after hiding its summary text. It now
saves the chunk as received and hides the text only from what the client sees.

Purview's output scan read message text and tool arguments but not the summary
inside a compaction item, so a summary went out unscanned. It now reads it
through the same reader the shared Responses guardrails use.

The summary-tag parse used a pattern that took seconds on a reply full of
unclosed tags. It now finds the tags with two linear searches, which also
covers the /v1/messages compaction editor that shares it.

* refactor(responses): drop a comment that restates the compaction 502

* test(responses): expect the mid-stream error a dropped summary stream raises
2026-11-21 14:53:31 -08:00
..
__init__.py
conftest.py test(e2e): run codex in fast mode under the real model name (#49899) 2026-11-21 03:10:15 +00:00
harness.py test(e2e): run codex in fast mode under the real model name (#49899) 2026-11-21 03:10:15 +00:00
mcp_server.py test(e2e): add a Codex row that calls a local MCP tool on a first and a resumed turn (#49817) 2026-11-06 03:59:03 +00:00
rollout.py test(e2e): add a Codex row where a sub-agent must read the task its parent hands it (#50494) 2026-11-07 21:16:39 +00:00
run.py test(e2e): add a Codex row that calls a local MCP tool on a first and a resumed turn (#49817) 2026-11-06 03:59:03 +00:00
setups.py test(e2e): run codex in fast mode under the real model name (#49899) 2026-11-21 03:10:15 +00:00
test_auto_compaction_e2e.py fix(responses): answer Codex compaction_trigger on the chat-completions bridge (#53266) 2026-11-21 14:53:31 -08:00
test_command_round_trip_e2e.py
test_fast_mode_e2e.py test(e2e): run codex in fast mode under the real model name (#49899) 2026-11-21 03:10:15 +00:00
test_file_edit_e2e.py test(e2e): add Codex file edit, long session and auto-compaction rows through LiteLLM (#49386) 2026-11-03 01:52:29 +00:00
test_long_session_e2e.py test(e2e): add Codex file edit, long session and auto-compaction rows through LiteLLM (#49386) 2026-11-03 01:52:29 +00:00
test_mcp_tool_e2e.py test(e2e): add a Codex row that calls a local MCP tool on a first and a resumed turn (#49817) 2026-11-06 03:59:03 +00:00
test_subagent_e2e.py test(e2e): add a Codex row where a sub-agent must read the task its parent hands it (#50494) 2026-11-07 21:16:39 +00:00