Skip to content

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

@IgorWarzocha

Description

@IgorWarzocha

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions