Repository navigation
fix(providers): fold developer role to system for moonshot - #7584
Conversation
api.moonshot.ai rejects role 'developer' with a 400. The native /v1/chat/completions passthrough only folds the role on an explicit foldDeveloperRoleToSystem record, so let registry entries record it (seeded and backfilled like openaiChatEofTolerance, user value wins) and record true for moonshot.
|
✅ Deterministic PR hygiene checks passed. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 8
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 733aa9f9e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // api.moonshot.ai answers `400 Invalid request: role 'developer' is not allowed`. The | ||
| // translated route already folds when nothing is recorded, but the native | ||
| // /v1/chat/completions passthrough only folds on an explicit record, so record it here. | ||
| foldDeveloperRoleToSystem: true, |
There was a problem hiding this comment.
Scope folding to verified Moonshot endpoints
When a user selects the supported Custom base-URL option and points this preset at an OpenAI-compatible endpoint that accepts developer, this registry-wide value is still seeded and backfilled because the overridable moonshot row matches by provider name. Native Chat then silently rewrites the caller's developer messages to system, changing prompt semantics for a destination about which no compatibility fact was established. Apply this default only to the verified Moonshot endpoints, leaving arbitrary custom destinations unset unless the operator explicitly opts in.
Useful? React with 👍 / 👎.
| // api.moonshot.ai answers `400 Invalid request: role 'developer' is not allowed`. The | ||
| // translated route already folds when nothing is recorded, but the native | ||
| // /v1/chat/completions passthrough only folds on an explicit record, so record it here. | ||
| foldDeveloperRoleToSystem: true, |
There was a problem hiding this comment.
Document the user-visible Moonshot default
This changes existing Moonshot native Chat requests from preserving developer to sending system, including through resolve-time backfill of saved configurations, but the commit contains no docs-site/ update describing the new preset default or the explicit false escape hatch. The scoped source instructions require documentation whenever configuration or user-visible behavior changes.
AGENTS.md reference: src/AGENTS.md:L29-L29
Useful? React with 👍 / 👎.
Summary
Fixes #7583.
api.moonshot.aianswers400 Invalid request: role 'developer' is not allowed. The translated route already folds the role tosystemwhen nothing is recorded, but the native/v1/chat/completionspassthrough only rewrites it on an explicitfoldDeveloperRoleToSystemrecord, and themoonshotpreset recorded nothing.ProviderRegistryEntrygainsfoldDeveloperRoleToSystem, wired through the same paths asopenaiChatEofTolerance: seed (providerConfigSeed, OAuth seed, fill-only backfill), static policy scalar, androutedProviderConfigresolve-time fill. A user value still wins, so an operator can setfalseexplicitly.moonshotrecordsfoldDeveloperRoleToSystem: true. Existing saved moonshot configs pick it up at resolve time without a re-add.Verification
moonshot→ 400role 'developer' is not allowed(protocolTrace.mode: native,same-wire-native). After settingfoldDeveloperRoleToSystem: trueon the provider, a request with adevelopermessage completes.tsc --noEmitpasses.tests/providers/moonshot-developer-role.test.ts(seed records the fold, pre-existing config is backfilled, explicitfalsewins, native passthrough rewritesdeveloper→system) plus one assertion inprovider-registry-parity.test.ts. Not run locally; left to CI.Checklist
Summary by CodeRabbit