Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Problem

When compaction is triggered with a specific model (e.g., /compact -m openai:gpt-4.1-mini), the backend was incorrectly persisting that model to the workspace's AI settings, overwriting the user's preferred model.

After compaction completed, the workspace would be set to use the compaction model instead of the model the user had selected.

Root Cause

Regression introduced in 1ae0377 (#1203) which added a "safety net" to persist AI settings from sendMessage/resumeStream for cross-device consistency. This safety net didn't account for compaction requests which intentionally use a different (often cheaper/faster) model.

cc @tomaskoubek (regressor)

Fix

Skip persisting AI settings when:

  • sendMessage is called with muxMetadata.type === "compaction-request"
  • resumeStream is called with options.mode === "compact"

Testing

  • Added IPC test verifying compaction requests don't override workspace AI settings
  • Existing updateAISettings test still passes

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

When compaction is triggered with a specific model (e.g., /compact -m
openai:gpt-4.1-mini), the backend was incorrectly persisting that model
to the workspace's AI settings, overwriting the user's preferred model.

This was a regression introduced in 1ae0377 (#1203) which added a
"safety net" to persist AI settings from sendMessage/resumeStream for
cross-device consistency. The fix skips this persistence for:
- sendMessage with muxMetadata.type === "compaction-request"
- resumeStream with options.mode === "compact"

Added test to verify compaction requests don't override workspace AI
settings.
@ammar-agent ammar-agent force-pushed the fix/compaction-model-persistence branch from d35df82 to c9b7d3f Compare December 21, 2025 02:10
@ammario
Copy link
Member

ammario commented Dec 21, 2025

cc @ThomasK33

apologies @ tomaskoubek for the tag, you can disregard this

@ammario ammario enabled auto-merge December 21, 2025 02:19
@ammario ammario disabled auto-merge December 21, 2025 02:22
@ammario ammario merged commit 4e6ee27 into main Dec 21, 2025
19 checks passed
@ammario ammario deleted the fix/compaction-model-persistence branch December 21, 2025 02:22
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.

2 participants