Skip to content

fix(provider): treat empty small_model as disabled#21184

Open
thesobercoder wants to merge 1 commit into
anomalyco:devfrom
thesobercoder:4579-small-model-disable
Open

fix(provider): treat empty small_model as disabled#21184
thesobercoder wants to merge 1 commit into
anomalyco:devfrom
thesobercoder:4579-small-model-disable

Conversation

@thesobercoder
Copy link
Copy Markdown

@thesobercoder thesobercoder commented Apr 6, 2026

Issue for this PR

Closes #4579

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

small_model: "" was still falling back to the default small model, which could trigger unexpected Haiku requests.

This change treats an explicit empty small_model as disabled and adds a regression test for that case.

How did you verify your code works?

  • bun test test/provider/provider.test.ts -t "getSmallModel"
  • bun typecheck
  • commit hook bun turbo typecheck

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@georgeglarson
Copy link
Copy Markdown
Contributor

Independently validated this fix on current dev. Walking through the empirical loop in case it helps move the review forward:

Repro on unpatched dev: Translated the PR's regression test to current dev's test helpers (the local set(...) / getSmallModel(...) rather than the older Env.set(...) / Provider.getSmallModel(...) shape this PR uses) and ran it without any source change — test fails as expected. getSmallModel(ProviderID.anthropic) returns a populated claude-haiku-4.5 model object instead of undefined when small_model: "" is set, exactly matching the symptom in #4579.

With the 2-line fix applied: The new test passes. The two existing getSmallModel tests still pass (returns appropriate small model, respects config small_model override). One unrelated test (plugin config enabled and disabled providers are honored) times out on dev with or without this patch — it's a pre-existing flake, not caused by this PR.

Heads-up for whoever takes the merge: This PR's test uses Env.set(...) and Provider.getSmallModel(...), but packages/opencode/test/provider/provider.test.ts on current dev defines local helpers (set at line 19, getSmallModel at line 50) and has dropped those direct call sites. Trivial rename on rebase, just want to flag it so CI doesn't trip.

The fix is minimal, the test is targeted, and it directly addresses what the original reporters asked for. Hope the validation is useful.

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.

Openrouter unwated requests to Claude Haiku 4.5.

2 participants