Skip to content

fix(terminus-2): don't guess litellm provider from "/" in EVAL_MODEL - #348

Merged
elronbandel merged 1 commit into
Exgentic:mainfrom
cdoron:fix/terminus-2-model-prefix
Aug 12, 2026
Merged

fix(terminus-2): don't guess litellm provider from "/" in EVAL_MODEL#348
elronbandel merged 1 commit into
Exgentic:mainfrom
cdoron:fix/terminus-2-model-prefix

Conversation

@cdoron

@cdoron cdoron commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • EVAL_MODEL is a bare, opaque handle that may already carry a routing prefix like aws/claude-opus-4-8 (gateways/RULES.md rule 2). The old if "/" not in model: model = f"openai/{model}" check treated any / as proof of a real litellm provider, so prefixed handles reached litellm unmodified and litellm.get_llm_provider raised BadRequestError: LLM Provider NOT provided (aws is not a litellm provider — its real Bedrock name is bedrock).
  • Force the wire explicitly via llm_kwargs={"custom_llm_provider": "openai"}, which harbor's LiteLLM class forwards straight into every litellm.acompletion() call, regardless of what prefix EVAL_MODEL carries.
  • Same class of fix as fix(open-interpreter): don't double-prefix provider-scoped EVAL_MODEL #339 (open-interpreter), applied to terminus-2.

Test plan

  • Ran eval-containers run appworld --agent terminus-2 --model aws/claude-opus-4-8 --local --task-id 0 end-to-end: no BadRequestError, litellm calls succeed with real token usage in traces.jsonl.

EVAL_MODEL is a bare, opaque handle that may already carry a routing
prefix like aws/claude-opus-4-8 (gateways/RULES.md rule 2). The old
`if "/" not in model: model = f"openai/{model}"` check treated any "/"
as proof of a real litellm provider, so prefixed handles reached
litellm unmodified and litellm.get_llm_provider raised
BadRequestError: LLM Provider NOT provided (aws is not a litellm
provider — its real Bedrock name is bedrock).

Force the wire explicitly via llm_kwargs={"custom_llm_provider":
"openai"}, which harbor's LiteLLM class forwards straight into every
litellm.acompletion() call, regardless of what prefix EVAL_MODEL
carries.

Signed-off-by: Doron Chen <cdoron@il.ibm.com>
@cdoron
cdoron force-pushed the fix/terminus-2-model-prefix branch from 0d29fa5 to e532791 Compare August 12, 2026 06:02
elronbandel added a commit that referenced this pull request Aug 12, 2026
…not $EVAL_MODEL

Two issues found while reviewing/verifying #339:

1. run-agent's env -i allow-list forwards only MODEL to the agent process —
   EVAL_MODEL is scrubbed away (same contract zerostack already follows,
   same bug #320/#334 fixed in ten other agents). run_oi.py read EVAL_MODEL
   directly with no Dockerfile-level shim, so it always fell back to the
   literal string "default" regardless of #339's guard fix.

2. #339's "/" guard (copied from openhands/terminus-2's old pattern) does
   not actually work for provider-scoped handles. Verified live: a handle
   like gcp/gemini-3.5-flash-lite skips the openai/ prefix (as intended)
   but then reaches litellm.completion() unmodified, and litellm tries to
   resolve "gcp" as a real provider name (it isn't — litellm's name for
   it is vertex_ai) and raises BadRequestError: LLM Provider NOT provided.
   Reproduced the exact crash #339 was supposed to prevent.

open-interpreter's Llm class has no field for litellm's custom_llm_provider
(unlike terminus-2/harbor's LiteLLM wrapper, see #348 — same underlying
issue, same fix approach). Fixed by wrapping llm.completions (a plain
function forwarding **params to litellm.completion(**params)) to inject
custom_llm_provider="openai" regardless of what the handle carries.

Verified live against a capturing mock: bare handle and provider-prefixed
handle (gcp/...) both now reach the wire unmodified, no crash, in both
cases before this fix would either mangle the model name (#339's original
bug) or crash outright (the case #339's own fix introduced).

Signed-off-by: Elron Bandel <elron.bandel@ibm.com>

@elronbandel elronbandel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified live against a request-capturing mock with a provider-prefixed canary (aws/verify-canary-t2-5m3): 40+ requests captured, all with the correct unmodified model field, zero BadRequestErrors. custom_llm_provider="openai" correctly forces the wire regardless of the routing prefix — unlike #339's naive "/" guard (which I reproduced crashing on the exact scenario it claimed to fix). Also confirmed terminus-2 already reads EVAL_MODEL-then-MODEL correctly, no separate env-var bug here.

@elronbandel
elronbandel merged commit 37ddcb6 into Exgentic:main Aug 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants