fix(providers): accept moonshotai as alias for direct moonshot provider (#73876)#74162
fix(providers): accept moonshotai as alias for direct moonshot provider (#73876)#74162hclsys wants to merge 1 commit into
Conversation
Greptile SummaryAdds Confidence Score: 5/5Safe to merge — the change is minimal, follows existing patterns, and is well-covered by tests. Single targeted alias addition with no logic branching, no new dependencies, and comprehensive regression tests. No security surface, no data-path changes. No files require special attention. Reviews (1): Last reviewed commit: "fix(providers): accept moonshotai as ali..." | Re-trigger Greptile |
|
Codex review: needs maintainer review before merge. What this changes: This PR adds Maintainer follow-up before merge: This is already an open contributor implementation PR for a narrow valid bug; the remaining action is maintainer review, CI triage, and merge or requested revisions rather than an automated replacement PR. Security review: Security review cleared: The diff only changes provider-id normalization, a focused unit test, and a changelog entry; it introduces no security-sensitive or supply-chain surface. Review detailsBest possible solution: Land this PR or an equivalent narrow main change that normalizes Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against fa467c20e327. |
This comment was marked as low quality.
This comment was marked as low quality.
|
Codex review: needs maintainer review before merge. What this changes: This PR adds Maintainer follow-up before merge: This is an open contributor implementation PR with a narrow, apparently valid fix and low security surface; the remaining action is normal maintainer review, CI validation, and merge or requested revisions rather than an automated replacement PR. Review detailsBest possible solution: Land this PR or an equivalent narrow main change that normalizes Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 1390eadd9289. |
…er (openclaw#73876) OpenRouter's catalog and Moonshot AI's own branding both use the `moonshotai` org slug (e.g. `moonshotai/kimi-k2.6` is what users see at openrouter.ai). openclaw's direct Moonshot provider is registered as `moonshot`, so users who copy the model ref from OpenRouter without the `openrouter/` prefix hit `Unknown model: moonshotai/kimi-k2.6` despite having a working direct Moonshot API key. Add `moonshotai` and `moonshot-ai` to the `normalizeProviderId` alias list so they resolve to the canonical `moonshot` provider id, matching the existing alias pattern used for `qwencloud` → `qwen`, `z.ai` → `zai`, `kimi-code` → `kimi`, etc. Existing `moonshot/<model>` configs, auth profiles, plugin id (`moonshot`), and docs are entirely unchanged. The fix is purely a normalization expansion. A new focused unit test (`src/agents/provider-id.test.ts`, the first unit test specifically for `normalizeProviderId` / `findNormalizedProviderValue`) covers: - 14 cases including all existing aliases (qwen, zai, kimi, bedrock, volcengine) plus the new moonshotai/moonshot-ai mappings - A regression for `findNormalizedProviderValue` matching alias keys against canonical config entries and vice versa Sign-Off: hclsys
Fixes #73876.
Problem
`normalizeProviderId` in `src/agents/provider-id.ts` recognizes `moonshot` as the direct provider id. But model refs in the wild routinely arrive as `moonshotai/` (the form OpenRouter uses, and how Moonshot AI brands itself), so a config carrying `moonshotai/kimi-k2.6` fails to resolve to the direct Moonshot provider and surfaces `Unknown model`.
Fix
Add `moonshotai` and `moonshot-ai` to the alias table so they normalize to `moonshot`. Existing `moonshot/` configs, auth profiles, the plugin id, and docs are unchanged.
Tests
New `provider-id.test.ts` asserts: