The best way to control Claude Code, Codex and more from any computer or phone
fix(cursor): an aborted Cursor SDK stall no longer stops the server (#23354)
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Gourav Kumar Dhiman committed
Nov 15, 2026 at 10:18 UTC
4c9a87309df17cba60df154456bc1d3434b6243a
2 files changed
+34
packages/provider-cursor/src/server/CursorSdk.test.ts
+16
@@ -68,6 +68,22 @@ describe("CursorSdk unhandled rejection guard", () => {
68
}),
69
);
70
71
+ it.effect("keeps the server running when the SDK aborts a stalled request", () =>
72
+ Effect.gen(function* () {
73
+ const stall = new DOMException("This operation was aborted", "AbortError");
74
+ stall.stack = "AbortError: This operation was aborted\n at Is.onStall (689.js:1:111536)";
75
+ assert.deepStrictEqual(yield* rejectThroughGuard(stall), []);
76
+ }),
77
+ );
78
+
79
+ it.effect("still exits on an abort that was not raised from onStall", () =>
80
+ Effect.gen(function* () {
81
+ const abort = new DOMException("onStall was aborted", "AbortError");
82
+ abort.stack = "AbortError: onStall was aborted\n at somewhereElse (app.js:1:1)";
83
+ assert.deepStrictEqual(yield* rejectThroughGuard(abort), [[1]]);
84
+ }),
85
+ );
86
+
87
it.effect("keeps the server running when the SDK writes after its request stream ended", () =>
88
Effect.gen(function* () {
89
// Shaped like `ConnectError.from(e, Code.Aborted)` from the SDK's connect-node body pump.
packages/provider-cursor/src/server/CursorSdk.ts
+18
@@ -55,6 +55,20 @@ function isCursorClosedStreamWrite(reason: unknown): boolean {
55
);
56
}
57
58
+/**
59
+ * When the SDK's stall detector fires it aborts the request, then rejects a promise
60
+ * nothing awaits. The abort is the SDK's own recovery, so it must not stop the server.
61
+ * Only an abort raised from `onStall` counts; any other AbortError is still unexpected.
62
+ */
63
+function isCursorStallAbort(reason: unknown): boolean {
64
+ return (
65
+ reason instanceof Error &&
66
+ reason.name === "AbortError" &&
67
+ typeof reason.stack === "string" &&
68
+ /^\s+at (?:\S+\.)?onStall\b/m.test(reason.stack)
69
+ );
70
+}
71
+
72
function onUnhandledRejection(reason: unknown): void {
73
if (isCursorShellSpawnFailure(reason)) {
74
console.error("Cursor shell spawn failed. The server will keep running.", reason);
@@ -64,6 +78,10 @@ function onUnhandledRejection(reason: unknown): void {
78
console.error("Cursor SDK wrote to a closed stream. The server will keep running.");
79
return;
80
}
81
+ if (isCursorStallAbort(reason)) {
82
+ console.error("Cursor SDK aborted a stalled request. The server will keep running.");
83
+ return;
84
+ }
85
if (process.listenerCount("unhandledRejection") > 1) {
86
return;
87
}