Skip to content

fix(subagents): inherit parent model when recommended model is an auto router alias#3302

Open
abhay-codes07 wants to merge 1 commit into
letta-ai:mainfrom
abhay-codes07:fix/subagent-model-inherit-over-auto
Open

fix(subagents): inherit parent model when recommended model is an auto router alias#3302
abhay-codes07 wants to merge 1 commit into
letta-ai:mainfrom
abhay-codes07:fix/subagent-model-inherit-over-auto

Conversation

@abhay-codes07

Copy link
Copy Markdown
Contributor

Summary

  • Fixes CLI: /init creates subagents with a different model than the selected model #3248: /init history-analyzer subagents (and any builtin whose frontmatter pins model: auto) ran on the server-side auto router's pick (e.g. gpt-5.4) instead of the session's selected model (e.g. gpt-5.4-mini).
  • Root cause: resolveSubagentModel treats any non-inherit recommended model as an explicit pin that beats parent inheritance. Since chore: switch all subagent models to auto/auto-fast #1436 switched builtin subagents to model: auto, the resolved letta/auto handle is always available, so for cloud non-BYOK parents the parent's model was unreachable — contradicting the Task tool's documented contract ("If not specified, inherits from parent"). Local-backend and BYOK parents already inherit; cloud non-BYOK was the remaining gap.
  • Fix: treat a recommended model that resolves to a router alias (letta/auto, letta/auto-fast, letta/auto-chat, letta/auto-memory) as non-pinning — prefer the parent's model when one exists. The alias still applies when no parent model is set, free-tier defaults (auto-fast/auto) are unchanged, and the reflection carve-out is untouched.
  • Also updates a stale note in the initializing-memory skill that still described history-analyzer as pinned to a "cheaper model (sonnet)" (pre-chore: switch all subagent models to auto/auto-fast #1436).

Test plan

  • 4 new tests in src/agent/subagent-model-resolution.test.ts: auto + parent → parent; auto-fast + parent → parent; auto with no parent → letta/auto (alias preserved); free tier + parent → letta/auto-fast (default preserved)
  • Mutation check: with the fix stashed, exactly the two new inheritance tests fail; behavior-preservation tests pass on both old and new code
  • Full resolveSubagentModel suite (67 tests) + subagent-builtins + init-background-subagent pass
  • bun run check — all 10 checks pass
  • Full unit suite: no regressions vs the Windows baseline (all failures are known pre-existing symlink/websocket/keychain/startup-flow categories)

AI disclosure

Per the disclosure policy proposed in #3139: this fix was developed with AI assistance (Claude Code). The root-cause analysis, implementation, and tests were AI-assisted; I reviewed, ran, and verified everything locally before submitting.

cc @devanshrj — follows the same shape as #3239; happy to adjust if you'd rather fix this at the frontmatter level (model: inherit on history-analyzer) instead of in the resolver.

…o router alias

Builtin subagents like history-analyzer pin 'model: auto' in their
frontmatter. resolveSubagentModel treated any non-inherit recommended
model as an explicit pin that beats parent inheritance, so subagents
spawned by /init ran on the server-side auto router's pick instead of
the session's selected model, contradicting the Task tool's documented
'inherits from parent' contract.

Treat a recommended model that resolves to a router alias (letta/auto,
letta/auto-fast, letta/auto-chat, letta/auto-memory) as non-pinning:
prefer the parent's model when one exists. The alias still applies when
no parent model is set, free-tier defaults are unchanged, and the
reflection carve-out is untouched.

Fixes letta-ai#3248
Copilot AI review requested due to automatic review settings July 10, 2026 07:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

CLI: /init creates subagents with a different model than the selected model

2 participants