Skip to content

Commit 7d16049

Browse files
committed
Fix: replace Equal.equals with JSON.stringify comparison for ModelSelection
Equal.equals falls back to reference equality (===) for plain objects without the Equal trait. Since ModelSelection objects are plain JS objects created via Schema.Struct/Schema.Union, two identical selections would always compare as different, causing unnecessary session restarts on every Claude turn.
1 parent e0d4388 commit 7d16049

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/server/src/orchestration/Layers/ProviderCommandReactor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
type RuntimeMode,
1414
type TurnId,
1515
} from "@t3tools/contracts";
16-
import { Cache, Cause, Duration, Effect, Equal, Layer, Option, Schema, Stream } from "effect";
16+
import { Cache, Cause, Duration, Effect, Layer, Option, Schema, Stream } from "effect";
1717
import { makeDrainableWorker } from "@t3tools/shared/DrainableWorker";
1818

1919
import { resolveThreadWorkspaceCwd } from "../../checkpointing/Utils.ts";
@@ -301,7 +301,7 @@ const make = Effect.gen(function* () {
301301
const shouldRestartForModelSelectionChange =
302302
currentProvider === "claudeAgent" &&
303303
requestedModelSelection !== undefined &&
304-
!Equal.equals(previousModelSelection, requestedModelSelection);
304+
JSON.stringify(previousModelSelection) !== JSON.stringify(requestedModelSelection);
305305

306306
if (
307307
!runtimeModeChanged &&

0 commit comments

Comments
 (0)