Skip to content

[Bug]: Compaction resets session model override to previous provider #95696

Description

@davidxu00

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

After switching models via /model in a session, the UI correctly reflects the new model. However, once compaction triggers, the session's model override is lost and the actual API call reverts to the previous model provider.

Steps to reproduce

  1. Start with default local model (custom-127-0-0-1-1234/qwen/Qwen3.6-27b)
  2. Switch to an external API model via /model deepseek-v4-pro (custom-api-deepseek-com/deepseek-v4-pro)
  3. Confirm switch succeeded — UI shows DeepSeek
  4. Switch back to local model via /model qwen3.6-27b-q8
  5. UI shows Qwen, conversation works normally
  6. When context reaches compaction threshold and compaction triggers, the actual API call silently reverts to DeepSeek
  7. Subsequent compactions continue using DeepSeek

Expected behavior

After compaction, the session should retain the user's most recently selected model.

Actual behavior

After compaction, the model override is overwritten and reverts to the pre-compaction model (DeepSeek), causing a mismatch between the UI display and the actual model being called.

OpenClaw version

2026.6.9 (c645ec4)

Operating system

Linux 6.6.114.1-microsoft-standard-WSL2

Install method

No response

Model

custom-127-0-0-1-1234/qwen/Qwen3.6-27b

Provider / routing chain

custom-127-0-0-1-1234/qwen/Qwen3.6-27b

Additional provider/model setup details

  • Default model: custom-127-0-0-1-1234/qwen/Qwen3.6-27b
  • Switched model: custom-api-deepseek-com/deepseek-v4-pro
  • Context window: 131072
  • session_status shows Qwen, but actual API requests are routed to DeepSeek. This is a discrepancy between UI state and runtime behavior.

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions