Skip to content

fix(opencode): Fix hardcoding default build OpenCode agent when sending responses - #1131

Merged
backnotprop merged 3 commits into
backnotprop:mainfrom
cb-bradbeebe:fix/1123/opencode-agent-switching
Jul 27, 2026
Merged

fix(opencode): Fix hardcoding default build OpenCode agent when sending responses#1131
backnotprop merged 3 commits into
backnotprop:mainfrom
cb-bradbeebe:fix/1123/opencode-agent-switching

Conversation

@cb-bradbeebe

@cb-bradbeebe cb-bradbeebe commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

What changed

  • Updated OpenCode agent-switch behavior so default/disabled mode does not set an agent parameter.
  • Added validation for explicitly configured agents via client.app.agents() before request submission.
  • If a configured agent is invalid/unavailable, the agent override is omitted and surfaced as a warning (log + toast).
  • Updated related docs and tests.

Testing

  • Unit tests
  • Marketing docs builds
  • Manual testing with local plugin build

Demo/Screenshots

Bug

Before

before-01 before-02

After

after-01

New warning toast if user manually enters a invalid custom agent via Settings

warning-settings-01 warning-toast-01

…r review feedback only

The agent switch cookie is shared by plan approval and code review, so
flipping the stored default to `disabled` also removed OpenCode's
plan-approval hand-off for every user who never configured the setting.

Make the unset default surface-aware instead: `getAgentSwitchSettings('plan')`
keeps the historical build hand-off, `getAgentSwitchSettings('review')`
stays on the current agent. An explicit user choice still applies to both
surfaces. Settings and the agent warning resolve the default from the mode
they render in, and the OpenCode "agent not available" warning now names
plan approval on the plan path.

Claude-Session: https://claude.ai/code/session_01H5KQWqXqjrPxyxUNso1QHS
@backnotprop

Copy link
Copy Markdown
Owner

Thanks for the fix. We kept your validation path and the review-feedback behavior exactly as you built it: agents are validated through client.app.agents(), an unavailable agent is omitted with a log plus toast, and the empty custom-name case no longer leaks "custom" as an agent name.

One change on top: the agent switch cookie is shared by plan approval and code review, so flipping the stored default to disabled also removed the OpenCode plan-approval handoff for everyone who never touched the setting. I pushed a commit that makes the unset default surface-aware instead. Plan approval keeps defaulting to the build handoff, so existing plan-mode users see no change, and review feedback now defaults to staying on the current agent as you intended. An explicit choice in Settings still applies everywhere.

# Conflicts:
#	apps/opencode-plugin/cli-bridge.test.ts
#	apps/opencode-plugin/cli-bridge.ts
#	apps/opencode-plugin/commands.ts
#	apps/opencode-plugin/index.ts
@backnotprop
backnotprop merged commit ac3a84b into backnotprop:main Jul 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OpenCode] Allow customizing the review agent name that feedback gets sent back to instead of build

2 participants