Skip to content

Commit e11ef1b

Browse files
committed
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().
1 parent 6aac79c commit e11ef1b

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

apps/server/src/process/Layers/WebPortInspector.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,22 @@ const makeWebPortInspector = Effect.gen(function* () {
127127
onSome: Effect.succeed,
128128
}),
129129
),
130-
Effect.mapError(
131-
(cause) =>
132-
new WebPortInspectionError({
133-
port,
134-
host,
135-
detail: "Failed to execute HTTP probe request.",
136-
cause,
137-
}),
138-
),
130+
Effect.mapError((cause) => {
131+
if (
132+
typeof cause === "object" &&
133+
cause !== null &&
134+
"_tag" in cause &&
135+
cause._tag === "WebPortInspectionError"
136+
) {
137+
return cause as WebPortInspectionError;
138+
}
139+
return new WebPortInspectionError({
140+
port,
141+
host,
142+
detail: "Failed to execute HTTP probe request.",
143+
cause,
144+
});
145+
}),
139146
);
140147
});
141148

apps/web/src/components/ThreadTerminalDrawer.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export function selectPendingTerminalEventEntries(
7878
interface TerminalRuntimeStatus {
7979
label: string;
8080
primaryWebPort: number | null;
81-
extraWebPortCount: number;
8281
}
8382

8483
function normalizeRunningPorts(rawPorts: number[] | undefined): number[] {
@@ -99,7 +98,6 @@ function terminalRuntimeStatus(
9998

10099
const runningPorts = normalizeRunningPorts(runningTerminalPorts[terminalId]);
101100
const primaryWebPort = runningPorts[0] ?? null;
102-
const extraWebPortCount = runningPorts.length > 1 ? runningPorts.length - 1 : 0;
103101
const label =
104102
runningPorts.length === 0
105103
? "Terminal process running"
@@ -110,7 +108,6 @@ function terminalRuntimeStatus(
110108
return {
111109
label,
112110
primaryWebPort,
113-
extraWebPortCount,
114111
};
115112
}
116113

0 commit comments

Comments
 (0)