From ccfb8355613e6c8c740a654ef38e2d26aa20e028 Mon Sep 17 00:00:00 2001 From: AdEx-Partners-DE Date: Tue, 13 Oct 2026 18:47:02 +0200 Subject: [PATCH 1/3] fix(server): a provider session that fails at runtime no longer puts a stack trace in the thread banner When a provider event stream fails, ProviderSessionManager released the session with Cause.pretty(cause) as its detail, and that detail becomes the session's lastError, which the thread error banner shows. Users saw the error class, internal session id and file:/// stack frames. Store the same redacted message makeProviderFailure already gives the failed run, and log the full cause as a warning instead. Co-Authored-By: Claude Opus 5.5 --- .../src/orchestration-v2/ProviderSessionManager.test.ts | 5 +++++ .../src/orchestration-v2/ProviderSessionManager.ts | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts b/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts index ceb230b008940..7543d51d745a9 100644 --- a/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts +++ b/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts @@ -3315,6 +3315,11 @@ it.effect("ProviderSessionManagerV2 releases sessions when provider event stream assert.isTrue(Option.isNone(liveSession)); assert.equal(runtimeState.closeCount, 1); assert.equal(projection.providerSessions.at(-1)?.status, "error"); + // The user sees the redacted reason, not the error's stack trace. + const lastError = projection.providerSessions.at(-1)?.lastError ?? ""; + assert.include(lastError, "provider event stream closed unexpectedly"); + assert.notInclude(lastError, "Failed while streaming"); + assert.notInclude(lastError, "process exited"); }); yield* effect.pipe( diff --git a/apps/server/src/orchestration-v2/ProviderSessionManager.ts b/apps/server/src/orchestration-v2/ProviderSessionManager.ts index f0ec5282ef5b5..0a0cc75aa3487 100644 --- a/apps/server/src/orchestration-v2/ProviderSessionManager.ts +++ b/apps/server/src/orchestration-v2/ProviderSessionManager.ts @@ -48,6 +48,7 @@ import * as EventSink from "./EventSink.ts"; import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator"; import * as ProviderEventIngestor from "./ProviderEventIngestor.ts"; import * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter"; +import { makeProviderFailure } from "@t3tools/provider-core/server/failure"; import * as ProviderAdapterRegistry from "./ProviderAdapterRegistry.ts"; import * as ProjectionStore from "./ProjectionStore.ts"; @@ -1985,10 +1986,16 @@ export const layerWithOptions = ( cause, }); yield* Ref.set(entry.eventSubscribers, new Map()); + // The session's lastError is shown to the user, so it carries the + // same redacted reason as the failed run; the full cause goes to the log. + yield* Effect.logWarning("orchestration-v2.provider-session-runtime-failed", { + providerSessionId: entry.runtime.providerSessionId, + cause: Cause.pretty(cause), + }); yield* releaseEntry({ providerSessionId: entry.runtime.providerSessionId, reason: "runtime_error", - detail: Cause.pretty(cause), + detail: makeProviderFailure({ cause: Cause.squash(cause) }).message, }).pipe(logReleaseFailure(entry.runtime.providerSessionId)); }), ), From be44a953edb07c260b35247111406b3564e5955b Mon Sep 17 00:00:00 2001 From: AdEx-Partners-DE Date: Tue, 13 Oct 2026 19:18:09 +0200 Subject: [PATCH 2/3] fix(server): log the runtime failure's cause like the other release warnings Pass the Cause itself, as the other ProviderSessionManager warnings do, instead of a pre-rendered Cause.pretty string. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/orchestration-v2/ProviderSessionManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/server/src/orchestration-v2/ProviderSessionManager.ts b/apps/server/src/orchestration-v2/ProviderSessionManager.ts index 0a0cc75aa3487..fbde7ca3399b4 100644 --- a/apps/server/src/orchestration-v2/ProviderSessionManager.ts +++ b/apps/server/src/orchestration-v2/ProviderSessionManager.ts @@ -1990,7 +1990,7 @@ export const layerWithOptions = ( // same redacted reason as the failed run; the full cause goes to the log. yield* Effect.logWarning("orchestration-v2.provider-session-runtime-failed", { providerSessionId: entry.runtime.providerSessionId, - cause: Cause.pretty(cause), + cause, }); yield* releaseEntry({ providerSessionId: entry.runtime.providerSessionId, From 29cc30a9cd3c46d79f2749cd7445042d84b617b8 Mon Sep 17 00:00:00 2001 From: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Date: Sun, 18 Oct 2026 17:39:51 -0700 Subject: [PATCH 3/3] fix(server): simplify session failure message handling --- .../src/orchestration-v2/ProviderSessionManager.test.ts | 9 ++++----- .../src/orchestration-v2/ProviderSessionManager.ts | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts b/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts index 8afac86fd667f..8667c5b7aae91 100644 --- a/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts +++ b/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts @@ -3531,11 +3531,10 @@ it.effect("ProviderSessionManagerV2 releases sessions when provider event stream assert.isTrue(Option.isNone(liveSession)); assert.equal(runtimeState.closeCount, 1); assert.equal(projection.providerSessions.at(-1)?.status, "error"); - // The user sees the redacted reason, not the error's stack trace. - const lastError = projection.providerSessions.at(-1)?.lastError ?? ""; - assert.include(lastError, "provider event stream closed unexpectedly"); - assert.notInclude(lastError, "Failed while streaming"); - assert.notInclude(lastError, "process exited"); + assert.equal( + projection.providerSessions.at(-1)?.lastError, + "The provider event stream closed unexpectedly. Retry the turn; if it keeps failing, check the provider and server logs.", + ); }); yield* effect.pipe( diff --git a/apps/server/src/orchestration-v2/ProviderSessionManager.ts b/apps/server/src/orchestration-v2/ProviderSessionManager.ts index f11c6f4271749..33a078ed4bc9c 100644 --- a/apps/server/src/orchestration-v2/ProviderSessionManager.ts +++ b/apps/server/src/orchestration-v2/ProviderSessionManager.ts @@ -2024,8 +2024,8 @@ export const layerWithOptions = ( cause, }); yield* Ref.set(entry.eventSubscribers, new Map()); - // The session's lastError is shown to the user, so it carries the - // same redacted reason as the failed run; the full cause goes to the log. + // lastError is the thread banner, so it gets the same bounded + // message as a failed turn; the raw cause survives only in the log. yield* Effect.logWarning("orchestration-v2.provider-session-runtime-failed", { providerSessionId: entry.runtime.providerSessionId, cause, @@ -2033,7 +2033,7 @@ export const layerWithOptions = ( yield* releaseEntry({ providerSessionId: entry.runtime.providerSessionId, reason: "runtime_error", - detail: makeProviderFailure({ cause: Cause.squash(cause) }).message, + detail: makeProviderFailure({ cause }).message, }).pipe(logReleaseFailure(entry.runtime.providerSessionId)); }), ),