Fix: re-propagate interrupt causes in sendTurnForThread catchCause handler

The inner Effect.catchCause around sendTurnForThread was unconditionally
catching all causes, including interrupts. During shutdown or fiber
cancellation, this would create a spurious provider.turn.start.failed
activity and swallow the interrupt signal before the outer
processDomainEventSafely handler could re-propagate it.

Add a Cause.hasInterruptsOnly check (matching the pattern used elsewhere
in the codebase) to re-fail with the cause when it is interrupt-only.

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge committed 2026-03-17 00:34:13 +00:00
1 parent b577cb5326
commit ae48a85907
1 file changed
+7 -4
@@ -498,16 +498,19 @@ const make = Effect.gen(function* () {
interactionMode: event.payload.interactionMode,
createdAt: event.payload.createdAt,
}).pipe(
Effect.catchCause((cause) =>
appendProviderFailureActivity({
Effect.catchCause((cause) => {
if (Cause.hasInterruptsOnly(cause)) {
return Effect.failCause(cause);
}
return appendProviderFailureActivity({
threadId: event.payload.threadId,
kind: "provider.turn.start.failed",
summary: "Provider turn start failed",
detail: Cause.pretty(cause),
turnId: null,
createdAt: event.payload.createdAt,
}),
),
});
}),
);
});