fix(controller): clear model config when no providers configured#1080
fix(controller): clear model config when no providers configured#1080
Conversation
The version was accidentally downgraded to 0.1.10 for local nightly update testing and merged to main. Restore to 0.1.11.
After logging out of link with no BYOK providers, the controller still wrote a bare model name (e.g. "nexu-chat") into both openclaw.json and nexu-runtime-model.json. OpenClaw resolved this bare name via its built-in registry and continued serving requests, even though the UI correctly showed no model configured. When no model providers are configured: - Strip agents.defaults.model and per-agent model from the compiled config before writing openclaw.json (hot-reload safe, no gateway restart) - Delete nexu-runtime-model.json so OpenClaw has no model override When providers exist (BYOK or link), behavior is unchanged.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c8c70e665
ℹ️ 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".
| async clear(): Promise<void> { | ||
| const { unlink } = await import("node:fs/promises"); | ||
| try { | ||
| await unlink(this.env.openclawRuntimeModelStatePath); |
There was a problem hiding this comment.
Overwrite runtime model state instead of deleting it
Deleting the runtime-model state file here does not actually clear the active override while OpenClaw stays running: the nexu-runtime-model plugin’s loadState() returns its in-memory cachedState on file-read errors (including ENOENT), so the previously selected model keeps being applied after logout until process restart. In the no-provider flow this means conversations can still route with the stale model despite the sync intending to disable model usage.
Useful? React with 👍 / 👎.
| if (!hasAnyProvider) { | ||
| if (compiled.agents.defaults?.model) { | ||
| compiled.agents.defaults = { |
There was a problem hiding this comment.
Compute config diff after mutating providerless config
The config hash check (shouldPushConfig(compiled)) happens before this new providerless-model stripping block mutates compiled, but noteConfigWritten stores the post-mutation hash. In the no-provider state, each later sync compares the unstripped compile output against the previously stored stripped hash and reports configPushed=true even when nothing changed, which causes repeated unnecessary touchAnySkillMarker() calls and incorrect push status responses.
Useful? React with 👍 / 👎.
What
退出 link 账号后,如果没有用户自己的 BYOK provider,清除 OpenClaw 的模型配置,使 agent 无法继续回话。
Why
退出 link 后,controller 从
openclaw.json中移除了models.providers,UI 正确显示"没有配置模型"。但agents.defaults.model.primary仍然保留了一个裸模型名(如nexu-chat),OpenClaw 通过内置 registry 解析这个裸名,继续正常回话——与 UI 状态不一致。How
When no model providers are configured (no BYOK keys, no link, no litellm):
agents.defaults.modeland per-agentmodelfromopenclaw.jsonbefore writing. This is hot-reload safe (agents.list→ dynamic reads, no gateway restart).nexu-runtime-model.json— remove the runtime model state file so OpenClaw has no model override.When providers exist (BYOK or link), behavior is completely unchanged.
Affected areas
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpassespnpm generate-typesrun (if API routes/schemas changed) — N/A