Skip to content

[Bug] Subagent spawned via Task tool uses global config model instead of inheriting parent session's active model #17870

@gexdigital

Description

@gexdigital

Description

When a primary agent running a non-default model (e.g. selected interactively or different from opencode.json) spawns a subagent via the Task tool, the subagent ignores the parent's active session model and falls back to the global "model" defined in opencode.json.

The docs state:

"If you don't specify a model, subagents will use the model of the primary agent that invoked the subagent."

This does not happen in practice when the session model differs from the global config.

Expected behavior: Subagent inherits the active model of the parent session that invoked it.

Actual behavior: Subagent uses the global config default (opencode.json "model" field), ignoring the parent's active session model.

Related issues:

Plugins

No response

OpenCode version

v1.2.27

Steps to reproduce

  1. Set "model": "azure/gpt-4o" in opencode.json (global default)
    1. Start an opencode session and switch to anthropic/claude-sonnet-4-6 interactively via the model picker
    1. Primary agent (running claude-sonnet-4-6) invokes a subagent via the Task tool — no explicit model param passed
    1. Observe: subagent runs on azure/gpt-4o (global default) instead of anthropic/claude-sonnet-4-6 (parent's active model)

Screenshot and/or share link

No response

Operating System

Linux (Ubuntu 24.04)

Terminal

opencode TUI

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions