[BUG] plan_exit throws error when build agent is disabled #7072

Open
opened 2026-02-16 18:06:06 -05:00 by yindo · 1 comment
Owner

Originally created by @IgorWarzocha on GitHub (Jan 21, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When the build agent is disabled via config (agent.build.disable: true - very niche I know, but could happen), the plan_exit tool throws an error when trying to exit plan mode. The tool appears to hardcode "build" as the target agent without checking if it exists or finding an available fallback.

Expected Behavior

Should fall back to an available primary agent (like plan or another custom agent) instead of erroring out.

Actual Behavior

Throws an error when trying to switch to the disabled build agent.

The issue appears to be in /packages/opencode/src/tool/plan.ts where the target agent is hardcoded to "build" without checking if that agent is available.

Plugins

not applicable

OpenCode version

latest, tested on dev

Steps to reproduce

  1. Configure build agent as disabled:
{
  "agent": {
    "build": { "disable": true }
  }
}
  1. Enter plan mode
  2. Try to exit plan mode using plan_exit
  3. Error is thrown

Screenshot and/or share link

Image

Operating System

Omarchy

Terminal

Ghostty

Originally created by @IgorWarzocha on GitHub (Jan 21, 2026). Originally assigned to: @thdxr on GitHub. ### Description When the build agent is disabled via config (`agent.build.disable: true` - very niche I know, but could happen), the `plan_exit` tool throws an error when trying to exit plan mode. The tool appears to hardcode "build" as the target agent without checking if it exists or finding an available fallback. ## Expected Behavior Should fall back to an available primary agent (like plan or another custom agent) instead of erroring out. ## Actual Behavior Throws an error when trying to switch to the disabled build agent. The issue appears to be in `/packages/opencode/src/tool/plan.ts` where the target agent is hardcoded to "build" without checking if that agent is available. ### Plugins not applicable ### OpenCode version latest, tested on dev ### Steps to reproduce 1. Configure build agent as disabled: ```json { "agent": { "build": { "disable": true } } } ``` 2. Enter plan mode 3. Try to exit plan mode using `plan_exit` 4. Error is thrown ### Screenshot and/or share link <img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/f3c2ac02-0cdd-4fcb-bc2c-e6d2ad298c43" /> ### Operating System Omarchy ### Terminal Ghostty
yindo added the bug label 2026-02-16 18:06:06 -05:00
Author
Owner

@wienans commented on GitHub (Jan 21, 2026):

Fallback should be configurable. And if it is not configured, prompt the user a selection of the primary agents with the option to save for future tasks? Because if we pic the first primary agent which is not the plan agent that might be any agent which is actually not designed to do the implementation.

@wienans commented on GitHub (Jan 21, 2026): Fallback should be configurable. And if it is not configured, prompt the user a selection of the primary agents with the option to save for future tasks? Because if we pic the first primary agent which is not the plan agent that might be any agent which is actually not designed to do the implementation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7072