Skip to content

Commit e3a4c86

Browse files
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 <juliusmarminge@users.noreply.github.com>
1 parent 454d97f commit e3a4c86

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/server/src/codexAppServerManager.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
type ProviderTurnStartResult,
1818
} from "@t3tools/contracts";
1919
import type * as NodeServices from "@effect/platform-node/NodeServices";
20-
import { Effect, Exit, ServiceMap, Scope, Stream } from "effect";
20+
import { Cause, Effect, Exit, ServiceMap, Scope, Stream } from "effect";
2121
import type { ChildProcessSpawner } from "effect/unstable/process";
2222
import { makeRuntimeCommand, spawnManagedCommand } from "./processRunner";
2323

@@ -566,8 +566,11 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
566566
return;
567567
}
568568

569+
const squashed = Cause.squash(cause);
569570
const message =
570-
cause instanceof Error ? cause.message : "codex app-server process errored.";
571+
squashed instanceof Error
572+
? squashed.message
573+
: "codex app-server process errored.";
571574
this.updateSession(context, {
572575
status: "error",
573576
activeTurnId: undefined,

0 commit comments

Comments
 (0)