[PR #10064] fix(tool): use default agent fallback in plan_exit when build is disabled #13318

Open
opened 2026-02-16 18:18:11 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10064

State: open
Merged: No


What does this PR do?

Fixes the plan_exit tool throwing an error when the build agent is disabled via config (agent.build.disable: true).

Problem: The tool hardcoded agent: "build" without checking if the build agent was available, causing an error when trying to switch to a disabled agent.

Solution: Use Agent.defaultAgent() to dynamically find an available primary agent instead of hardcoding "build". This leverages the existing fallback logic that finds the first available primary visible agent.

Fixes #9822

How did you verify your code works?

  • TypeScript compilation passes (bun run tsgo --noEmit in packages/opencode)
  • Code review of Agent.defaultAgent() shows it properly falls back to available primary agents
  • Manual testing with agent.build.disable: true config

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10064 **State:** open **Merged:** No --- ### What does this PR do? Fixes the `plan_exit` tool throwing an error when the build agent is disabled via config (`agent.build.disable: true`). **Problem:** The tool hardcoded `agent: "build"` without checking if the build agent was available, causing an error when trying to switch to a disabled agent. **Solution:** Use `Agent.defaultAgent()` to dynamically find an available primary agent instead of hardcoding "build". This leverages the existing fallback logic that finds the first available primary visible agent. Fixes #9822 ### How did you verify your code works? - [x] TypeScript compilation passes (`bun run tsgo --noEmit` in packages/opencode) - [x] Code review of `Agent.defaultAgent()` shows it properly falls back to available primary agents - [ ] Manual testing with `agent.build.disable: true` config 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-16 18:18:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13318