Skip to content

fix: prevent LLM from overriding pi's default model in subagents#20

Open
Jehu wants to merge 1 commit into
burggraf:mainfrom
Jehu:fix/model-param-default-description
Open

fix: prevent LLM from overriding pi's default model in subagents#20
Jehu wants to merge 1 commit into
burggraf:mainfrom
Jehu:fix/model-param-default-description

Conversation

@Jehu

@Jehu Jehu commented Apr 10, 2026

Copy link
Copy Markdown

Problem

When spawning teammates, the LLM (team lead) often passes model: "sonnet" (or similar) to spawn_teammate — even when the user never specified a model. This happens because the model parameter had no description instructing the LLM to omit it when not explicitly requested.

Root Cause

  1. spawn_teammate, team_create, and create_predefined_team had model/default_model parameters with no description — the LLM had no guidance on when (not) to set them.
  2. resolveModelWithProvider("sonnet") resolves via PROVIDER_PRIORITY to anthropic/sonnet (anthropic is the first API-key provider in the list).
  3. The subagent launches with pi --model anthropic/sonnet, overriding pi's configured default model (e.g. zai/glm-5.1).

Fix

Added explicit descriptions to all three model/default_model parameters:

IMPORTANT: Omit this parameter to use pi's configured default model. Only set this when the user explicitly requests a specific model.

This ensures the LLM only passes a model when the user explicitly asks for one — otherwise pi's own default is preserved.

Affected Tools

  • team_create (default_model)
  • spawn_teammate (model)
  • create_predefined_team (default_model)

Testing

All 129 existing tests pass.

…pi's default model

When the 'model' and 'default_model' parameters had no description, the
LLM would often guess a model (e.g. 'sonnet') and pass it to
spawn_teammate, causing resolveModelWithProvider() to resolve it to
anthropic/sonnet via PROVIDER_PRIORITY — overriding pi's configured
default model (e.g. zai/glm-5.1).

Added explicit descriptions instructing the LLM to omit these parameters
unless the user explicitly requests a specific model, so that pi's
default model is preserved.

Affected tools: team_create, spawn_teammate, create_predefined_team
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant