You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plugins: chat.params hook cannot override the model (only sampling params) — model-switch plugins are forced to abort+resend, which breaks one-shot opencode run callers #49712
Plugins: chat.params hook cannot override the model (only sampling params) — model-switch plugins are forced to abort+resend, which breaks one-shot opencode run callers
The chat.params plugin hook allows overriding sampling params only — temperature, topP, reasoningEffort, maxTokens, thinking — but not providerID/modelID of the upcoming request. Verified in the plugin's dist code: the hook handler maps exactly those fields onto the output; a model change is impossible from inside the hook.
Consequence: any plugin that needs to switch the model for an in-flight task (rate-limit fallback, context-overflow large-model switch, A/B routing) must abort the session and re-send a new prompt with body.model. There is no abort-free path.
Why that hurts: opencode run callers
For long-lived clients (TUI, HTTP POST /session/:id/message against a serve instance) abort+resend works: the process survives the abort, the plugin's follow-up prompt lands, the task continues on the new model.
But opencode run is a one-shot CLI: when its prompt is aborted, it prints Error: Aborted and exits — taking the plugin's in-flight follow-up prompt with it. The task is silently lost. Real-world case: a daily cron research job (opencode run -s <long-running-session> "<task>") failed 4 days in a row with Error: Aborted because the session context was over the model's threshold and the fallback plugin aborted to switch to a large-context model. Nothing executed; nothing logged on the plugin side that the continuation was lost.
Feature request
Enable plugins to change the model of the upcoming request without aborting the session, e.g.:
Extend the chat.params hook so providerID/modelID (and small-model/large-model variants) can be overridden for the request being built, or
Add a dedicated hook (e.g. chat.model) that runs before provider resolution and can return a model override.
This would allow abort-free model switching (fallback on rate limit, large-context switch on overflow) and fix the whole class of „scheduled task silently lost" failures. It also complements the native model-fallback discussions (#7602, stalled PR #26292): even with native fallback, plugin-level per-agent routing still needs a clean way to redirect the model.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊