[Bug]: OpenCode steer drops the thread's `agent` (and `variant`), so steered messages run on opencode's default_agent
Maintainer thường phản hồi trong vòng 1 ngày
Đá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
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
- 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.
- 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
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.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pingdotgg/t3code
-
[Bug]: PR link chips in an expanded Markdown table break mid-number (#36 / 3)Có thể đã có người làm @fixfon đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Snoozed and Settled sections show an up arrow when collapsedCó thể đã có người làm @juliusmarminge đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
MCP endpoint matches the Authorization scheme case-sensitively and logs the same reason for "absent" and "wrong scheme" (ChatGPT connector gets missing_bearer_token)Có thể đã có người làm @shethshlok đã nhận 2 ngày trước. Đang mởbug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Markdown file preview renders YAML frontmatter as a setext headingCó thể đã có người làm @juliusmarminge đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pingdotgg/t3code
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
farion1231/cc-switch#8829 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverĐang mởdoc-audit enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100