Skip to content
Merged
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 @@ -2493,6 +2493,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 @@ -2059,10 +2060,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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new log annotation contains the raw Cause, which can include arbitrary provider output, credentials, or unbounded defect text. Could you log only a normalized, bounded failure category here? The original cause is already retained in the subscriber failure event.

Suggested change
cause,
failureCategory: "runtime_error",

Posted via Macroscope — Effect Service Conventions

});
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