Repository navigation
fix(agents): preserve LM Studio @iq* quant suffixes in model refs - #71490
Sanjays2402 wants to merge 1 commit into
Conversation
LM Studio names quant variants like 'qwen3.6-27b@iq3_xxs' (imatrix quants prefixed with 'i'). splitTrailingAuthProfile only protected @q*/<n>bit suffixes, so '/model lmstudio/qwen3.6-27b@iq3_xxs' was parsed as model='lmstudio/qwen3.6-27b' + profile='iq3_xxs', causing 'model not allowed' and sending a truncated model id to LM Studio (which then picked an arbitrary quant). Extend the protected pattern to match optional 'i' prefix (i?q\d+...), preserving '@iq3_xxs', '@iq4_xs', etc. while still allowing an explicit auth profile via a second @ suffix (e.g. lmstudio/foo@iq3_xxs@work). Fixes openclaw#71474
Greptile SummaryThis PR extends Confidence Score: 5/5Safe to merge — a small, targeted regex fix with solid regression test coverage and no risk of breaking existing behaviour. The change is a single-character regex extension that only broadens the set of strings recognised as quant suffixes; existing @q* and \d+bit paths are unchanged. The three test files cover the new cases directly and the fix matches the described failure mode exactly. No files require special attention. Reviews (1): Last reviewed commit: "fix(agents): preserve LM Studio @iq* qua..." | Re-trigger Greptile |
|
Codex maintainer review: valid bug and the high-level tests here are useful, but the patch is incomplete for #71474 as written. It fixes function stripModelProfileSuffix(value: string): string {
const trimmed = value.trim();
const at = trimmed.indexOf("@");
return at <= 0 ? trimmed : trimmed.slice(0, at).trim();
}That still truncates Best fix is to combine this PR's |
|
Codex maintainer update: closing this as a duplicate/incomplete variant of the #71474 fix. The bug is real, but this PR only fixes the parser and high-level #71486 is the better canonical base because it fixes both the shared parser and Thanks @Sanjays2402 for the strong test shape; I left the specific porting request on #71486. |
…ting Address Codex maintainer review on openclaw#71490: `splitTrailingAuthProfile` already preserves `@iq*` / `@q*` quant suffixes in /model parsing, but the provider/runtime routing path in `src/plugins/providers.ts` had its own naive `stripModelProfileSuffix` that still truncated `qwen3.6-27b@iq3_xxs` → `qwen3.6-27b`. That sent the wrong (or no) model id to LM Studio, matching the second symptom in openclaw#71474. Reuse `splitTrailingAuthProfile` from the canonical splitter so both user-facing paths honor the same protected-suffix rules. Export the two helpers via `__testing` and add 12 dedicated regression tests covering: - bare model ids - provider/model - @Profile stripping - @q* and @iq* quant preservation (regression for openclaw#71474) - @<n>bit quant preservation - profile-after-quant (`...@iq3_xxs@work`)
|
Good catch — fixed in c84c4c3. Rather than duplicate the protected-suffix regex, I had Also exported
All 192 tests across |
Fixes #71474
Problem
LM Studio names imatrix-quant variants like
qwen3.6-27b@iq3_xxs(note:iqprefix, notq).splitTrailingAuthProfileonly special-cased@q*/<n>bitsuffixes, so:was parsed as
model="lmstudio/qwen3.6-27b"+profile="iq3_xxs", producingGatewayRequestError: model not allowed: lmstudio/qwen3.6-27band (when it didn't fail) sending the truncated id to LM Studio, which then picked an arbitrary quant.Fix
Extend the protected quant pattern to allow an optional
iprefix:This keeps
@iq3_xxs,@iq4_xs, etc. as part of the model id while still allowing an explicit auth profile via a second@suffix (e.g.lmstudio/foo@iq3_xxs@work).Tests
Added regression cases in:
src/agents/model-ref-profile.test.tssrc/agents/model-selection.test.tssrc/auto-reply/model.test.tsVerified the splitter against representative inputs:
lmstudio/qwen3.6-27b@iq3_xxslmstudio/qwen3.6-27b@iq3_xxslmstudio-mb-pro/gemma-4-31b-it@q8_0@q8_0lmstudio/qwen3.6-27b@iq3_xxs@work@iq3_xxsworkopenai/gpt-5@workopenai/gpt-5workopenai/@cf/openai/gpt-oss-20b@cf:defaultopenai/@cf/openai/gpt-oss-20bcf:default