Skip to content

feat(provider): add @model and @small_model refs#22075

Open
thypon wants to merge 1 commit intoanomalyco:devfrom
thypon:feat/model-refs
Open

feat(provider): add @model and @small_model refs#22075
thypon wants to merge 1 commit intoanomalyco:devfrom
thypon:feat/model-refs

Conversation

@thypon
Copy link
Copy Markdown

@thypon thypon commented Apr 11, 2026

Issue for this PR

Refs #11930

Type of change

  • New feature

What does this PR do?

Config model fields (model, small_model, agent.*.model, command.*.model, --model CLI arg) now accept @model and @small_model references instead of hardcoding provider/id strings.

These refs resolve lazily at runtime — so for example, setting agent.compaction.model: "@small_model" means the compaction agent always uses whichever small model is active for the current provider, without needing to hardcode a specific model id.

Circular-ref guards prevent @small_model in config.small_model or @model in config.model from causing infinite loops.

Key changes:

  • isModelRef() / resolveRef() added to Provider service — @small_model resolves via getSmallModel() (falls back to defaultModel()), @model resolves via defaultModel()
  • Agent config stores unresolved refs as modelRef (string), resolves at use site instead of at parse time
  • compaction.ts, prompt.ts, CLI commands, and ACP all handle modelRef resolution

How did you verify your code works?

  • 13 new tests: isModelRef, resolveRef, getSmallModel circular guard, agent modelRef parsing, compaction modelRef resolution
  • Full suite: 1895 pass, 0 fail
  • Typecheck errors are all pre-existing (Buffer/node_modules issues unrelated to this PR)

Screenshots / recordings

N/A — no UI changes

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Allow config model fields to reference named models via
@model and @small_model instead of hardcoding provider/id
strings. Refs resolve lazily at runtime so the compaction
agent (or any agent) can track the active default/small
model per provider.

- Add isModelRef(), resolveRef() to Provider service
- Store unresolved refs as agent.modelRef, resolve at use site
- Guard against circular refs in defaultModel/getSmallModel
- Update all CLI and ACP call sites to handle @ prefixed strings
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@thypon
Copy link
Copy Markdown
Author

thypon commented Apr 11, 2026

failures do not seem to be related to this patch

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