mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* test(e2e): run codex in fast mode under the real model name as a team model Each test registers its deployment as a team model named after the real model, on a throwaway team with a team key, so parallel tests never share one pooled deployment. Fast mode sets service_tier to priority the way /fast does and must still answer with a value only reachable through the gateway, on every setup * test(e2e): run codex round trip and compaction under the real model name Adds the real-name round trip, which first checks Codex got its own catalog entry for that provider, and the two-turn compaction row. Both compaction tests now also require each turn to exit 0
41 lines
1.6 KiB
Python
41 lines
1.6 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
|
|
|
|
COMPACT_AFTER_TOKENS: Final = 500
|
|
PADDING: Final = "".join(f"line {number}: the quick brown fox jumps over the lazy dog\n" for number in range(400))
|
|
|
|
|
|
@pytest.mark.parametrize("deployment", SETUPS)
|
|
class TestCodexAutoCompaction:
|
|
def test_remembers_a_value_after_the_gateway_compacts_the_session(
|
|
self, codex: CodexHarness, setup: ModelSetup
|
|
) -> None:
|
|
marker: Final = unique_marker()
|
|
workspace: Final = codex.new_workspace(files={"secret.txt": marker, "padding.txt": PADDING})
|
|
first: Final = codex.exec(
|
|
"Run `cat secret.txt` and remember the value it prints. Then run `cat padding.txt`. Then reply with OK.",
|
|
model=setup.model,
|
|
cwd=workspace,
|
|
compact_after_tokens=COMPACT_AFTER_TOKENS,
|
|
)
|
|
assert first.exit_code == 0, first
|
|
assert first.thread_id is not None, first
|
|
(workspace / "secret.txt").unlink()
|
|
second: Final = codex.resume(
|
|
first.thread_id,
|
|
"What value did secret.txt print earlier? Reply with just that value.",
|
|
model=setup.model,
|
|
cwd=workspace,
|
|
compact_after_tokens=COMPACT_AFTER_TOKENS,
|
|
)
|
|
assert second.exit_code == 0, second
|
|
assert any(compaction.remote for compaction in codex.compactions(first.thread_id)), (first, second)
|
|
assert marker in second.answer, second
|