Skip to content

[Bug]: ACP checkpoint restore can stall when MCP session cleanup stops responding #38236

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

Not sure

Steps to reproduce

  1. Start a thread with an ACP provider that connects to T3 tools through MCP-over-ACP.
  2. Let the agent initialize its T3 MCP connection and finish a turn.
  3. Make the MCP endpoint accept session DELETE requests without returning a response.
  4. Restore an earlier checkpoint in the thread.

Expected behavior

Checkpoint restore finishes or reports an error after a bounded wait, and the thread remains usable.

Actual behavior

Checkpoint restore remains pending while MCP cleanup waits for the unanswered DELETE, blocking further runtime transitions and session callbacks.

Impact

Major degradation or frequent failure. Users of MCP-over-ACP providers can lose use of a thread during checkpoint restore when the MCP endpoint stalls during session termination.

Version or commit

main at 705c7f2479. The cause is at packages/provider-acp/src/server/mcpOverAcpBridge.ts:186.

Environment

Linux x64, the repository's own tests.

Logs or stack traces

Runtime scope must close despite an unanswered MCP DELETE: expected undefined to be defined
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/packages/provider-acp/src/server/mcpOverAcpBridge.test.ts b/packages/provider-acp/src/server/mcpOverAcpBridge.test.ts
index d60da55bb9..32198218a0 100644
--- a/packages/provider-acp/src/server/mcpOverAcpBridge.test.ts
+++ b/packages/provider-acp/src/server/mcpOverAcpBridge.test.ts
@@ -1,6 +1,9 @@
 import { describe, expect, it } from "@effect/vitest";
 import * as Effect from "effect/Effect";
 import * as Fiber from "effect/Fiber";
+import * as Exit from "effect/Exit";
+import * as Scope from "effect/Scope";
+import * as TestClock from "effect/testing/TestClock";
 
 import { makeAcpMcpOverAcpBridge } from "./mcpOverAcpBridge.ts";
 
@@ -165,6 +168,57 @@ describe("AcpMcpOverAcpBridge", () => {
     }),
   );
 
+  it.effect("finishes runtime cleanup when the MCP endpoint never answers DELETE", () =>
+    Effect.gen(function* () {
+      const deleteStarted = Promise.withResolvers<void>();
+      const deleteResponse = Promise.withResolvers<Response>();
+      const bridge = yield* makeAcpMcpOverAcpBridge({
+        endpoint: "http://127.0.0.1:1/mcp",
+        authorization: "Bearer bridge-test",
+        allocateConnectionId: Effect.succeed("connection-1"),
+        fetchImplementation: (_url, init) => {
+          if (init?.method === "DELETE") {
+            deleteStarted.resolve();
+            return deleteResponse.promise;
+          }
+          const request = JSON.parse(String(init?.body)) as { readonly id: number };
+          return Promise.resolve(
+            new Response(
+              JSON.stringify({
+                jsonrpc: "2.0",
+                id: request.id,
+                result: { protocolVersion: "2025-06-18" },
+              }),
+              {
+                headers: { "content-type": "application/json", "mcp-session-id": "session-42" },
+              },
+            ),
+          );
+        },
+      });
+      const { connectionId } = yield* bridge.connect({ serverId: "t3-code" });
+      yield* bridge.message({ connectionId, method: "initialize" });
+      const scope = yield* Scope.make();
+      yield* Scope.addFinalizer(scope, bridge.dispose);
+      const closing = yield* Scope.close(scope, Exit.void).pipe(Effect.forkChild);
+      yield* Effect.gen(function* () {
+        yield* Effect.promise(() => deleteStarted.promise);
+        yield* TestClock.adjust("1 minute");
+        expect(
+          closing.pollUnsafe(),
+          "Runtime scope must close despite an unanswered MCP DELETE",
+        ).toBeDefined();
+      }).pipe(
+        Effect.ensuring(
+          Effect.gen(function* () {
+            deleteResponse.resolve(new Response(null, { status: 204 }));
+            yield* Fiber.join(closing);
+          }),
+        ),
+      );
+    }),
+  );
+
   it.effect("rejects unknown servers, connections, and oversized messages", () =>
     Effect.gen(function* () {
       const bridge = yield* makeAcpMcpOverAcpBridge({
cd packages/provider-acp && pnpm exec vp test run --config ../../vite.config.ts src/server/mcpOverAcpBridge.test.ts

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions