fix(open-interpreter): don't double-prefix provider-scoped EVAL_MODEL - #339
Closed
cdoron wants to merge 1 commit into
Closed
fix(open-interpreter): don't double-prefix provider-scoped EVAL_MODEL#339cdoron wants to merge 1 commit into
cdoron wants to merge 1 commit 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>
cdoron
force-pushed
the
fix/open-interpreter-model-prefix
branch
from
August 10, 2026 19:24
60cf888 to
e84be52
Compare
1 task
Contributor
|
Superseded by #354 — same guard fix, plus a deeper issue found while reviewing it: run_oi.py reads $EVAL_MODEL directly, which never reaches the container (run-agent's scrub only forwards $MODEL — the same bug #320/#334 fixed in ten other agents). Your authorship is preserved on the guard-fix commit. |
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>
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
interpreter.llm.modelunconditionally prependedopenai/, so a provider-scopedEVAL_MODEL(e.g.gcp/gemini-3.5-flash-lite) became malformed (openai/gcp/gemini-3.5-flash-lite) and failed to route through the gateway."/" in modelguard already used byterminus-2andopenhands.Checked against:
.agents/gateways/RULES.mdrule 23 (EVAL_MODELis a bare, opaque handle that MAY already carry a provider/routing prefix; the gateway/agent MUST NOT assume it needs a prefix added).Test plan
output/model/result.jsonnow reports the correct, unprefixedgcp/gemini-3.5-flash-lite, andtraces.jsonl'sraw_gen_ai_requestspan showsllm.openai.modelset correctly (previously double-prefixed).containers/agents/terminus-2/run.pyandcontainers/agents/openhands/run_openhands.py.🤖 Generated with Claude Code