fix(terminus-2): don't guess litellm provider from "/" in EVAL_MODEL - #348
Merged
Merged
Conversation
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
force-pushed
the
fix/terminus-2-model-prefix
branch
from
August 12, 2026 06:02
0d29fa5 to
e532791
Compare
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
approved these changes
Aug 12, 2026
elronbandel
left a comment
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EVAL_MODELis a bare, opaque handle that may already carry a routing prefix likeaws/claude-opus-4-8(gateways/RULES.md rule 2). The oldif "/" not in model: model = f"openai/{model}"check treated any/as proof of a real litellm provider, so prefixed handles reached litellm unmodified andlitellm.get_llm_providerraisedBadRequestError: LLM Provider NOT provided(awsis not a litellm provider — its real Bedrock name isbedrock).llm_kwargs={"custom_llm_provider": "openai"}, which harbor'sLiteLLMclass forwards straight into everylitellm.acompletion()call, regardless of what prefixEVAL_MODELcarries.Test plan
eval-containers run appworld --agent terminus-2 --model aws/claude-opus-4-8 --local --task-id 0end-to-end: noBadRequestError, litellm calls succeed with real token usage intraces.jsonl.