Skip to content

Commit a3bc32b

Browse files
committed
Scope setup script catch to only handle runForThread failures
Add Effect.ignoreCause to the activity dispatch inside Effect.tap so that errors from appendSetupScriptActivity don't propagate to the outer Effect.catch handler. Previously, if the setup script started successfully but the activity dispatch failed, the catch handler would incorrectly emit a setup-script.failed activity even though the terminal was already open and the script command had already been written.
1 parent d3b8b2e commit a3bc32b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

apps/server/src/wsServer.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -674,11 +674,10 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
674674
payload,
675675
tone: "info",
676676
}),
677-
]).pipe(Effect.asVoid);
677+
]).pipe(Effect.asVoid, Effect.ignoreCause({ log: true }));
678678
}),
679679
Effect.catch((error) => {
680-
const detail =
681-
error instanceof Error ? error.message : "Unknown setup failure.";
680+
const detail = error instanceof Error ? error.message : "Unknown setup failure.";
682681
return appendSetupScriptActivity({
683682
threadId: command.threadId,
684683
kind: "setup-script.failed",
@@ -692,14 +691,11 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
692691
}).pipe(
693692
Effect.ignoreCause({ log: false }),
694693
Effect.zipRight(
695-
Effect.logWarning(
696-
"bootstrap turn start failed to launch setup script",
697-
{
698-
threadId: command.threadId,
699-
worktreePath,
700-
detail,
701-
},
702-
),
694+
Effect.logWarning("bootstrap turn start failed to launch setup script", {
695+
threadId: command.threadId,
696+
worktreePath,
697+
detail,
698+
}),
703699
),
704700
);
705701
}),

0 commit comments

Comments
 (0)