Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): close sessions when provider turns abort #8859

Closedhahasagined(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8859/headopened View on GitHub

Showing 2 changed files with 183 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
183 additions and 0 deletionsapps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.tsModified
View file
@@ -921,6 +921,189 @@
await waitForThread(harness.readModel, (thread) => thread.session?.status === "ready");
});
​
+ it("closes the session lifecycle when the active turn is aborted", async () => {
+ const harness = await createHarness();
+ const now = "2026-01-01T00:00:00.000Z";
+​
+ // Regression: an interrupt whose abort lands while the provider is already
+ // idle emits `turn.aborted` instead of `turn.completed`. Without an
+ // ingestion handler the thread stayed "running" with a dangling active
+ // turn forever: stop looked like a no-op and settling was refused.
+ harness.emit({
+ type: "turn.started",
+ eventId: asEventId("evt-turn-started-abort-lifecycle"),
+ provider: ProviderDriverKind.make("opencode"),
+ createdAt: now,
+ threadId: asThreadId("thread-1"),
+ turnId: asTurnId("turn-abort-lifecycle"),
+ });
+​
+ await waitForThread(
+ harness.readModel,
+ (thread) =>
+ thread.session?.status === "running" &&
+ thread.session?.activeTurnId === "turn-abort-lifecycle",
+ );
+​
+ harness.emit({
+ type: "content.delta",