Skip to content

agents: mode:all configured model ignored at subagent spawn — parent model inherited #50925

Closed as not planned

Description

@lehneres

Summary

A markdown agent with mode: all and a frontmatter model: (no #variant) has its configured model silently ignored when invoked via the subagent tool — the child session inherits the parent session's model. The same agent works correctly when its frontmatter says mode: subagent. Same symptom family as #50849, but a distinct trigger (see Additional Context).

Environment

  • opencode version: 2.0.10
  • OS: Linux 7.0.14-17-pve (linux x64)
  • Terminal: xterm-256color (headless opencode serve + TUI session; TERM_PROGRAM not set)
  • Shell: /bin/bash
  • Install/channel: latest
  • Active plugins: none in config (custom plugin files exist in plugins-v2/ but are not referenced from config)

Reproduction

Two custom openai-compatible providers (npm: "@ai-sdk/openai-compatible"), each with a declared model in its models map; both models resolvable (present in GET /api/model). Two agents under ~/.config/opencode/agents/, both using legacy (v1) frontmatter keys (permission: map, temperature):

  • A.md: mode: subagent, model: <providerA/modelA>
  • B.md: mode: all, model: <providerB/modelB>

Parent session runs model M (different from both). For each configuration, invoke the subagent tool with only agent/description/prompt (no model parameter), then inspect the child via GET /api/session/{childID} and the assistant message metadata in the session store.

# agent mode configured model child actually ran on
1 B all providerB/modelB M (parent) ✗
2 A subagent providerA/modelA providerA/modelA ✓
3 A (model swapped to providerB/modelB) subagent providerB/modelB providerB/modelB ✓
4 B (mode flipped to subagent) subagent providerB/modelB providerB/modelB ✓

Each row was a fresh spawn; only the single named variable changed between rows.

Expected Behavior

Case 1 should run on providerB/modelB — the configured model: applies at spawn regardless of the agent's mode.

Actual Behavior

Case 1 creates the child session with the parent's model M. No error, no warning, nothing in the server log. GET /api/agent/B correctly reports the configured model, so parsing/registry is fine — only spawn-time resolution is wrong.

Additional Context

Activity

  1. csyio commented on Oct 6, 2026

    @csyio

    Can't reproduce this on current v2: a mode: all agent with model: set spawns its child on the configured model. Could you check if it still happens on the latest release?

  2. rekram1-node commented on Oct 21, 2026

    @rekram1-node
    Contributor

    Closing since we could not reproduce this on current V2 and have not heard back. Please reopen if a mode: all agent still ignores its model: on 2.1.x.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions