fix: use Cause.squash to extract error from Effect Cause in attachProcessListeners

Effect.matchCauseEffect passes an Effect Cause<E> to onFailure, not a
JavaScript Error. The previous 'cause instanceof Error' check always
evaluated to false, losing the actual error details. Use Cause.squash
to convert the Effect Cause into a concrete error before checking.

Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
Cursor AgentandJulius Marminge committed 2026-03-05 19:23:57 +00:00
1 parent 454d97f0cf
commit e3a4c867b5
1 file changed
+5 -2
+5 -2
View File
@@ -17,7 +17,7 @@ import {
type ProviderTurnStartResult,
} from "@t3tools/contracts";
import type * as NodeServices from "@effect/platform-node/NodeServices";
import { Effect, Exit, ServiceMap, Scope, Stream } from "effect";
import { Cause, Effect, Exit, ServiceMap, Scope, Stream } from "effect";
import type { ChildProcessSpawner } from "effect/unstable/process";
import { makeRuntimeCommand, spawnManagedCommand } from "./processRunner";
@@ -566,8 +566,11 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
return;
}
const squashed = Cause.squash(cause);
const message =
cause instanceof Error ? cause.message : "codex app-server process errored.";
squashed instanceof Error
? squashed.message
: "codex app-server process errored.";
this.updateSession(context, {
status: "error",
activeTurnId: undefined,