Skip to content

Commit 150a00c

Browse files
sheetsyncclaude
andcommitted
fix: keep setup output ending in ")" and report stale reserved-port actions
- Treat a line as the shell's echo of the setup wrapper only when it is the wrapper line itself or follows a prompt. Matching any line ending in ")" or "end" dropped real output such as "Ready (vite)". - Show an error when the server no longer has the action with a reserved port, instead of ignoring the click. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f4c6495 commit 150a00c

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎apps/server/src/project/ProjectSetupScriptRunner.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ it.effect("resolves setup scripts through the standalone project service", () =>
138138
type: "output",
139139
threadId: "thread-1",
140140
terminalId: "setup-setup",
141-
data: `${write.mock.calls[1]?.[0].data}\r\nDownloading 10%\rDownloading 20%\r\nDone\n`,
141+
data: `${write.mock.calls[1]?.[0].data}\r\nDownloading 10%\rDownloading 20%\r\nReady (vite)\r\nsubsh> )\r\nDone\n`,
142142
});
143-
assert.deepEqual(lines, ["Downloading 10%", "Downloading 20%", "Done"]);
143+
assert.deepEqual(lines, ["Downloading 10%", "Downloading 20%", "Ready (vite)", "Done"]);
144144
yield* listener({ type: "closed", threadId: "thread-1", terminalId: "setup-setup" });
145145

146146
const settle = yield* runner.runForThread({

‎apps/server/src/project/ProjectSetupScriptRunner.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export const make = Effect.gen(function* () {
225225
readonly terminalId: string;
226226
readonly sentinel: string;
227227
readonly sentinelPattern: RegExp;
228-
/** The shell echoes typed input; lines ending with these are the wrapper, not output. */
228+
/** The shell echoes typed input, alone or after its prompt; those lines are the wrapper, not output. */
229229
readonly echoedWrapperLines: ReadonlyArray<string>;
230230
readonly onOutputLine: ((line: string) => Effect.Effect<void>) | undefined;
231231
}) =>
@@ -261,7 +261,9 @@ export const make = Effect.gen(function* () {
261261
if (
262262
cleaned.length === 0 ||
263263
cleaned.includes(input.sentinel) ||
264-
input.echoedWrapperLines.some((echoed) => cleaned.endsWith(echoed)) ||
264+
input.echoedWrapperLines.some(
265+
(echoed) => cleaned === echoed || cleaned.endsWith(` ${echoed}`),
266+
) ||
265267
input.onOutputLine === undefined
266268
) {
267269
return Effect.void;

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3497,7 +3497,14 @@ export default function ChatView(props: ChatViewProps) {
34973497
}
34983498
return;
34993499
}
3500-
if (result.value.status === "no-script" || !activeThreadRef) return;
3500+
if (result.value.status === "no-script") {
3501+
setThreadError(
3502+
activeThreadId,
3503+
`"${script.name}" is no longer saved with a reserved port. Check the action and try again.`,
3504+
);
3505+
return;
3506+
}
3507+
if (!activeThreadRef) return;
35013508
previewPort = result.value.port;
35023509
if (result.value.threadId === activeThreadId) {
35033510
setTerminalUiLaunchContext({

0 commit comments

Comments
 (0)