Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(provider-cursor): finalize turn when SDK wait hangs after turn-ended #27185

Closedcainant(GitHub profile, opens in a new tab)wants to merge 14 commits intomain fromrefs/pull/27185/headopened View on GitHub

Showing 4 changed files with 41 additions and 0 deletions (loading 2).

x
0 of 4 viewed, 4 left
40 additions and 0 deletionspackages/provider-cursor/src/server/CursorAgentSdk.test.tsModified
View file
@@ -3,6 +3,9 @@
import { assert, describe, it } from "@effect/vitest";
import { ProviderSessionId, ThreadId } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
+import * as Deferred from "effect/Deferred";
+import * as Fiber from "effect/Fiber";
+import * as TestClock from "effect/testing/TestClock";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Exit from "effect/Exit";
@@ -19,6 +22,7 @@
let agentCloseFailure: unknown;
// The local store lists runs oldest first, like the real SDK.
let storedRuns: Array<{ readonly id: string; readonly status: string }> = [];
+ let onDelta: ((input: { readonly update: unknown }) => Promise<void>) | undefined;
const runWait = vi.fn(async () => ({
id: "run-cursor-agent-sdk-test",
requestId: "request-cursor-agent-sdk-test",
@@ -40,6 +44,7 @@
_message: unknown,
options: { readonly onDelta?: (input: { readonly update: unknown }) => Promise<void> },
) => {
+ onDelta = options.onDelta;
runOperations.push("run.start");
if (storedRuns.some((run) => run.status === "running")) {
throw new Error("Agent agent-cursor-agent-sdk-test already has active run");
@@ -88,6 +93,7 @@