Skip to content

tui: default_agent is ignored on startup in V2 #37225

Closed as not planned
Closed as not planned

Description

@chrisae9

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-mode and tmux-status plugins, but the issue was reproduced with an isolated XDG_CONFIG_HOME and all plugins disabled.

Reproduction

  1. Start the full TUI with an isolated configuration and the built-in plan agent configured as the default:

    XDG_CONFIG_HOME=/tmp/opencode-clean \
      OPENCODE_CONFIG_CONTENT='{"default_agent":"plan","plugins":["-*"]}' \
      opencode2 --standalone
  2. Type any text in the prompt so the selected agent appears in the status line.

  3. 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 plan agent, 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 using opencode2 --session <id> still initializes the TUI selector to Build.
  • opencode2 mini --agent full selects the requested agent, but changes to the minimal interface and is not a workaround for the full TUI.
  • Immediate manual workaround: press Shift+Tab after startup when the desired custom agent is the last catalog entry.

Activity

  1. github-actions commented on Jul 16, 2026

    @github-actions
    Contributor

    This issue might be related to an existing open issue. Please check:

  2. chrisae9 commented on Jul 18, 2026

    @chrisae9
    Author

    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:

    • A brand-new V2 standalone TUI ignores default_agent.
    • The reproduction uses an isolated XDG_CONFIG_HOME, all plugins disabled, and the built-in plan agent.
    • There is no resumed session or persisted last-used agent involved.
    • The full TUI starts with Build, apparently because it selects the first catalog entry rather than the configured default.
    • The same selector behavior occurs when opening an API-created session that already specifies another agent.

    So #37225 is about honoring default_agent during 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.

  3. avarayr commented on Aug 13, 2026

    @avarayr

    This is being fixed
    #42243

  4. github-actions commented on Oct 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions