fix: add gateway-safe default model unpin#4
Open
EdgeClaws wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
openclaw.jsonmutation explicit-only via--set-primarydefault|reset|unpinmodel mode through Gatewaysessions.patch {model:null}--pin-exactfor the distinct intentional case: hard-pin the same model as the configured primary withsource=user, disabling fallbacks--pin-exactcombinations with reset mode or--set-primaryliveModelSwitchPendingfields remain after resetsource=userpins disable configured model fallbackIntent contract
model:null/default|reset|unpin= inherit the configured primary and its fallback policy--pin-exact= the same inheritance-safe null reset--pin-exact= intentionalsource=userhard pin, even when the target currently equals the configured primary; configured fallbacks are disabled--set-primary <model>= update the configured primary, then unpin sessions so they inherit itThis distinction is deliberate: equality with the current primary does not erase a caller's explicit no-fallback hard-pin intent.
Why
OpenClaw 2026.7.1 sets
liveModelSwitchPendingfor changed non-null model patches without checking whether the session is active. An idle session can therefore carry the flag into a later user turn and surfaceFailoverError: Live session model switch requested. The native null-reset path explicitly deletes the flag and keeps the configured fallback chain enabled.This PR deliberately does not synthesize or clear the pending flag through online file surgery. Gateway reset uses
model:null; direct deletion is limited to offline maintenance with Gateway stopped.Verification
/opt/homebrew/bin/bash -n scripts/switch.sh/opt/homebrew/bin/bash -n scripts/test.sh/opt/homebrew/bin/bash scripts/test.sh→ 8/8 passed--dry-run --agent mainagainst 343 sessions correctly identified and deferred the one active session; config mutation remained disabled--pin-exactsemantics, guards, tests, and documentation are reviewer-readyCompatibility note
This intentionally changes the default config behavior: a model target no longer edits
openclaw.jsonunless--set-primaryis supplied.The script's documented macOS execution path remains Homebrew Bash 5 (
/opt/homebrew/bin/bash). The pre-existing script does not parse under macOS system Bash 3.2; this PR does not introduce or worsen that limitation.