fix(moonshot): accept moonshotai/<model> as direct-API alias#74946
Conversation
|
Codex review: needs changes before merge. Summary Reproducibility: yes. The linked issue provides concrete logs and current-main source shows Next step before merge Security Review findings
Review detailsBest possible solution: Add runtime provider-id normalization for Do we have a high-confidence way to reproduce the issue? Yes. The linked issue provides concrete logs and current-main source shows Is this the best way to solve the issue? No. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 13dc14d43ec2. |
Users copying a Kimi model id from OpenRouter (which lists models as
moonshotai/kimi-k2.6) and dropping the openrouter/ prefix to hit the
direct API saw 'Unknown model: moonshotai/kimi-k2.6'. The direct
provider was registered only as moonshot, so only moonshot/kimi-k2.6
resolved. The OpenRouter org slug, Moonshot AI's own branding, and the
existing moonshot manifest's modelPricing.providers.moonshot.openRouter
entry all use the moonshotai form — only the direct-API name disagreed.
The OpenAI plugin already shipped the manifest pattern for this exact
shape (azure-openai-responses → openai), and there's a planner test
that pins it down. Reuse the same modelCatalog.aliases mechanism in
the moonshot manifest:
"modelCatalog": {
"aliases": {
"moonshotai": { "provider": "moonshot" }
},
...
}
This keeps moonshot as the canonical id (no rename, no breaking
change for operators whose configs already say moonshot/...). The
catalog planner now resolves moonshotai/<model> through moonshot's
existing models list, baseUrl, api class, discovery, pricing, and
auth choices unchanged. providers, providerEndpoints,
providerRequest, providerAuthEnvVars, and providerAuthChoices stay
keyed on moonshot — no duplication, no provider-id divergence.
Test: new planner case in
src/model-catalog/manifest-planner.test.ts mirrors the existing
azure-openai-responses test — asserts that with providerFilter:
'moonshotai' the planner returns rows with ref 'moonshotai/<model>'
and the moonshot catalog's api/baseUrl/discovery values. The existing
moonshot plugin-registration contract test continues to pass against
the modified manifest (canonical providerIds: ['moonshot']
unchanged).
Closes openclaw#73876
e9d91de to
5905d2b
Compare
steipete
left a comment
There was a problem hiding this comment.
No blocking findings.
This now fixes the reported direct-provider path, not just the catalog display path: normalizeProviderId() maps both moonshotai and moonshot-ai to canonical moonshot, the Moonshot manifest exposes both catalog aliases, and resolver tests prove moonshotai/kimi-k2.6 plus moonshot-ai/kimi-k2.6 resolve through the direct Moonshot config.
Verification:
pnpm test src/agents/model-selection.test.ts src/agents/pi-embedded-runner/model.test.ts src/model-catalog/manifest-planner.test.tspnpm test src/plugins/contracts/plugin-registration.moonshot.contract.test.tsgit diff --checkOPENCLAW_TESTBOX=0 pnpm check:changed
moonshotstays as the canonical provider id — operators whoseconfigs already say
moonshot/...are unchanged. The catalog plannernow resolves
moonshotai/<model>through moonshot's existing modelslist,
baseUrl,apiclass, discovery, pricing, and auth choices.providers,providerEndpoints,providerRequest,providerAuthEnvVars, andproviderAuthChoicesall stay keyed onmoonshot— no duplication, no provider-id divergence.Tests
src/model-catalog/manifest-planner.test.ts:plans moonshotai alias rows from the moonshot provider catalogcase mirrors the existing
azure-openai-responsestest. Assertsthat with
providerFilter: "moonshotai"the planner returns rowswith
ref: "moonshotai/<model>"and the moonshot catalog'sapi/baseUrl/discovery values.moonshotplugin-registration contract test(
src/plugins/contracts/plugin-registration.moonshot.contract.test.ts)continues to pass against the modified manifest (canonical
providerIds: ["moonshot"]unchanged — alias is at the cataloglayer, not the provider-registration layer).
Verification
Closes #73876