Repository navigation
fix: resolve a request's Protocol entry when its send fails - #2733
Merged
Merged
Conversation
A server that refuses a JSON-RPC request with a bare HTTP 403 sends no JSON-RPC response, so the request's Protocol-tab entry waited for one that could never arrive and read "Pending" for good — while the Tools panel already showed the error. The client's trackSendFailure now dispatches a `requestFailed` event (skipping request timeouts, which are requests the server received and has not answered). MessageLogState resolves the matching pending entry as a client-side error carrying the reason, led by the HTTP status when the error has one. ProtocolEntry titles such an entry "Request failed without a response" rather than "Rejected by the Inspector". Closes #2721 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Transport-error enrichment can still cause server refusals to be mislabeled as Inspector rejections.
1 open issue
What changed in this PR
Resolves failed-send entries in the Protocol tab instead of leaving them Pending, addressing #2721 without changing subscription retries.
Changes:
- Dispatches request failures and resolves pending log entries.
- Includes HTTP status in failure messages and distinguishes failed-send alerts.
- Adds regression coverage for tracking, formatting, and rendering.
| File | Description |
|---|---|
| core/mcp/types.ts | Documents failed-send errors. |
| core/mcp/state/messageLogState.ts | Resolves failed pending requests. |
| core/mcp/inspectorClientEventTarget.ts | Defines the failure event. |
| core/mcp/inspectorClient.ts | Dispatches send failures. |
| core/mcp/connectionDiagnostics.ts | Formats HTTP failure details. |
| clients/web/src/test/core/mcp/state/messageLogState.test.ts | Tests failure lifecycle handling. |
| clients/web/src/test/core/mcp/inspectorClient-diagnostics-callbacks.test.ts | Tests dispatch and timeout exclusion. |
| clients/web/src/test/core/mcp/connectionDiagnostics.test.ts | Tests failure formatting. |
| clients/web/src/components/groups/ProtocolEntry/ProtocolEntry.tsx | Differentiates failure alerts. |
| clients/web/src/components/groups/ProtocolEntry/ProtocolEntry.test.tsx | Tests failure badges and titles. |
Review effort: Balanced
…rror enrichProtocolEntries folds the server's JSON-RPC error body (e.g. -32601 on HTTP 404) into a request with no response. Since #2721 such a request already carries the failed send as a clientError, and keeping both made the entry read "Rejected by the Inspector" beside the server's own error. The body is the better record, so it now replaces the note. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: cliffhall <[email protected]>
Member
Author
|
Copilot round 1: 1 finding, fixed in 619b620.
|
Member
Author
|
Copilot review closed. Round 2 was clean: approval recommended, no new comments. The one open item it lists is round 1's thread, which is answered and fixed in 619b620. Stopping on the first clean round. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #2721
Problem
When a server refuses a JSON-RPC request with a bare HTTP
403(noWWW-Authenticate), no JSON-RPC response ever arrives. The request's Protocol-tab entry waited for one that could not come and read PENDING for good, while the Tools panel already showedError POSTing to endpoint: Forbidden.Fix
core/mcp/inspectorClient.ts:trackSendFailurenow also dispatches a newrequestFailedevent ({ id, reason }). It still skips a request timeout, which is a request the server received and has not answered, matching the existing Report outstanding-request and notification-stream state on a request timeout, not a bare "Request timed out" #2318 rollback.core/mcp/connectionDiagnostics.ts:describeSendFailure(err)builds the reason. It leads with the HTTP status when the error carries one (HTTP 403 Forbidden: Error POSTing to endpoint: Forbidden) and doesn't repeat a status the message already states.core/mcp/state/messageLogState.ts: onrequestFailed, the matching pending entry is resolved: it getsclientErrorplus a duration and leaves the pending map, so a stray late frame can't fold into it. Entries that are already answered or were evicted are left alone.ProtocolEntry.tsx:clientErroralready renders the Error badge. A request with aclientErrorand noresponseis a failed send, so its alert is titled "Request failed without a response" instead of Connect-time list-fetch failures are silently swallowed and render as successful Protocol entries #1953's "Rejected by the Inspector", which would wrongly blame the Inspector for a server refusal.Scope
subscriptions/listenre-send after a 403 is tracked separately as Modern subscriptions: a subscriptions/listen refused with HTTP 403 is retried eight times in silence #2722, per the triage comment, and is untouched here. The modern screenshot below still shows the re-sends; each one now resolves as Error.clientError), so nothing changes there.Verification
Repro'd live with prod
--webagainst a composable test server behind a reverse proxy that answers one method with a bare403 Forbidden. Captured at 1280×900 with the monitor sidebar at 640px.Legacy, before:
tools/call echostays PENDING:Legacy, after: the entry resolves as Error, and the expanded entry carries the HTTP status:
Modern, after: the proxy 403s
subscriptions/listen(subscriptions-modern-http.json). Every listen entry now reads Error instead of Pending (the re-sends are #2722):Tests added:
messageLogState.test.ts(resolve, late-response, already-answered, destroyed),connectionDiagnostics.test.ts(describeSendFailure),inspectorClient-diagnostics-callbacks.test.ts(dispatch, timeout skip), andProtocolEntry.test.tsx(badge and alert title).npm run local:gateis green.🤖 Generated with Claude Code