mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-24 22:09:56 +00:00
* test(e2e): add a Codex compatibility matrix suite Add tests/e2e/client_apps, a compatibility matrix for coding-agent CLIs other than Claude Code, starting with Codex 0.164.0 pinned through npm. Each of the 36 cells drives the real codex exec against the proxy for one feature and provider column, records a pass or fail per model, and the typed matrix builder turns the results into a matrix and flags cells that went from green to red. The harness parts are covered in tests/e2e_harness/client_apps * test(e2e): mark known proxy gaps in the Codex matrix as strict xfails The codex manifest gets a known_gaps list of feature, provider and reason. The client_apps conftest marks each listed cell xfail(strict=True) at collection, so the shared e2e lane stays green while a known gap lasts and goes red when the cell starts passing. The results file still records what the cell did, including crashes under the xfail and a passing strict XPASS. An entry naming a feature or provider the manifest lacks, or a cell listed twice, fails loudly. Web search is listed for all four columns with the proxy behavior behind each failure. * test(e2e): let a Codex known gap be non-strict for intermittent cells A known_gaps entry can now set strict: false (a real bool, default true). That entry marks its cell xfail(strict=False), so the e2e lane stays green whether the cell passes or fails, while the results file still records what happened. Vertex structured output gets a non-strict entry, since gemini-3.8-flash sometimes loops on shell calls or stalls under an output schema and times out. * test(e2e): drop gemini-3.8-flash from the Codex Vertex column and fail vision on shell reads Flash timed out at random on structured output and file edit, and once named the vision color by reading the PNG with PIL. Vertex now runs gemini-4-argon alone, so the non-strict known gap option goes away, and the vision cell fails when the model ran any shell command. * test(e2e): settle the Codex claude_bedrock caching and reasoning cells and skip Mantle web search without the IAM grant * test(e2e): tighten codex known gaps and effort checks, rerun cells once, record the Codex version The reasoning effort row now checks that every logged request asked for high effort and every logged response echoes it or nothing. Known gaps expect only an AssertionError, so a setup error, crash or timeout still fails. Each codex cell reruns once on an AssertionError, and the table keeps the last attempt. The table builder takes --codex-version, refuses a missing table, reports a dropped pass cell as missing, and keeps acronyms in row names * test(e2e): wait for the codex MCP server, turn off pytest-retry, and give codex harness tests unique names Codex sent a turn's first request before the local MCP server was up, so on a resumed turn the model called the vault tool before Codex registered it and the MCP row failed on Claude, Gemini and OpenAI. The harness now marks the server required, so Codex waits for it. pytest-retry, a ci-group plugin, reads the same flaky marker as pytest-rerunfailures and retried crashes too, so tests/e2e/pytest.ini turns it off and the rerun test runs with the real pytest.ini. The new codex harness test files collided with the claude_code ones of the same name at collection, so they take the folder's test_codex_ prefix. * test(e2e): turn off pytest-retry in the codex harness test instead of tests/e2e/pytest.ini A change to tests/e2e/pytest.ini makes CI's e2e picker run every e2e suite on this PR, and the e2e runners do not install pytest-retry, so the line only mattered locally. The codex conftest harness test now passes -p no:pytest-retry itself, and AGENTS.md tells a local run to do the same * test(e2e): expect only a missing feature in codex known gaps and match whole color names in the vision row A strict xfail on a codex setup now expects MissingFeature, which a row raises through require_feature on the check of the feature itself, so a setup error, a Codex crash or any other failed assertion in a known-gap cell still fails. The vision row matches whole color names, so "colored" no longer reads as red. * test(e2e): record the failed first attempt on a codex cell that passed on its rerun The OpenAI and Azure web search xfail reason now names Codex's bundled entry as the cause, served by LiteLLM's model list. * test(e2e): keep a codex known gap's failed first attempt and document the Claude and Gemini real-name check A known gap after a failed attempt now carries first_attempt_error like a pass does. The docs say the real-name row checks that the gateway adds no tool mode for models no Codex catalog lists, the run.py docstring names the lockfile pin, and pytest.ini drops a duplicate meta marker --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
158 lines
5.3 KiB
Python
158 lines
5.3 KiB
Python
"""The credentials are `os.environ/` references the gateway resolves, the same names the Claude Code matrix's
|
|
`test_config.yaml` uses, and Bedrock rides the gateway's default AWS identity."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Mapping
|
|
from dataclasses import dataclass, field
|
|
from typing import Final, Literal
|
|
|
|
import pytest
|
|
from _pytest.mark.structures import ParameterSet
|
|
from cli_harness.rate_limiter import RateBucket
|
|
from codex.harness import CodexCatalog
|
|
from codex.run import CodexRun
|
|
from e2e_metadata import Domain, Mode, Provider, Route, Subject, meta
|
|
from models import LiteLLMParamsBody
|
|
|
|
GPT: Final = "gpt-6.1-sol"
|
|
CLAUDE: Final = "claude-sonnet-5-5"
|
|
GPT_ON_BEDROCK_MANTLE: Final = f"bedrock_mantle/openai.{GPT}"
|
|
GPT_ON_BEDROCK_RUNTIME: Final = f"bedrock/global.openai.{GPT}"
|
|
GPT_ON_AZURE_OPENAI: Final = f"azure/{GPT}"
|
|
GPT_ON_OPENAI: Final = f"openai/{GPT}"
|
|
CLAUDE_ON_BEDROCK: Final = f"bedrock/us.anthropic.{CLAUDE}"
|
|
_BEDROCK_REGION: Final = "us-east-1"
|
|
|
|
type SetupId = Literal["bedrock_mantle", "bedrock_runtime", "azure_openai", "openai", "claude_bedrock", "vertex_ai"]
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class CodexEntry:
|
|
catalog: CodexCatalog
|
|
slug: str
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class Deployment:
|
|
litellm_params: LiteLLMParamsBody
|
|
rate_bucket: RateBucket
|
|
real_model_name: str
|
|
codex_entry: CodexEntry
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class ModelSetup:
|
|
model: str
|
|
rate_bucket: RateBucket
|
|
api_key: str = field(repr=False)
|
|
|
|
|
|
def _drives(provider: Provider, model: str) -> pytest.MarkDecorator:
|
|
return meta(
|
|
Subject(
|
|
domain=Domain.LLM_TRANSLATION,
|
|
route=Route.RESPONSES,
|
|
providers=(provider,),
|
|
models=(model,),
|
|
mode=Mode.STREAM,
|
|
)
|
|
)
|
|
|
|
|
|
GEMINI_ON_VERTEX: Final = "vertex_ai/gemini-4-neon"
|
|
_VERTEX_LOCATION: Final = "global"
|
|
|
|
SETUPS: Final = (
|
|
pytest.param(
|
|
Deployment(
|
|
LiteLLMParamsBody(model=GPT_ON_BEDROCK_MANTLE, aws_region_name=_BEDROCK_REGION),
|
|
RateBucket.BEDROCK_MANTLE,
|
|
real_model_name=GPT,
|
|
codex_entry=CodexEntry("amazon-bedrock", GPT_ON_BEDROCK_MANTLE.removeprefix("bedrock_mantle/")),
|
|
),
|
|
id="bedrock_mantle",
|
|
marks=_drives(Provider.BEDROCK_MANTLE, GPT_ON_BEDROCK_MANTLE),
|
|
),
|
|
pytest.param(
|
|
Deployment(
|
|
LiteLLMParamsBody(model=GPT_ON_BEDROCK_RUNTIME, aws_region_name=_BEDROCK_REGION),
|
|
RateBucket.BEDROCK_CONVERSE,
|
|
real_model_name=GPT,
|
|
codex_entry=CodexEntry("amazon-bedrock-runtime", GPT_ON_BEDROCK_RUNTIME.removeprefix("bedrock/")),
|
|
),
|
|
id="bedrock_runtime",
|
|
marks=(
|
|
_drives(Provider.BEDROCK, GPT_ON_BEDROCK_RUNTIME),
|
|
pytest.mark.skip(reason="Stage IAM lacks bedrock:InvokeModel on the default Bedrock Runtime project"),
|
|
),
|
|
),
|
|
pytest.param(
|
|
Deployment(
|
|
LiteLLMParamsBody(
|
|
model=GPT_ON_AZURE_OPENAI, api_base="os.environ/AZURE_API_BASE", api_key="os.environ/AZURE_API_KEY"
|
|
),
|
|
RateBucket.AZURE_OPENAI,
|
|
real_model_name=GPT,
|
|
codex_entry=CodexEntry("openai", GPT),
|
|
),
|
|
id="azure_openai",
|
|
marks=_drives(Provider.AZURE, GPT_ON_AZURE_OPENAI),
|
|
),
|
|
pytest.param(
|
|
Deployment(
|
|
LiteLLMParamsBody(model=GPT_ON_OPENAI, api_key="os.environ/OPENAI_API_KEY"),
|
|
RateBucket.OPENAI,
|
|
real_model_name=GPT,
|
|
codex_entry=CodexEntry("openai", GPT),
|
|
),
|
|
id="openai",
|
|
marks=_drives(Provider.OPENAI, GPT_ON_OPENAI),
|
|
),
|
|
pytest.param(
|
|
Deployment(
|
|
LiteLLMParamsBody(model=CLAUDE_ON_BEDROCK, aws_region_name=_BEDROCK_REGION),
|
|
RateBucket.BEDROCK_CONVERSE,
|
|
real_model_name=CLAUDE,
|
|
codex_entry=CodexEntry("openai", CLAUDE),
|
|
),
|
|
id="claude_bedrock",
|
|
marks=_drives(Provider.BEDROCK, CLAUDE_ON_BEDROCK),
|
|
),
|
|
pytest.param(
|
|
Deployment(
|
|
LiteLLMParamsBody(
|
|
model=GEMINI_ON_VERTEX,
|
|
vertex_project="os.environ/VERTEXAI_PROJECT",
|
|
vertex_location=_VERTEX_LOCATION,
|
|
vertex_credentials="os.environ/VERTEXAI_CREDENTIALS",
|
|
),
|
|
RateBucket.VERTEX_AI,
|
|
real_model_name=GEMINI_ON_VERTEX.removeprefix("vertex_ai/"),
|
|
codex_entry=CodexEntry("openai", GEMINI_ON_VERTEX.removeprefix("vertex_ai/")),
|
|
),
|
|
id="vertex_ai",
|
|
marks=_drives(Provider.VERTEX_AI, GEMINI_ON_VERTEX),
|
|
),
|
|
)
|
|
|
|
|
|
class MissingFeature(AssertionError):
|
|
pass
|
|
|
|
|
|
def require_feature(present: bool, run: CodexRun) -> None:
|
|
if not present:
|
|
raise MissingFeature(run)
|
|
|
|
|
|
def with_expected_failures(reasons: Mapping[SetupId, str]) -> tuple[ParameterSet, ...]:
|
|
return tuple(_expected_to_fail(setup, reasons) for setup in SETUPS)
|
|
|
|
|
|
def _expected_to_fail(setup: ParameterSet, reasons: Mapping[SetupId, str]) -> ParameterSet:
|
|
reason: Final = next((reason for setup_id, reason in reasons.items() if setup_id == setup.id), None)
|
|
if reason is None:
|
|
return setup
|
|
expected_failure: Final = pytest.mark.xfail(strict=True, raises=MissingFeature, reason=reason)
|
|
return pytest.param(*setup.values, id=setup.id, marks=(*setup.marks, expected_failure))
|