Fix sameModelSelectionOptions to compare only options, not full ModelSelection

The function was comparing the entire ModelSelection (provider, model, options)
via JSON.stringify, but shouldRestartForModelSelectionChange is meant to restart
claudeAgent sessions only when options change. Since both adapters report
sessionModelSwitch: "in-session", model-name-only changes should use the
in-session setModel call, not trigger a full session restart.

Changed the comparison to only look at the options field of ModelSelection.
This commit is contained in:
Cursor Agent committed 2026-03-24 21:44:42 +00:00
1 parent 96d6160ea5
commit de46c2f9bd
1 file changed
+1 -1
@@ -78,7 +78,7 @@ const TEMP_WORKTREE_BRANCH_PATTERN = new RegExp(`^${WORKTREE_BRANCH_PREFIX}\\/[0
const sameModelSelectionOptions = (
left: ModelSelection | undefined,
right: ModelSelection | undefined,
): boolean => JSON.stringify(left ?? null) === JSON.stringify(right ?? null);
): boolean => JSON.stringify(left?.options ?? null) === JSON.stringify(right?.options ?? null);
function isUnknownPendingApprovalRequestError(cause: Cause.Cause<ProviderServiceError>): boolean {
const error = Cause.squash(cause);