desktop: new sessions ignore default_agent and root model · Issue #54006 · anomalyco/opencode · GitHub
Skip to content

desktop: new sessions ignore default_agent and root model #54006

Closed as duplicate

Description

@rickycatto2

Summary

Sessions created by the Desktop app ignore the configured default_agent and root model, opening as build with a carried-over model instead. Sessions created by the CLI resolve both correctly from the identical config. This matters because agent-specific permission rules (including subagent approval gates) belong to the configured default agent, so they are silently not applied in Desktop windows.

Environment

  • opencode version: 2.0.25
  • OS: Windows_NT 10.0.19045 (win32 x64)
  • Terminal: Unavailable: OpenCode Desktop app (Electron); terminal environment variables are not set in this context
  • Shell: C:\Windows\system32\cmd.exe (diagnostics run via Windows PowerShell 5.1)
  • Install/channel: latest (OpenCode Desktop app with bundled CLI v2.0.25)
  • Active plugins: None found in config

Reproduction

  1. Create ~/.config/opencode/opencode.json:
{
  "$schema": "https://opencode.ai/config.json",
  "default_agent": "coordinator",
  "model": "openai/gpt-6-sol",
  "agents": {
    "coordinator": {
      "mode": "primary",
      "model": "openai/gpt-6-sol",
      "system": "...",
      "permissions": [
        { "action": "edit", "resource": "*", "effect": "deny" },
        { "action": "shell", "resource": "*", "effect": "deny" },
        { "action": "subagent", "resource": "*", "effect": "deny" },
        { "action": "subagent", "resource": "specialist", "effect": "ask" }
      ]
    },
    "assistant": { "mode": "subagent", "model": "opencode/mimo-v2.6-flash-free" },
    "maker": { "mode": "subagent", "model": "openai/gpt-6.1-sol" },
    "specialist": { "mode": "subagent", "model": "openai/gpt-6-astra" }
  }
}
  1. Verify via API that the config loaded correctly:
GET /api/config
-> "default_agent": "coordinator"
-> "model": { "providerID": "openai", "model": "gpt-6-sol" }
  1. From the Desktop app, open a new window / start a new session.
  2. Inspect the resulting session via GET /api/session.
  3. Repeat from a terminal with a bare opencode run "Reply: OK" (no --model) in the same project.

Expected Behavior

Newly created sessions use default_agent (coordinator) and the root model (openai/gpt-6-sol), regardless of whether they were created by the Desktop app or the CLI.

Actual Behavior

CLI resolves both correctly:

$ opencode run "Reply with exactly: DEFAULT_OK"
> coordinator · gpt-6-sol
DEFAULT_OK

Desktop-created sessions do not. Root sessions (parentID null), newest first:

Created (local) agent model Source
13:54:26 build openai/gpt-6-sol Desktop window
13:52:02 build opencode/mimo-v2.6-flash-free Desktop window
13:12:58 (null) openai/gpt-6-sol CLI opencode run
12:30:43 build opencode/mimo-v2.6-flash-free Desktop session
11:57:04 build openai/gpt-6-sol Desktop window

Two distinct deviations:

  1. Agent: every Desktop-created session carries an explicit agent: "build", overriding default_agent. The CLI-created session correctly leaves it unset and resolves to coordinator.
  2. Model: the Desktop model is inconsistent (mimo-v2.6-flash-free vs gpt-6-sol across sessions created minutes apart under identical config) rather than tracking the configured root model.

A session created directly through POST /api/session with no agent/model fields returns both as empty, suggesting the Desktop client is supplying them explicitly rather than leaving them to be resolved.

Additional Context

Impact. While running as build, the configured agent's permission rules are not applied. In this config the coordinator rules include edit: deny, shell: deny, and a subagent deny-* with explicit allow/ask exceptions — notably specialist → ask, which is a deliberate cost gate. Under build's default permissive policy those gates are bypassed.

Frequency. Reproduced consistently on every Desktop-created session observed (5 of 5 root sessions with an explicit agent).

Workaround tried. Running /agents → coordinator and /models → openai/gpt-6-sol in each new window. Works, but must be repeated per session. Using the CLI instead also works, but loses the Desktop UI.

Related. GET /api/agent confirms all four custom agents register correctly with the right models and permission rules, and GET /api/config confirms default_agent is present — so config parsing and agent registration appear unaffected. The deviation happens only at Desktop session-creation time.

Activity

  1. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report, especially the session table and the note on permission rules. I think this is a duplicate of #53944, which reported the same thing on Desktop 2.0.25 / Windows: new sessions start on build and ignore default_agent, while the CLI/TUI picks it up. That issue was closed as a duplicate of #50269.

    On the current v2 code, when the app has no agent selected it falls back to build and never reads default_agent. The model you saw likely follows from that. build has no model of its own, so the app uses the model from the previous draft or your recent models instead of coordinator's openai/gpt-6-sol.

    Possible duplicates and related issues, ordered from most to least likely:

    Until this is fixed, turning on Settings → General → Show agent should at least bring back the agent picker in the composer. I haven't checked whether new sessions then start on your default agent.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. For example, if the model problem also happens when the agent is set correctly, that would be a separate issue.

  2. opencode-agent commented on Oct 9, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #53944. It's been a day since the duplicate note, and no reply has said how this is different. Desktop 2.0.25 starting new sessions on build instead of default_agent is tracked there and in #50269. Your note that this skips coordinator's permission rules, including the specialist → ask approval check, is useful context for that work.

    If the model part still happens once the right agent is selected, please open a new issue for it. #38333 covers new tabs that keep the previous tab's model. You can also reply here if you think this should stay open.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions