fix(mcp): sender pushback for delegate_task_async delivery failures (#2244) #2384
Reference in New Issue
Block a user
Delete Branch "fix/delegate-task-async-sender-pushback-2244"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #2244
The async delivery goroutine previously only logged A2A proxy errors and left the delegation status stuck at 'dispatched'. Callers had to poll check_task_status blindly to discover failures.
Changes:
Test plan:
SOP Checklist
REQUEST_CHANGES on molecule-core#2384 @621d60276c55e3e8936f27b25e3dae372fcfe4e1.
The implementation direction is right and the merge-base diff is narrow to workspace-server/internal/handlers/mcp_tools.go: async delegate_task rows now start as queued, marshal/proxy/non-2xx errors update failed, successful 2xx updates delivered, and the API response says queued instead of dispatched. I did not see auth or merge-control collateral in the diff.
Blocking gap: required CI is red on this head.
CI / Platform (Go) (pull_request)failed in run 246526 / job 327175, soCI / all-required (pull_request)was skipped. The failing tests are directly in the touched MCP async area: existing sqlmock expectations still requiredispatchedbut the implementation now writesqueued/delivered/failed(for example TestMCPHandler_DelegateTaskAsync_RoutesThroughPlatformA2AProxy and TestMCPHandler_DelegateTaskAsync_WithAttachments), and TestMCPHandler_DelegateTaskAsync_MarshalFailureDoesNotCallProxy reportsrace detected during execution of testwhile expectingdispatchedand receiving queued/failed updates.Fix shape: update/add the MCP async tests to pin the new contract (
queuedimmediate API/row,deliveredon successful delivery,failedon marshal/proxy/non-2xx) and make the marshal-failure test synchronize with the goroutine/global marshal override safely. Re-run Platform Go untilCI / all-required (pull_request)is green.APPROVE core#2384 @c5a6df0. Verified merge-base diff is scoped to workspace-server/internal/handlers/mcp_tools.go and mcp_test.go; async delegation now records queued, then failed on marshal/proxy error or delivered on success; marshal-failure test drains the global async WaitGroup before cleanup, so the status write is synchronized; async tests now expect queued/delivered/failed; CI / Platform (Go) and CI / all-required are green.
APPROVE core#2384 @c5a6df0. Verified merge-base diff is scoped to workspace-server/internal/handlers/mcp_tools.go and mcp_test.go; async delegation now records queued, then failed on marshal/proxy error or delivered on success; marshal-failure test drains the global async WaitGroup before cleanup, so the status write is synchronized; async tests now expect queued/delivered/failed; CI / Platform (Go) and CI / all-required are green.
APPROVED molecule-core#2384 @c5a6df0d857a25946990dbec2b3b1230e6b03b30. Reviewed the merge-base diff and surrounding MCP handler/test code. The async delegate path now records the caller-visible row as queued, transitions to delivered after a successful 2xx A2A proxy response, and transitions to failed with structured error_detail for marshal errors, transport errors, and non-2xx proxy responses. check_task_status already reads status/error_detail from the same row, so callers can observe the sender-side pushback instead of polling a stuck dispatched state. The updated tests cover the success path, attachment path, and forced marshal failure path, and the global async wait prevents cleanup from racing the detached goroutine. Required CI contexts CI / Platform (Go) and CI / all-required are green on this head; aggregate commit status still includes unrelated review/SOP gate failures. I was unable to run local Go tests in this template because the go binary is not installed.
Security pass: scoped to delegate_task_async activity-log status transitions. No auth bypass, secret exposure, injection, or trust-boundary change; failure detail is operational status only and does not expose credentials. Posted as authorized SOP-ceremony security-review trigger.
QA pass: scoped MCP delegate_task_async sender pushback handling and tests; no QA blocker found. SOP tier recommendation: low.
ready-to-merge: 2-genuine approved (Researcher + CR2). A2A down — cannot ping PM via workspace.