fix(open-interpreter): model handle fixes — force openai wire, read $MODEL not $EVAL_MODEL - #354
Open
elronbandel wants to merge 2 commits into
Open
fix(open-interpreter): model handle fixes — force openai wire, read $MODEL not $EVAL_MODEL#354elronbandel wants to merge 2 commits into
elronbandel wants to merge 2 commits into
Conversation
interpreter.llm.model unconditionally prepended "openai/", so an EVAL_MODEL that already carries a routing prefix (e.g. gcp/gemini-3.5-flash-lite) became malformed (openai/gcp/...). Guard matches the pattern already used by terminus-2 and openhands. Checked against: .agents/gateways/RULES.md rule 23 (EVAL_MODEL is a bare, opaque handle that MAY already carry a provider prefix). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Doron Chen <cdoron@il.ibm.com>
2 tasks
…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
force-pushed
the
elron/open-interpreter-model-fixes
branch
from
August 12, 2026 14:01
8d86dca to
87a0feb
Compare
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.
Started as a combination of #339 (Doron Chen) with a $MODEL/$EVAL_MODEL fix.
While verifying it live against a capturing mock, found that #339's own fix
doesn't actually work for the exact case it targets — reworked accordingly.
#339 — don't double-prefix provider-scoped EVAL_MODEL (kept, cherry-picked)
interpreter.llm.modelunconditionally prependedopenai/, so aprovider-scoped handle (e.g.
gcp/gemini-3.5-flash-lite) became malformed(
openai/gcp/gemini-3.5-flash-lite). Its fix added a"/" in modelguardcopied from openhands/terminus-2's old pattern.
Found while verifying — the guard doesn't actually work
Live-tested with a provider-prefixed canary handle: the guard correctly
skips the
openai/prefix, but the unmodified handle then reacheslitellm.completion(), which tries to resolvegcpas a real litellmprovider name (it isn't — litellm's name for it is
vertex_ai) and raisesBadRequestError: LLM Provider NOT provided. Reproduced the exact crash#339 claims to prevent, using #339's own fix.
Root fix (same approach as #348/terminus-2): force the wire explicitly via
litellm's
custom_llm_providerparameter, regardless of what the handlecarries. open-interpreter's
Llmclass has no dedicated field for this(unlike harbor's
LiteLLMwrapper), so it's done by wrappingllm.completions(a plain function forwarding**paramstolitellm.completion(**params)).Also — read $MODEL not $EVAL_MODEL
run-agent'senv -iallow-list forwards onlyMODELto the agentprocess —
EVAL_MODELis scrubbed away (same bug #320/#334 fixed in tenother agents).
run_oi.pyreadEVAL_MODELdirectly with noDockerfile-level shim, so it always fell back to
"default"regardless ofany guard logic.
Verification
Built the actual image and ran it against a request-capturing mock
(
tests/run/gateways/mock_upstream.py) with distinctive canary modelhandles:
verify-canary-bare-8x1) → reaches the wire unmodified, no crash.gcp/verify-canary-slash-4k9) → reaches the wireunmodified, no crash (previously crashed with BadRequestError under fix(open-interpreter): don't double-prefix provider-scoped EVAL_MODEL #339's
own fix).
EVAL_MODELset to a decoy value whileMODELcarries the real one →confirmed
MODELwins,EVAL_MODELis ignored.Closes #339.