Skip to content

feat(coding-agent): add session-only model switch - #840

Open
paralin wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
paralin:feat/session-model-switch
Open

feat(coding-agent): add session-only model switch#840
paralin wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
paralin:feat/session-model-switch

Conversation

@paralin

@paralin paralin commented Aug 7, 2026

Copy link
Copy Markdown

The /model command changes the active model and saves that selection as the configured default. This adds /switch, which uses the same exact-match lookup, autocomplete, provider authentication, and selector UI while changing only the current session model.

The persistence choice now reaches the real session backend rather than suppressing only InteractiveMode's duplicate settings write. In-process and daemon connections carry persistDefault; AgentSession.setModel still records the session's model_change, but skips the global settings update for /switch. /model keeps its existing behavior.

Daemon clients capability-gate session-only model selection so an older daemon fails clearly instead of silently persisting it. A real-session regression verifies that /switch leaves the configured default unchanged, alongside focused command, connection, protocol, and UI tests.

This addresses the /switch persistence defect reported in #1248. That issue's separate mid-run SDK/extension loop-switching proposal is outside this PR.

Verification: 6 focused test files, 255 tests passed; npm run check passed through the pre-commit hook.

Note

Add /switch slash command for session-only model selection without persisting the default

  • Adds a new /switch slash command alongside the existing /model command; /model saves the selection as the configured default, /switch changes the model for the current session only.
  • Threads a persistDefault flag through AgentSession.setModel, AgentConnection.setModel, and the interactive mode model selection flow to control whether the global default is updated.
  • Bumps DAEMON_SCHEMA_REVISION to 17 and adds a session_model_selection server capability; daemon connections throw DaemonCapabilityUnavailableError if session-only selection is requested against a server that lacks this capability.

Macroscope summarized 8f9799f.

The model command changes both the active session and the configured default,
so users cannot try another model without changing future sessions. A client-
only suppression is insufficient because AgentSession persists every model
selection through the in-process and daemon paths.

Add a switch command that reuses the model selector while requesting a
session-local selection. Carry that persistence choice through both agent
connections and the daemon protocol, then let AgentSession skip the settings
write while retaining the session model-change record. Keep model's existing
default-setting behavior unchanged.

Capability-gate session-local daemon requests so an older daemon fails clearly
instead of silently persisting the selection. The switch now affects the
current session without replacing the user's configured model.

Signed-off-by: Christian Stewart <christian@aperture.us>
@paralin
paralin force-pushed the feat/session-model-switch branch from 1feb642 to 8f9799f Compare August 11, 2026 20:08
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.

1 participant