fix(opencode): preserve agent and reasoning options when steering#23981

open3
main
GitHub fork: codex/fix-23508-opencode-steer-options
opened11d agobyNnateEc
View on GitHubTwo-way sync enabledPR last imported 3d ago

Steering an OpenCode turn omits the selected agent and reasoning variant, so a thread using a custom agent can switch to OpenCode's default agent mid-turn. The steered prompt also loses the system instructions supplied at turn start.

Use the same prompt options for turn start and steering, retaining the explicit agent, plan-mode fallback, reasoning variant, and system instructions. This is a focused fix for an existing message-delivery path, with no new capability or product default.

Fixes #23508.

Validation on macOS arm64, Node 26.12.1:

  • Adapter regression cases for custom agent (including precedence over plan mode), plan fallback, and default options failed on main because the steered payload omitted those fields; all pass after the fix.
  • vp run check:changed passed format, lint, knip, affected-package typechecks, and all 34 adapter tests. Lint retains an existing unused layer warning.
  • Runtime transcript from the real adapter with a fake SDK transport: start agent=agent-b, variant=high → steer previously agent=undefined, variant=undefined; now agent=agent-b, variant=high, with identical system instructions and a fresh message ID.
  • A live authenticated OpenCode session was not run. The test exercises the adapter/SDK boundary; no UI changes.

Written with GPT-6 in the Codex desktop harness.

Checks

22 successful · 9 skipped
All checks passed
6877a55

Added 1 commit

  • fix(opencode): 保留追加消息的代理和推理配置d46aa4c
Synced from GitHub

Approvability

Verdict: Approved at 667fc87

Macroscope's review found this PR approvable — This focused OpenCode adapter fix preserves the existing agent, reasoning variant, plan fallback, and system instructions when steering an active turn. Production behavior changes only in that previously incomplete steering path, with targeted regression coverage and no product-default or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between 667fc87e005af0f78501fef6ebcdd8c4d2f80487 and 6877a55eb07e98e79624df1352937f82f068a276.

External image Files selected for processing: 2
  • packages/provider-opencode/src/server/adapter.test.ts
  • packages/provider-opencode/src/server/adapter.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

Turn submission and steering now use shared OpenCode prompt options. The options include the selected agent and variant, the plan-mode agent fallback, and the combined system prompt. Tests cover custom, plan, and default interaction modes.

Changes: OpenCode prompt options

Layer / File(s)Summary
Shared prompt options for turns and steering
packages/provider-opencode/src/server/adapter.ts, packages/provider-opencode/src/server/adapter.test.ts
A shared helper derives the agent, variant, and system prompt from model selection and runtime policy. Turn submission and steering use these options. Tests check custom, plan, and default modes, including system prompt retention and distinct message IDs.

Priority: External image Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • pingdotgg/t3code#23508 — The change supplies the selected agent, variant, plan-mode fallback, and system prompt to steering prompts.

Possibly related PRs

  • pingdotgg/t3code#24321 — Both changes use model selection to determine OpenCode agent behavior; this PR applies the selected agent’s permission rules.

Suggested reviewers: juliusmarminge, marcodotio

Merge Risk: External image Minimal · up to 6877a

Steering preserves the selected options. No merge-blocking issue was established.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title is concise, specific, and accurately describes preserving OpenCode agent and reasoning options during steering.
Description checkPassedThe description covers the problem, solution, scope, issue reference, verification results, limitations, and testing environment. It provides the required information, although it does not use the tem…
Linked Issues checkPassedIssue [#23508] requires OpenCode steering to preserve the selected agent and reasoning variant, including the plan-mode fallback. promptOptions derives agent, variant, and the shared system inst…
Out of Scope Changes checkPassedThe changes remain within the OpenCode message-delivery path required by [#23508]. The helper removes duplicated prompt-option construction, and the tests verify the steering behavior. No unrelated ca…
Full details: Description check

Explanation

The description covers the problem, solution, scope, issue reference, verification results, limitations, and testing environment. It provides the required information, although it does not use the template's section headings.

Full details: Linked Issues check

Explanation

Issue [#23508] requires OpenCode steering to preserve the selected agent and reasoning variant, including the plan-mode fallback. promptOptions derives agent, variant, and the shared system instructions from the active turn. Both startTurn and steerTurn use this helper. The parameterized test covers custom-agent precedence, plan fallback, default options, system-prompt equality, and a fresh message ID.

Full details: Out of Scope Changes check

Explanation

The changes remain within the OpenCode message-delivery path required by [#23508]. The helper removes duplicated prompt-option construction, and the tests verify the steering behavior. No unrelated capability, product default, or UI change appears in the reviewed diff.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Added 1 commit

  • chore(opencode): 同步主线并整合追加消息回归测试667fc87
Synced from GitHub

Merged main c3888da8b4 in 667fc87e00. Preserved steering agent/variant/system options and main's extracted-attachment/stop-race tests. The harness now accepts host overrides and model selection separately so neither side's coverage is lost. All 35 adapter tests and check:changed scoped gates pass. No real provider request was sent.

Added 1 commit

  • chore(opencode): 整合主线权限刷新与追加消息测试6877a55
Synced from GitHub

Merged main be2ea30d2b, preserving this PR's steering-options regression alongside main's new session/subagent permission-refresh tests. The production merge is unchanged in intent: initial and appended prompts share the selected agent, reasoning variant and system instructions.

vp run check:changed passed: all 37 OpenCode adapter tests, format, lint, both knip checks and all 10 affected-package typechecks.