Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#23,508 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@nateEc đang làm issue này rồi.

Từ ngày 23/10/2026.

  • #23981 của @nateEc — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
77/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
ai, backend

Hướng nghiên cứu

Đọc packages/provider-opencode/src/server/adapter.ts và so sánh cách startTurn và steerTurn tạo payload submitPrompt. Theo dõi cách turn.modelSelection và chế độ lập kế hoạch cung cấp agent và variant; báo cáo cũng đặt câu hỏi liệu các steer có cần system prompt hay không. Công việc hoàn tất khi một tin nhắn được điều hướng giữ nguyên agent và reasoning variant đã chọn của thread, đồng thời hành vi của system prompt được làm rõ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
24.8k
Fork
6.4k
Merge trung bình
8 giờ 26 phút
Pull request đã merge (30 ngày)
177

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pingdotgg/t3code

Tất cả issue của pingdotgg/t3code

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.