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
13 type RuntimeMode,13 type RuntimeMode,
14 type TurnId,14 type TurnId,
15} from "@t3tools/contracts";15} from "@t3tools/contracts";
16import { Cache, Cause, Duration, Effect, Equal, Layer, Option, Schema, Stream } from "effect";16import { Cache, Cause, Duration, Effect, Layer, Option, Schema, Stream } from "effect";
17import { makeDrainableWorker } from "@t3tools/shared/DrainableWorker";17import { makeDrainableWorker } from "@t3tools/shared/DrainableWorker";
18 18
19import { resolveThreadWorkspaceCwd } from "../../checkpointing/Utils.ts";19import { resolveThreadWorkspaceCwd } from "../../checkpointing/Utils.ts";
@@ -301,7 +301,7 @@ const make = Effect.gen(function* () { · 281 unmodified lines
301 const shouldRestartForModelSelectionChange =301 const shouldRestartForModelSelectionChange =
302 currentProvider === "claudeAgent" &&302 currentProvider === "claudeAgent" &&
303 requestedModelSelection !== undefined &&303 requestedModelSelection !== undefined &&
304 !Equal.equals(previousModelSelection, requestedModelSelection);304 JSON.stringify(previousModelSelection) !== JSON.stringify(requestedModelSelection);
305 305
306 if (306 if (
307 !runtimeModeChanged &&307 !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