[Bug]: OpenCode steer drops the thread's `agent` (and `variant`), so steered messages run on opencode's default_agent
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 77/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
阅读 packages/provider-opencode/src/server/adapter.ts,并比较 startTurn 和 steerTurn 如何构建各自的 submitPrompt 负载。追踪 turn.modelSelection 和计划模式如何提供 agent 和 variant;报告还提出了 steers 是否需要 system prompt 的问题。当一条被 steer 的消息保留线程所选的 agent 和 reasoning variant,并且 system prompt 的行为得到澄清时,即为完成。
由索引模型根据 Issue 内容生成。
描述
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 @ ff525478e236ec0df4c4920eb03ac3961ea714a2.
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.
- 主要语言
- TypeScript
- 星标
- 24.8k
- 派生
- 6.4k
- 平均合并
- 1 小时 22 分钟
- 30 天内合并 PR
- 18
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pingdotgg/t3code 的其他 Issue
-
MCP endpoint matches the Authorization scheme case-sensitively and logs the same reason for "absent" and "wrong scheme" (ChatGPT connector gets missing_bearer_token)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 74/100
pingdotgg/t3code#23175 · 2 条评论 ·
维护者通常 1 天内回复
-
[Bug]: preview_evaluate accepts returnByValue:false but returns no usable object reference可能已有人在做 @juliusmarminge 于 1 天前认领。 未关闭bug needs-triage
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 76/100
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 76/100
lingdojo/kana-dojo#32964 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
Documentation status: needs triage
难度 2/5 1-3 小时 新手友好度 72/100
mastra-ai/mastra#28194 · 1 条评论 ·
维护者通常 1 天内回复
-
priority-low refactor-3
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 3 天内回复