Skip to content

sessions_spawn model param does not resolve aliases #57532

Description

@jimmydabot

Bug

When passing a model alias (e.g. gpt, sonnet, gemini-pro) to sessions_spawn's model parameter, the alias is not resolved to the full provider/model ref. The subagent silently falls back to the default model.

Steps to Reproduce

  1. Configure aliases in agents.defaults.models:
    "openai-codex/gpt-5.4": {"alias": "gpt"}
  2. Call sessions_spawn with model: "gpt"
  3. The subagent runs on the default/fallback model, not GPT

Expected Behavior

The alias should resolve to the full model ref (openai-codex/gpt-5.4) before patching the child session, consistent with how /model gpt works in slash commands.

Root Cause

normalizeModelSelection() in reply-*.js just trims the string and returns it. It does not perform a reverse lookup against the agents.defaults.models alias map. Since the trimmed alias string is truthy, it short-circuits the rest of the resolution chain in resolveSubagentSpawnModelSelection().

The patched session receives a raw alias string that the gateway cannot match to a real provider/model pair, so it falls back to the default.

Workaround

Pass full model refs instead of aliases:

  • openai-codex/gpt-5.4 instead of gpt
  • anthropic/claude-sonnet-4-5 instead of sonnet
  • google-gemini-cli/gemini-3-pro-preview instead of gemini-pro

Suggested Fix

Add reverse alias resolution in normalizeModelSelection() or resolveSubagentSpawnModelSelection() before returning the model string. The alias map is already available in cfg.agents.defaults.models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions