Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): settle a turn when its provider session closes #16181

ClosedAdamulek123(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/16181/headopened View on GitHub

Showing 8 changed files with 51 additions and 15 deletions (loading 5).

x
0 of 8 viewed, 8 left
41 additions and 15 deletionsapps/server/src/orchestration-v2/Adapters/CursorAdapterV2.test.tsModified
View file
@@ -15,11 +15,14 @@
} from "@t3tools/contracts";
import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
+import * as Exit from "effect/Exit";
+import * as Fiber from "effect/Fiber";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
import * as Path from "effect/Path";
import * as Schema from "effect/Schema";
+import * as Scope from "effect/Scope";
import * as Stream from "effect/Stream";
​
import * as ServerConfig from "../../config.ts";
@@ -45,10 +48,15 @@
{ status: "error", model: "custom-fable", lateModel: undefined },
{ status: "finished", model: undefined, lateModel: "gpt-6-sol" },
{ status: "finished", model: "gpt-6-sol", lateModel: null },
+ { status: "teardown", model: undefined, lateModel: undefined },
] as const)(
"projects Cursor tasks: $status, late model $lateModel",
({ status, model, lateModel }) =>
Effect.gen(function* () {
+ // A teardown ends the run by closing the session, never by the SDK
+ // answering, so the collected events have to start before it closes.
+ const sessionScope = yield* Scope.make();
+ yield* Effect.addFinalizer(() => Scope.close(sessionScope, Exit.void));
const fileSystem = yield* FileSystem.FileSystem;