Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3531,6 +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");
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(
Expand Down
9 changes: 8 additions & 1 deletion apps/server/src/orchestration-v2/ProviderSessionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import * as CommandOutputHub from "./CommandOutputHub.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";

Expand Down Expand Up @@ -2023,10 +2024,16 @@ export const layerWithOptions = (
cause,
});
yield* Ref.set(entry.eventSubscribers, new Map());
// 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,
});
yield* releaseEntry({
providerSessionId: entry.runtime.providerSessionId,
reason: "runtime_error",
detail: Cause.pretty(cause),
detail: makeProviderFailure({ cause }).message,
}).pipe(logReleaseFailure(entry.runtime.providerSessionId));
}),
),
Expand Down
Loading