fix: generalize local-model validation bypass beyond Ollama tags#3271
Open
Aneesh-382005 wants to merge 1 commit into
Open
fix: generalize local-model validation bypass beyond Ollama tags#3271Aneesh-382005 wants to merge 1 commit into
Aneesh-382005 wants to merge 1 commit into
Conversation
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
is_local_openai_model_syntax()only bypassed strictprovider/modelvalidation when the model name contained a.or:(Ollama-tag-shaped). Bare names LM Studio/llama.cpp commonly use (e.g.mistral) were rejected unless prefixed withlocal/.is_local_openai_compatible_base_url()check (already used to waive the API-key requirement) to also waive the model-name shape check whenOPENAI_BASE_URLis loopback/private. Remote gateways keep the old heuristic, so a mistyped bare name can't silently route to a paid API.Anti-slop triage
OPENAI_BASE_URL=http://127.0.0.1:1234/v1 claw --model "mistral" prompt "hi"fails today withinvalid model syntaxdespite the server serving that model. Verified fixed against a local mock server; verified remote gateways (openrouter.ai) still reject bare names.Verification
scripts/fmt.sh --check,cargo test --workspaceall pass, incl. 4 new tests.git diff --checkpasses.cargo clippy --workspace -- -D warningsfails, but identically on unmodifiedmain(confirmed viagit stash) -> pre-existing, not touched by this PR.Resolution gate
OLLAMA_HOSTsupport); ROADMAP entry added.Future plans
Deferring two follow-ups raised in #3213's review to separate PRs: named per-backend env vars (
LMSTUDIO_HOST, etc.) and a config-based local-provider registry. Keeping this one small and reviewable.