Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): recycle Cursor sessions after transport failures #12337

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

Showing 2 changed files with 48 additions and 12 deletions.

x
0 of 2 viewed, 2 left
47 additions and 12 deletionsapps/server/src/provider/Layers/CursorAdapter.test.tsModified
View file
@@ -184,23 +184,27 @@
}),
​
- it.effect("rejects a Cursor transport error returned as a successful assistant answer", () =>
+ it.effect("recycles a Cursor session after a transport error answer", () =>
Effect.gen(function* () {
const adapter = yield* CursorAdapter;
const settings = yield* ServerSettingsService;
const threadId = ThreadId.make("cursor-transport-error-answer");
+ const tempDir = yield* Effect.promise(() =>
+ NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "cursor-transport-error-")),
+ );
+ const requestLogPath = NodePath.join(tempDir, "requests.ndjson");
+ const argvLogPath = NodePath.join(tempDir, "argv.txt");
+ const exitLogPath = NodePath.join(tempDir, "exit.log");
+ yield* Effect.promise(() => NodeFSP.writeFile(requestLogPath, "", "utf8"));
const wrapperPath = yield* Effect.promise(() =>
- makeMockAgentWrapper({
- T3_ACP_PROMPT_RESPONSE_TEXT: "Error: RetriableError: WritableIterable is closed",
+ makeProbeWrapper(requestLogPath, argvLogPath, {
+ T3_ACP_EXIT_LOG_PATH: exitLogPath,
+ T3_ACP_PROMPT_RESPONSE_TEXT:
+ "Error: RetriableError: [canceled] http/2 stream closed with error code CANCEL (0x8)",
}),
yield* settings.updateSettings({ providers: { cursor: { binaryPath: wrapperPath } } });
- const runtimeEventsFiber = yield* adapter.streamEvents.pipe(
- Stream.takeUntil((event) => event.type === "session.exited"),
- Stream.runCollect,