From e11ef1b1195baa98c6586daaca99e3ef03f3f862 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 4 Apr 2026 23:50:48 +0000 Subject: [PATCH] fix: prevent double-wrapping of WebPortInspectionError and remove unused extraWebPortCount - In WebPortInspector, the mapError handler now checks if the error is already a WebPortInspectionError (via _tag) and passes it through, preserving the original 'HTTP probe timed out' detail instead of re-wrapping it with 'Failed to execute HTTP probe request'. - Remove unused extraWebPortCount field from TerminalRuntimeStatus interface and its computation in terminalRuntimeStatus(). --- .../src/process/Layers/WebPortInspector.ts | 25 ++++++++++++------- .../src/components/ThreadTerminalDrawer.tsx | 3 --- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/apps/server/src/process/Layers/WebPortInspector.ts b/apps/server/src/process/Layers/WebPortInspector.ts index 6b7e1a6475..f8686f4e49 100644 --- a/apps/server/src/process/Layers/WebPortInspector.ts +++ b/apps/server/src/process/Layers/WebPortInspector.ts @@ -127,15 +127,22 @@ const makeWebPortInspector = Effect.gen(function* () { onSome: Effect.succeed, }), ), - Effect.mapError( - (cause) => - new WebPortInspectionError({ - port, - host, - detail: "Failed to execute HTTP probe request.", - cause, - }), - ), + Effect.mapError((cause) => { + if ( + typeof cause === "object" && + cause !== null && + "_tag" in cause && + cause._tag === "WebPortInspectionError" + ) { + return cause as WebPortInspectionError; + } + return new WebPortInspectionError({ + port, + host, + detail: "Failed to execute HTTP probe request.", + cause, + }); + }), ); }); diff --git a/apps/web/src/components/ThreadTerminalDrawer.tsx b/apps/web/src/components/ThreadTerminalDrawer.tsx index 71243fa1b3..33d789bac9 100644 --- a/apps/web/src/components/ThreadTerminalDrawer.tsx +++ b/apps/web/src/components/ThreadTerminalDrawer.tsx @@ -78,7 +78,6 @@ export function selectPendingTerminalEventEntries( interface TerminalRuntimeStatus { label: string; primaryWebPort: number | null; - extraWebPortCount: number; } function normalizeRunningPorts(rawPorts: number[] | undefined): number[] { @@ -99,7 +98,6 @@ function terminalRuntimeStatus( const runningPorts = normalizeRunningPorts(runningTerminalPorts[terminalId]); const primaryWebPort = runningPorts[0] ?? null; - const extraWebPortCount = runningPorts.length > 1 ? runningPorts.length - 1 : 0; const label = runningPorts.length === 0 ? "Terminal process running" @@ -110,7 +108,6 @@ function terminalRuntimeStatus( return { label, primaryWebPort, - extraWebPortCount, }; }