Skip to content

[AI-assisted] fix: /model command should clear session overrides#663

Closed
roshanasingh4 wants to merge 1 commit into
openclaw:mainfrom
roshanasingh4:fix/646-model-command-clears-session-overrides
Closed

[AI-assisted] fix: /model command should clear session overrides#663
roshanasingh4 wants to merge 1 commit into
openclaw:mainfrom
roshanasingh4:fix/646-model-command-clears-session-overrides

Conversation

@roshanasingh4

Copy link
Copy Markdown
Contributor

Fixes #646

Problem

When /model command updates the default model, session overrides (modelOverride, providerOverride) persisted in the session store would continue to take precedence over the new default. This made the /model command appear ineffective.

Root Cause

Sessions store modelOverride and providerOverride fields. When resolving which model to use, the code checks session overrides first, then falls back to config defaults. Even after /model updates the config default, old session overrides remained.

Fix

After updating the config, the /model command now:

  1. Loads the session store
  2. Clears modelOverride and providerOverride from all sessions
  3. Saves the updated session store
  4. Logs how many sessions were cleared

This ensures the new default model takes effect immediately for all active sessions.


[AI-assisted] - Generated with z.ai GLM-4.7

Testing: Lightly tested - Logic reviewed, session store APIs are well-tested. The fix uses try-catch for graceful error handling if session store is unavailable.

Fixes openclaw#646

When /model command updates the default model, session overrides
(modelOverride, providerOverride) persisted in session store would
continue to take precedence over the new default. This made the /model
command appear ineffective.

After updating the config, the command now:
- Loads the session store
- Clears modelOverride and providerOverride from all sessions
- Saves the updated session store
- Logs how many sessions were cleared

This ensures the new default model takes effect immediately for all
active sessions.

[AI-assisted] - Generated with z.ai GLM-4.7
[Tested: Lightly tested - Logic reviewed, session store APIs are well-tested]
@roshanasingh4

Copy link
Copy Markdown
Contributor Author

This PR was created in error. Issue #646 was already fixed by @steipete with commit b99eb4c - the fix routes session state init for native commands through CommandTargetSessionKey so /model mutates the actual chat session (not the slash command session). Closing as duplicate.

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.

[Bug]: /model doesn't actually change model

1 participant