fix: reassign default provider when deleting the current default#1108
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5e758ab66
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| await providerService.setDefaultAccount(replacementDefault.id); | ||
| await syncDefaultProviderToRuntime(replacementDefault.id); | ||
| } | ||
| await syncDeletedProviderToRuntime( |
There was a problem hiding this comment.
Avoid deleting the replacement provider's runtime entry
When the replacement default is another account for the same built-in vendor, this call removes the runtime key that syncDefaultProviderToRuntime(replacementDefault.id) just wrote. Built-in providers use the vendor id as the OpenClaw provider key (getOpenClawProviderKey returns e.g. moonshot for every Moonshot account), and removeProviderFromOpenClaw deletes models.providers[provider], auth profiles, and default model refs for that key, so deleting the old default Moonshot account after promoting a newer Moonshot account leaves the newly promoted account missing from openclaw.json. Delete the old runtime entry before writing the replacement, or skip removal when the old and replacement runtime keys collide.
Useful? React with 👍 / 👎.
No description provided.