Skip to content

Fix ACP question cancellation and reject lost late answers - #3701

Merged
ymichael merged 2 commits into
mainfrom
fix/3408-acp-late-answers
Sep 15, 2026
Merged

ymichael merged 2 commits into
mainfrom
fix/3408-acp-late-answers

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

When a Cursor ACP question timed out, the MCP client abandoned its request but BB's proxy ignored the cancellation notification. The server interaction stayed pending, so a late answer dismissed the form and was recorded as resolved even though the agent could no longer receive it. See #3408 and the original investigation.

What changed

  • Propagate MCP cancellation and disconnects through the ACP bridge and runtime to the daemon's HTTP request and the server plugin's abort signal. Clean up pending calls when turns/sessions end or providers fail, and suppress cancelled replies.
  • Reject submissions without a live interaction waiter, so interrupted or orphaned questions cannot report successful delivery. Existing UI removes interrupted questions and shows an error for stale submissions.
  • Validate cancellation messages and scope runtime request IDs to their provider process, including safe cleanup when IDs are reused.
  • Bump HOST_DAEMON_PROTOCOL_VERSION from 208 to 209 for the changed server/daemon cancellation semantics. No public CLI or Plugin SDK surface changes.

This fixes lifecycle correctness; it does not increase Cursor's approximately 60-second MCP timeout or implement native/asynchronous questions. Normal answers and existing progress-token heartbeats remain supported.

How you verified

  • Before editing, reproduced the complete lost-answer flow through a deterministic ACP provider using the real MCP SDK, BB proxy/bridge/runtime/daemon/server/plugin/database, and dev-browser. The late answer was recorded as resolved while the SDK rejected its abandoned request ID.
  • Also reproduced with real Cursor CLI 2026.06.19-20-24-33-653a7fb on macOS. With the fix, cancellation interrupted the question after 59.998 seconds; a subsequent question delivered the selected Postgres answer. A deliberately stale browser form showed HTTP 409 on submission. Reporter WSL and live OpenCode were not tested.
  • New regressions failed against original implementations at the proxy/bridge, runtime, daemon and server boundaries. Coverage includes cancellation, disconnects, terminal provider errors, normal/progress-aware calls, duplicate answers, stale request IDs and missing waiters.
  • Rebased on current main and reran the full ACP, bridge-protocol and agent-runtime suites; focused daemon and server interaction suites; and Turbo typecheck/build for app, CLI, server, daemon, runtime and bridge packages. All 1,061 tests in those post-rebase selections passed. Changed-file lint, formatting and diff checks also pass.
pnpm exec turbo run test --filter=@bb/provider-bridge-acp --filter=@bb/provider-bridge-protocol --filter=@bb/agent-runtime
pnpm exec turbo run test --filter=@bb/host-daemon -- --run src/app.test.ts src/server-client.test.ts src/runtime-manager.test.ts src/server-connection.test.ts
pnpm exec turbo run test --filter=@bb/server -- --run test/internal/internal-tool-call-regressions.test.ts test/internal/internal-events-tool-calls.test.ts test/services/pending-interactions.test.ts test/public/public-thread-interactions.test.ts
pnpm exec turbo run typecheck build --filter=@bb/app --filter=@bb/cli --filter=@bb/server --filter=@bb/host-daemon --filter=@bb/agent-runtime --filter=@bb/provider-bridge-acp --filter=@bb/provider-bridge-protocol

Browser checks above preceded the rebase. The earlier adjacent UI and question-plugin suites passed 44 tests.

Fixes #3408

AGENT GENERATED

@ymichael
ymichael merged commit 19e5543 into main Sep 15, 2026
16 checks passed
@ymichael
ymichael deleted the fix/3408-acp-late-answers branch September 15, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AskUserQuestion response is lost after ACP MCP timeout

1 participant