History

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.

Cursor Agent committed 7 months ago

Commit 7d160491 parent e0d43881 file · +2 −2Browse files

Unified · Split

apps/server/src/orchestration/Layers/ProviderCommandReactor.ts+2−2
@@ -13,7 +13,7 @@ import { · 12 unmodified lines
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* () { · 281 unmodified lines
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 &&

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t