Fix stale provider baseUrl overriding explicit config in merge mode#39103
Fix stale provider baseUrl overriding explicit config in merge mode#39103BigUncle wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR correctly fixes a merge-mode bug where a stale Issues found:
Confidence Score: 3/5
|
5f3a194 to
1219318
Compare
|
Thanks — addressed. I rebased onto the latest I also reran: pnpm vitest run src/agents/models-config*.test.tsResult: 23 files passed / 89 tests passed locally. |
Land #39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
|
Landed via maintainer flow. What I did:
SHAs:
Thanks @BigUncle for the contribution. |
* main: (133 commits) reduce image size, offer slim image (openclaw#38479) fix(security): harden install base drift cleanup fix(agents): respect explicit provider baseUrl in merge mode (openclaw#39103) fix(agents): apply contextTokens cap for compaction threshold (openclaw#39099) fix(exec): block dangerous override-only env pivots fix(security): stage installs before publish fix(daemon): normalise whitespace in checkTokenDrift to prevent false-positive warning (openclaw#39108) fix(security): harden fs-safe copy writes refactor: dedupe bluebubbles webhook auth test setup refactor: dedupe discord native command test scaffolding refactor: dedupe anthropic probe target test setup refactor: dedupe minimax provider auth test setup refactor: dedupe runtime snapshot test fixtures fix: harden zip extraction writes fix(tests): stabilize diffs localReq headers (supersedes openclaw#39063) fix: harden workspace skill path containment fix(agents): land openclaw#38935 from @MumuTW fix(models): land openclaw#38947 from @davidemanuelDEV fix(gateway): land openclaw#39064 from @Narcooo fix(models-auth): land openclaw#38951 from @MumuTW ...
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
…w#39103) Land openclaw#39103 by @BigUncle. Co-authored-by: BigUncle <[email protected]>
Summary
This fixes a merge-mode bug where a stale provider
baseUrlalready stored in:~/.openclaw/agents/<agent>/agent/models.jsoncould override a newer explicit
baseUrlfromopenclaw.json.After this change, an explicit provider
baseUrlfrom config wins over stale runtime state.Problem
In
models.mode: "merge", updating a provider endpoint inopenclaw.jsoncould appear to have no effect.A typical failure mode was:
models.jsonstill had an old provider URLopenclaw.jsonwas correctedmodels.jsonRoot Cause
src/agents/models-config.tspreserved stale provider values from existing runtimemodels.jsonduring merge.That meant later explicit config changes could be masked by old runtime state.
There is also a provider-key matching edge case here: explicit-config detection must stay consistent with trimmed /
normalized provider keys, so entries like
" custom "still match runtime keycustom.What Changed
baseUrlin the current configbaseUrlonly when the current config does not explicitly provide oneapiKey/ SecretRef preservation behavior intactTests
Updated regression coverage in:
src/agents/models-config.fills-missing-provider-apikey-from-env-var.test.tsAdded coverage for:
baseUrloverrides stale runtimemodels.jsonbaseUrl" custom "->custom)Validated with:
pnpm vitest run src/agents/models-config*.test.tsResult:
23test files passed89tests passedUser-visible Effect
After this patch:
openclaw.jsonwill correctly propagate into regeneratedmodels.jsonbaseUrlconfig will still work correctly when provider keys need trimmed / normalized matchingReproduction Case
Concrete case that reproduced this bug:
http://192.168.1.8/v1http://192.168.1.8:8317/v1models.jsonwas manually fixedThis patch makes the explicit config URL win automatically.
Related
This PR addresses the same bug family discussed in:
It is also closely related to earlier PR attempts:
My understanding is that those earlier PRs were addressing the same stale merge behavior family.
This patch focuses specifically on explicit provider
baseUrlprecedence in merge mode, and adds regression coverage for the trimmed / normalized provider-key matching case.There is also prior provider-specific precedent in:
This PR applies the same principle more generally to merge-mode provider
baseUrlhandling.