Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server (packages/provider-opencode/src/server/adapter.ts)
Steps to reproduce
- In opencode config, define two primary agents, e.g.
agent-aandagent-b, and set"default_agent": "agent-a". - In T3 Code, start an OpenCode thread with the Agent option set to
agent-b. - While the turn is running, send another message so it's delivered as a steer. Sending one from the composer mid-turn works, and so does
t3_thread_sendwithmode: "steer"/"auto"from another agent. - Inspect the user messages in opencode's DB (
~/.local/share/opencode/opencode.db,message.data -> $.agent), or watch the agent's behavior.
Expected behavior
Steering a running turn keeps the thread's selected agent (and reasoning variant). The steered message runs as agent-b.
Actual behavior
The steered message runs as opencode's default_agent (agent-a). The next normal turn switches back to agent-b, so a session flips agents depending on whether each message started a turn or steered one.
From my opencode DB over 3 days, in sessions whose first message used the non-default agent:
| delivery | ran as selected agent | ran as default_agent |
|---|---|---|
| new turn (thread idle) | 55 | 0 |
| steer (turn running) | 0 | 16 |
This matters when agents have different prompts or permissions. In my setup the default agent's prompt refuses to work outside a given directory, so any steer, including agent-to-agent messages via t3_thread_send, makes the receiving thread stop work.
Cause
startTurn reads agent and variant from the model selection and passes them, together with the system prompt, to session.promptAsync:
// adapter.ts ~L3246 (main @ ff52547)
const agent =
getModelSelectionStringOptionValue(turnInput.modelSelection, "agent") ??
(turnInput.runtimePolicy.interactionMode === "plan" ? "plan" : undefined);
const variant = getModelSelectionStringOptionValue(turnInput.modelSelection, "variant");
yield* submitPrompt(state, turn, {
sessionID: sessionId,
messageID: turn.admissionMessageId!,
model: parsedModel,
...(agent === undefined ? {} : { agent }),
...(variant === undefined ? {} : { variant }),
system: systemPrompt,
parts,
}, ...)steerTurn sends only model and parts:
// adapter.ts ~L3359
yield* submitPrompt(state, turn, {
sessionID: sessionId,
messageID: turn.admissionMessageId,
model: parsedModel,
parts,
}, ...)opencode resolves agent per prompt, not per session. A prompt without agent falls back to default_agent, and one without variant runs at the model's default reasoning effort.
Suggested fix
In steerTurn, derive agent and variant from turn.modelSelection (plus the plan-mode fallback) the same way startTurn does, and spread them into the submitPrompt payload. Steers probably also need the same system prompt, since opencode treats each prompt's system separately. Maintainers should decide that part.
Impact
Major degradation or frequent failure
Version or commit
0.1.2-nightly.20261021.3473. The code is unchanged on main @ ff52547.
Environment
macOS 26.6.2, T3 Code (Nightly) desktop, opencode 1.19.3, OpenCode provider with custom primary agents via the Agent option.
Workaround
- Agent-to-agent: use
t3_thread_sendwithmode: "queue"instead ofsteer/auto, so the message starts a normal turn that carries the agent. - Human mid-turn messages: wait for the turn to finish, or set
default_agentto the agent you steer most often.
Activity
juliusmarminge commentedon Nov 9, 2026
Thanks for the detailed report! #23270 fixes this on main in f14fa03, preserving the selected agent, variant and system instructions when steering.