From 11e9d78da44156ab1299a55cda80bae91cdbde4b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 27 Apr 2026 18:34:06 +0000 Subject: [PATCH] fix: use deriveLogicalProjectKeyFromSettings as fallback in syncProjects call sites Both syncProjects call sites in service.ts were falling back to derivePhysicalProjectKey(project) when the logical key map lookup missed, while all other call sites across the codebase consistently fall back to deriveLogicalProjectKeyFromSettings(project, settings). This latent inconsistency could cause the UI store's logical key to diverge from the logical key computed during thread creation and sidebar grouping, potentially breaking project expansion state and thread routing. --- apps/web/src/environments/runtime/service.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/web/src/environments/runtime/service.ts b/apps/web/src/environments/runtime/service.ts index 40e6e09fc1..b0ab397b97 100644 --- a/apps/web/src/environments/runtime/service.ts +++ b/apps/web/src/environments/runtime/service.ts @@ -61,7 +61,11 @@ import { useTerminalStateStore } from "~/terminalStateStore"; import { useUiStateStore } from "~/uiStateStore"; import { WsTransport } from "../../rpc/wsTransport"; import { createWsRpcClient, type WsRpcClient } from "../../rpc/wsRpcClient"; -import { buildLogicalProjectKeyMap, derivePhysicalProjectKey } from "../../logicalProject"; +import { + buildLogicalProjectKeyMap, + deriveLogicalProjectKeyFromSettings, + derivePhysicalProjectKey, +} from "../../logicalProject"; import { getClientSettings } from "~/hooks/useSettings"; type EnvironmentServiceState = { @@ -476,7 +480,7 @@ function syncProjectUiFromStore() { key: derivePhysicalProjectKey(project), logicalKey: logicalKeyByPhysicalKey.get(derivePhysicalProjectKey(project)) ?? - derivePhysicalProjectKey(project), + deriveLogicalProjectKeyFromSettings(project, clientSettings), cwd: project.cwd, })), ); @@ -554,7 +558,7 @@ function applyRecoveredEventBatch( key: derivePhysicalProjectKey(project), logicalKey: logicalKeyByPhysicalKey.get(derivePhysicalProjectKey(project)) ?? - derivePhysicalProjectKey(project), + deriveLogicalProjectKeyFromSettings(project, clientSettings), cwd: project.cwd, })), );