Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: OpenCode steer drops the thread's `agent` (and `variant`), so steered messages run on opencode's default_agent

未关闭 适合新手
#23,508 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
77/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
ai, backend

调研方向

阅读 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
  1. In opencode config, define two primary agents, e.g. agent-a and agent-b, and set "default_agent": "agent-a".
  2. In T3 Code, start an OpenCode thread with the Agent option set to agent-b.
  3. 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_send with mode: "steer"/"auto" from another agent.
  4. 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_send with mode: "queue" instead of steer/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_agent to the agent you steer most often.
主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
1 小时 22 分钟
30 天内合并 PR
18

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。