Repository navigation
Description
Summary
The OpenCode V2 full TUI ignores default_agent when starting a new session and selects Build instead. This occurs with both built-in and custom primary agents.
Environment
- opencode version:
opencode2 v0.0.0-next-15636 - OS: Linux 7.1.2-arch3-1, x86_64
- Terminal: tmux (
TERM_PROGRAM=tmux,TERM=xterm-256color,COLORTERM=truecolor) - Shell:
/bin/zsh - Install/channel: next
- Active plugins: None in the clean reproduction. The normal environment has local
goal-modeandtmux-statusplugins, but the issue was reproduced with an isolatedXDG_CONFIG_HOMEand all plugins disabled.
Reproduction
-
Start the full TUI with an isolated configuration and the built-in
planagent configured as the default:XDG_CONFIG_HOME=/tmp/opencode-clean \ OPENCODE_CONFIG_CONTENT='{"default_agent":"plan","plugins":["-*"]}' \ opencode2 --standalone -
Type any text in the prompt so the selected agent appears in the status line.
-
Observe that the status line shows
Build.
The issue also reproduces with a custom primary agent:
{
"default_agent": "full",
"agents": {
"full": {
"description": "Build without permission prompts",
"mode": "primary",
"permissions": [
{ "action": "*", "resource": "*", "effect": "allow" }
]
}
}
}Expected Behavior
The full TUI should initially select the agent configured by default_agent. With the minimal reproduction it should start in Plan; with the custom configuration it should start in full.
Actual Behavior
The full TUI always starts in Build. The agent catalog is returned with Build first, and the TUI selects that first entry instead of the configured default.
Additional Context
- Reproduces consistently.
- Reproduces with the built-in
planagent, so it is not specific to custom agents. - Reproduces with all plugins disabled and isolated global configuration.
- Restarting the shared OpenCode service does not help.
- Creating a session through the API with
agent: "full"and opening it usingopencode2 --session <id>still initializes the TUI selector toBuild. opencode2 mini --agent fullselects the requested agent, but changes to the minimal interface and is not a workaround for the full TUI.- Immediate manual workaround: press
Shift+Tabafter startup when the desired custom agent is the last catalog entry.
Activity
github-actions commentedon Jul 16, 2026
This issue might be related to an existing open issue. Please check:
default_agent— that issue focuses on resumed sessions restoring the last-used agent instead of the configured default, which shares the same root area (default_agentnot being consistently respected).chrisae9 commentedon Jul 18, 2026
Thanks, I reviewed #27370. It concerns the same configuration field, but the behavior and requested outcome are different.
#27370 explicitly reports that new sessions correctly honor
default_agent; the problem occurs only when resuming a session whose persisted last-used agent differs from the configured default. It requests a policy for whether resumed sessions should restore persisted state or always use the configured default.This issue reproduces before that policy question arises:
default_agent.XDG_CONFIG_HOME, all plugins disabled, and the built-inplanagent.Build, apparently because it selects the first catalog entry rather than the configured default.So #37225 is about honoring
default_agentduring initial full-TUI selection, while #27370 is about whether a resumed session should override persisted agent state. They may touch adjacent code, but fixing the resume policy described in #27370 would not necessarily fix new-session startup in V2.avarayr commentedon Aug 13, 2026
This is being fixed
#42243
github-actions commentedon Oct 13, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.