desktop: new sessions hardcode agent "build" and ignore default_agent · Issue #57704 · anomalyco/opencode · GitHub
Skip to content

desktop: new sessions hardcode agent "build" and ignore default_agent #57704

Open

Description

@tudorhariton

Summary

The desktop app creates every new session with an explicit agent: "build" value, so default_agent from project config is never applied. A project whose default primary agent is a custom agent never gets it in desktop-created sessions.

Environment

  • opencode version: 2.0.32 (bug also present in earlier desktop versions)
  • OS: Windows_NT 10.0.26300 (win32 x64)
  • Terminal: Unavailable: running via desktop app (no terminal env vars)
  • Shell: C:\WINDOWS\system32\cmd.exe
  • Install/channel: latest (desktop app, ai.opencode.desktop)
  • Active plugins: none

Reproduction

  1. In a project, set "default_agent": "my-agent" in opencode.jsonc and define .opencode/agents/my-agent.md with mode: primary.
  2. Verify server-side: GET /api/config?location[directory]=<project> includes the config, and GET /api/agent?... returns my-agent with mode: "primary", hidden: false.
  3. Create a session via the API with no agent field → session stores agent = NULL (default_agent path is available).
  4. Create a new session from the desktop app UI.
  5. Inspect the session (session_v2.agent in the DB): it is "build".

Expected Behavior

A new session with no explicit agent selection should use default_agent.

Actual Behavior

Desktop-created sessions store agent = "build" — the client passes the agent explicitly and bypasses default_agent. Every desktop session in this project got build; sessions created via opencode run --agent solution-architect correctly stored solution-architect.

Additional Context

  • Reproduces consistently across desktop versions (observed on 2.0.31 and 2.0.32).
  • Server-side config/agent discovery verified correct via API; the override happens at session creation in the client.
  • Workaround used: a project file .opencode/agents/build.md redefines the built-in build agent with the desired persona so the hardcoded stamp still lands on the intended behavior.

Activity

  1. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    Thanks for the clear report and the workaround. I think this is a duplicate of #55535: on desktop, new sessions start on build and ignore the configured default_agent. The app never reads default_agent when it picks the agent for a new session. If the agent picker is hidden (Settings → Show agent off), it falls back to build. That's why your sessions are stored with agent = "build". The open PR #55615 would make new sessions use the configured default agent instead.

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

    In the meantime, you can also turn on Settings → Show agent and pick your agent manually, besides overriding build.md as you did.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions