fix(models): strip @profile suffix from model selection#11198
Open
mcaxtr wants to merge 1 commit intoopenclaw:mainfrom
Open
fix(models): strip @profile suffix from model selection#11198mcaxtr wants to merge 1 commit intoopenclaw:mainfrom
mcaxtr wants to merge 1 commit intoopenclaw:mainfrom
Conversation
SutanuNandigrami
pushed a commit
to SutanuNandigrami/openclaw
that referenced
this pull request
Feb 8, 2026
65421d4 to
c16ca4c
Compare
c16ca4c to
53a38c9
Compare
53a38c9 to
6ee4ab0
Compare
fc1a11d to
0f0c297
Compare
bfc1ccb to
f92900f
Compare
f2ee3f4 to
cf4f0ac
Compare
cf4f0ac to
105213d
Compare
|
Feature: support multiple aliases per model (for per-profile routing) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.