litellm/tests/e2e/codex/test_long_session_e2e.py
ryan-crabbe-berri 50af27eaa6
test(e2e): add Codex file edit, long session and auto-compaction rows through LiteLLM (#49386)
* test(e2e): add the Codex file edit and long session rows

The file edit row has Codex change a random value into config.txt with the patch tool and checks the file on disk. The long session row has it follow a chain of random file names one cat at a time. new_workspace now returns the resolved path, because Codex reports patched files by their real path (/private/var on macOS).

* test(e2e): make the Codex long session prove every earlier command output reached the model

* test(e2e): Codex auto-compaction through LiteLLM (#49389)

* test(e2e): add the Codex auto-compaction row

Codex reads a random value, compacts through the gateway with its remote compaction forced on, and is asked for the value after the file holding it is deleted. The row reads the compaction from the thread's rollout file and marks Claude on Bedrock as a strict expected failure, since the Responses-to-chat bridge ignores the compaction_trigger item

* refactor(e2e): validate Codex rollout lines with the models directly
2026-11-03 01:52:29 +00:00

34 lines
1.3 KiB
Python

from __future__ import annotations
from typing import Final
import pytest
from codex.harness import CodexHarness
from codex.setups import SETUPS, ModelSetup
from e2e_config import unique_marker
pytestmark = pytest.mark.e2e
@pytest.mark.parametrize("deployment", SETUPS)
class TestCodexLongSession:
def test_remembers_every_command_output_in_a_chain_of_files(self, codex: CodexHarness, setup: ModelSetup) -> None:
codes: Final = (unique_marker(), unique_marker(), unique_marker())
second: Final = f"{unique_marker()}.txt"
third: Final = f"{unique_marker()}.txt"
workspace: Final = codex.new_workspace(
files={
"start.txt": f"code {codes[0]}\nnext {second}\n",
second: f"code {codes[1]}\nnext {third}\n",
third: f"code {codes[2]}\nlast file\n",
}
)
run: Final = codex.exec(
"Run `cat start.txt`. Each file prints a code and then the name of the next file, until one says last"
" file. Run `cat` on each next file, one command per step. Reply with the three codes in the order you"
" read them.",
model=setup.model,
cwd=workspace,
)
assert len(run.commands) >= 3, run
assert all(code in run.answer for code in codes), run