fix(models): strip @profile suffix from model selection#11198
fix(models): strip @profile suffix from model selection#11198mcaxtr wants to merge 1 commit intoopenclaw:mainfrom
Conversation
65421d4 to
c16ca4c
Compare
c16ca4c to
53a38c9
Compare
53a38c9 to
6ee4ab0
Compare
fc1a11d to
0f0c297
Compare
bfc1ccb to
f92900f
Compare
cf4f0ac to
105213d
Compare
|
Feature: support multiple aliases per model (for per-profile routing) |
105213d to
68c09d9
Compare
|
Closing as AI-assisted stale-fix triage. Linked issue #10882 ("[Bug]: /model command with explicit @Profile suffix fails with "model not allowed"") is currently CLOSED and was closed on 2026-02-23T04:39:36Z with state reason NOT_PLANNED. If the underlying bug is still reproducible on current main, please reopen this PR (or open a new focused fix PR) and reference both #10882 and #11198 for fast re-triage. |
|
Closed after AI-assisted stale-fix triage (closed issue duplicate/stale fix). |
Fixes #10882
Summary
When using
/model provider/model@profile:namesyntax, the@profilesuffix was included in the model name during allowlist lookup, causing a "model not allowed" error even when the model is properly configured.Repro Steps
nvidia/moonshotai/kimi-k2.5/model nvidia/moonshotai/kimi-k2.5@nvidia:defaultnvidia/moonshotai/kimi-k2.5@nvidia:defaultinstead ofnvidia/moonshotai/kimi-k2.5Root Cause
resolveModelRefFromString()insrc/agents/model-selection.tspassed the full input (including@profilesuffix) toparseModelRef(). The inline directive path (extractModelDirective()insrc/auto-reply/model.ts) already strips@profilebefore calling resolution, but the session reset path (applyResetModelOverride()→buildSelectionFromExplicit()) does not — it callsresolveModelRefFromString()with the raw token.Fixing at the
resolveModelRefFromString()level ensures all code paths that resolve model refs correctly strip the@profilesuffix, regardless of whether the caller pre-strips it.Behavior Changes
resolveModelRefFromString()now strips@profilesuffix before alias lookup andparseModelRef()callparseModelRef()itself (profile stripping is an application-level concern, not a model-ref concern)@profile(inline directive path) are unaffected — double-stripping is safeCodebase and GitHub Search
resolveModelRefFromString— confirmed session reset path and directive handling path both benefit@handling in model resolution —extractModelDirective()already strips butresolveModelRefFromStringdid notTests
4 new tests in
src/agents/model-selection.test.ts— all 4 fail before fix, pass after:@profilesuffix fromprovider/modelinput (nvidia/moonshotai/kimi-k2.5@nvidia:default)@profilesuffix from single-segment model input (gpt-5@myprofile)@profilesuffix with colon in profile name (google/gemini-flash-latest@google:bevfresh)@profilesuffix (kimi@nvidia:default)Full test suite: 220 tests pass across 36 files. Build and lint clean.
lobster-biscuit
Sign-Off
resolveModelRefFromString) to benefit all code paths. The inline directive path already handled this correctly; the session reset path did not.Greptile Overview
Greptile Summary
This PR updates
resolveModelRefFromString()to strip a trailing@profilesuffix from model tokens before alias lookup andparseModelRef()parsing, fixing allowlist key mismatches when users specify/model provider/model@profile:name. It also adds unit tests covering provider/model inputs, single-segment inputs, aliases, and profile names containing colons to ensure all resolution paths behave consistently.Confidence Score: 5/5
@profilesuffixes before alias lookup/parsing, with added unit tests covering the affected cases. No other resolution logic is altered, and the new behavior is consistent across callers.