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
[FEATURE]: v2 SDK: bind agent/model/variant options to queued prompts #48356
Store these options with the durable input and apply them when it is delivered, not when it is queued. Omitted options keep the existing behavior.
Today, separate session.switchAgent() / session.switchModel() calls change session-wide selection before the queued prompt runs. Attaching options to the input would let Kimaki use the OpenCode queue directly instead of keeping a separate client-side queue to coordinate selection.
This is a proposed API capability, not a reproduced concurrency bug.
Reacted by hir0xygen, Benoit de Chezelles and Tommy D. Rossi
Thanks for updating the issue! It now meets our contributing guidelines — the feature request is clear, uses the correct template, includes the verification checkbox, and explains the use case well. We'll take a look.
+1, hitting the same thing in the V2 TUI. Reporting the client-side repro since this issue is framed as SDK-only:
Start a turn in build (agent working).
While it runs, switch agent to plan and queue the prompt with ctrl+x enter.
The active agent switches to plan at the next steer opportunity, before the queued prompt is delivered, so the in-flight turn finishes under plan mode.
Expected: session-wide selection stays put, and the queued prompt's agent is applied only when that prompt is actually delivered.
Same "apply when delivered, not when queued" semantics requested here.
Another concrete integration use case from Yuri, a multi-client UI for OpenCode: users switch models while a turn is running, then queue a follow-up expecting it to use the model selected when they submitted it. Currently we can retain that selection in metadata, but execution still uses the session-wide model, so the queued task can run with the previous model instead.
Client-side coordination is not a viable substitute for us: users may close the app or go offline immediately after submitting. We need OpenCode's durable queue to own execution independently of the submitting client. Switching the session model at admission also does not provide per-item isolation and can affect work already running.
The behavior proposed here is exactly what we need: persist agent/model/variant with each admitted input, apply them at the delivery boundary, and preserve existing behavior when those options are omitted. It should continue to work after the client disconnects and when multiple queued inputs select different models.
This is a real user-facing limitation for us, not just SDK ergonomics. Is there a planned implementation or an upstream PR we can follow and help validate? Happy to provide the integration scenario and test the eventual API.
Thanks for the request, and for the clear use case from porting Kimaki.
To restate it: you'd like session.prompt (especially with delivery: "queue") to accept optional agent and model (including variant). These would be stored with the queued input and applied when it is delivered, so a queued prompt can run with its own selection without changing the work already running. Today the prompt input doesn't carry these, and session.switchAgent() / session.switchModel() change the whole session right away. This needs a change in core, so it can't be done as a plugin.
Maintainers will consider it. Related work you may want to follow:
Activity
[-]v2 SDK: bind agent/model options to queued prompts[/-][+][FEATURE]: v2 SDK: bind agent/model/variant options to queued prompts[/+]github-actions commentedon Sep 10, 2026
Thanks for updating the issue! It now meets our contributing guidelines — the feature request is clear, uses the correct template, includes the verification checkbox, and explains the use case well. We'll take a look.
Store Kimaki system instructions through native OpenCode session entr…
hir0xygen commentedon Sep 23, 2026
+1, hitting the same thing in the V2 TUI. Reporting the client-side repro since this issue is framed as SDK-only:
Expected: session-wide selection stays put, and the queued prompt's agent is applied only when that prompt is actually delivered.
Same "apply when delivered, not when queued" semantics requested here.
Store Kimaki system instructions through native OpenCode session entr…
Store Kimaki system instructions through native OpenCode session entr…
Store Kimaki system instructions through native OpenCode session entr…
yee94 commentedon Oct 28, 2026
Another concrete integration use case from Yuri, a multi-client UI for OpenCode: users switch models while a turn is running, then queue a follow-up expecting it to use the model selected when they submitted it. Currently we can retain that selection in metadata, but execution still uses the session-wide model, so the queued task can run with the previous model instead.
Client-side coordination is not a viable substitute for us: users may close the app or go offline immediately after submitting. We need OpenCode's durable queue to own execution independently of the submitting client. Switching the session model at admission also does not provide per-item isolation and can affect work already running.
The behavior proposed here is exactly what we need: persist agent/model/variant with each admitted input, apply them at the delivery boundary, and preserve existing behavior when those options are omitted. It should continue to work after the client disconnects and when multiple queued inputs select different models.
This is a real user-facing limitation for us, not just SDK ergonomics. Is there a planned implementation or an upstream PR we can follow and help validate? Happy to provide the integration scenario and test the eventual API.
opencodejr commentedon Oct 28, 2026
Thanks for the request, and for the clear use case from porting Kimaki.
To restate it: you'd like
session.prompt(especially withdelivery: "queue") to accept optionalagentandmodel(includingvariant). These would be stored with the queued input and applied when it is delivered, so a queued prompt can run with its own selection without changing the work already running. Today the prompt input doesn't carry these, andsession.switchAgent()/session.switchModel()change the whole session right away. This needs a change in core, so it can't be done as a plugin.Maintainers will consider it. Related work you may want to follow:
agent/modelfields for API callers. It references this issue.