Skip to content

fix: reassign default provider when deleting the current default#1108

Merged
su8su merged 1 commit into
mainfrom
fix_remove_default_model
Jun 9, 2026
Merged

fix: reassign default provider when deleting the current default#1108
su8su merged 1 commit into
mainfrom
fix_remove_default_model

Conversation

@su8su

@su8su su8su commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@su8su su8su merged commit 07c5c4c into main Jun 9, 2026
6 checks passed
@su8su su8su deleted the fix_remove_default_model branch June 9, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant