[PR #8678] fix(agent): default agent selection in acp and headless mode #12828

Closed
opened 2026-02-16 18:17:43 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: Yes


Summary

Make ACP and headless mode respect default_agent config and properly handle agent modes and visibilities. Previously, subagents and hidden agents could be incorrectly selected as the default agent.

Fixes #8680

Changes

  • Filter out subagents (mode === "subagent") from defaultAgent candidates
  • Filter out hidden agents (hidden === true) from defaultAgent candidates
  • 4 different errors introduced:
    • default agent "${cfg.default_agent}" not found
    • default agent "${cfg.default_agent}" is a subagent
    • default agent "${cfg.default_agent}" is hidden
    • no primary visible agent found
  • Add 7 test cases for defaultAgent selection logic
  • Persist default mode in session manager during ACP session init

Breaking Changes

None

Testing

  • Added unit tests covering agent selection cases
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8678 **State:** closed **Merged:** Yes --- ## Summary Make ACP and headless mode respect `default_agent` config and properly handle agent modes and visibilities. Previously, subagents and hidden agents could be incorrectly selected as the default agent. Fixes #8680 ## Changes - Filter out subagents (`mode === "subagent"`) from defaultAgent candidates - Filter out hidden agents (`hidden === true`) from defaultAgent candidates - 4 different errors introduced: - `default agent "${cfg.default_agent}" not found` - `default agent "${cfg.default_agent}" is a subagent` - `default agent "${cfg.default_agent}" is hidden` - `no primary visible agent found` - Add 7 test cases for defaultAgent selection logic - Persist default mode in session manager during ACP session init ## Breaking Changes None ## Testing - Added unit tests covering agent selection cases
yindo added the pull-request label 2026-02-16 18:17:43 -05:00
yindo closed this issue 2026-02-16 18:17:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12828