Skip to content

fix(mcpdo): name a connection_lost abort instead of tallying [object Object] - #2868

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2866-load-abort-reason-message
Nov 4, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2866-load-abort-reason-message

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2866

Found in the v2.14.0 release smoke (#2865 / PR #2867). It is a regression from #2835 / PR #2855.

Problem

When the connection drops during an mcpdo tools/call --load run, the run stops with connection_lost as intended. However, the calls that were still in flight are tallied as [object Object]. In 2.13.0 they read AbortError: This operation was aborted.

The cause: runLoadOnClient aborted its stop controller with the LoadStop object, and the same stop.signal was the client's ambient request signal. The SDK's request cancel() turns an abort reason into new SdkError(RequestTimeout, String(reason)), and uses String(reason) for the notifications/cancelled reason too. So every in-flight call rejected with the message [object Object]. A debug patch on the built daemon confirmed this: SdkError: [object Object] … at cancel … at InspectorClient.onStatus.

Fix

clients/mcpdo/src/daemon/server.ts only:

  • In-flight requests get their own AbortController (abortRequests). It is aborted alongside stop, but never with the LoadStop:
    • When the caller hangs up, it gets a plain abort(), which is an AbortError, the same as 2.13.0.
    • When the connection drops, it gets new DOMException("load run stopped: <detail>", "AbortError").
  • abortRequests.signal is used for the primary's ambient signal, for each extra connection's ambient signal, and for the extra-connection dial.
  • The engine still gets stop.signal, which carries the LoadStop, so stoppedEarly is unchanged.

Tests

clients/mcpdo/__tests__/daemon-load.test.ts:

  • The connection-drop test now also asserts that the requests' signal aborts with a DOMException whose string form is AbortError: load run stopped: the connection went disconnected.
  • The caller-hang-up test asserts a plain AbortError.
  • Three assertions that equated the ambient signal with the run's signal now assert the separate signal: the primary, the extras sharing it, and the dial.
  • With server.ts reverted, 2 of the 18 tests fail, including the connection-drop test.

Hand smoke

With the built mcpdo, I ran mcpdo connect load --config …, then mcpdo @load tools/call echo message:=x --load --load-concurrency 4 --load-duration 20, and killed the server 2 seconds in:

  Outcomes:   10513 ok, 0 tool errors, 4 errors
  Top errors:
    4× AbortError: load run stopped: the connection went error
  Stopped early (connection_lost): the connection went error

Before the fix, the same run showed 4× [object Object].

npm run local:gate is green (6m51s).

🤖 Generated with Claude Code

…Object]

A --load run that loses its connection aborted its in-flight calls with
the LoadStop object it hands the engine. The SDK stringifies an abort
reason into the request's rejection (and its notifications/cancelled
reason), so each such call was tallied as "[object Object]".

In-flight requests now get their own AbortController, aborted alongside
the run's but with a plain abort when the caller hangs up and a named
AbortError when the connection drops. The engine's signal still carries
the LoadStop, so stoppedEarly is unchanged.

Closes #2866

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the cancellation-handling changes that make connection-loss errors readable.

No open issues 🎉

What changed in this PR

Fixes #2866 in mcpdo’s load-run handling so connection-loss cancellations produce readable errors instead of [object Object], while preserving the engine’s structured stop reason.

Changes:

  • Separates request cancellation from the load engine’s stop signal.
  • Applies the request signal to primary requests, extra connections, and connection setup.
  • Updates tests to verify signal separation and readable abort reasons for connection loss and caller disconnects.
File Description
clients/​mcpdo/​src/​daemon/​server.ts Adds a dedicated request abort controller with readable cancellation reasons.
clients/​mcpdo/​__tests__/​daemon-load.test.ts Verifies abort reasons and shared request-signal wiring across connections.

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
Member Author

Copilot review loop closed: round 1 (review 5771948861) was clean. It had no inline comments, no headline finding and no suppressed comments, so per pr-flow 7c there is no further round.

@cliffhall
cliffhall merged commit ec06974 into v2/main Nov 4, 2026
11 checks passed
@cliffhall
cliffhall deleted the v2/fix/2866-load-abort-reason-message branch November 4, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpdo --load: calls aborted by connection_lost are tallied as "[object Object]"

2 participants