Skip to content

fix: resolve a request's Protocol entry when its send fails - #2733

Merged
cliffhall merged 2 commits into
v2/mainfrom
v2/fix/2721-protocol-tab-403-pending
Oct 20, 2026
Merged

cliffhall merged 2 commits into
v2/mainfrom
v2/fix/2721-protocol-tab-403-pending

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2721

Problem

When a server refuses a JSON-RPC request with a bare HTTP 403 (no WWW-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 showed Error POSTing to endpoint: Forbidden.

Fix

  • core/mcp/inspectorClient.ts: trackSendFailure now also dispatches a new requestFailed event ({ 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: on requestFailed, the matching pending entry is resolved: it gets clientError plus 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: clientError already renders the Error badge. A request with a clientError and no response is 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

Verification

Repro'd live with prod --web against a composable test server behind a reverse proxy that answers one method with a bare 403 Forbidden. Captured at 1280×900 with the monitor sidebar at 640px.

Legacy, before: tools/call echo stays PENDING:

protocol-403-before

Legacy, after: the entry resolves as Error, and the expanded entry carries the HTTP status:

protocol-403-after

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):

protocol-403-modern-listen-after

Tests added: messageLogState.test.ts (resolve, late-response, already-answered, destroyed), connectionDiagnostics.test.ts (describeSendFailure), inspectorClient-diagnostics-callbacks.test.ts (dispatch, timeout skip), and ProtocolEntry.test.tsx (badge and alert title). npm run local:gate is green.

🤖 Generated with Claude Code

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]>
@cliffhall cliffhall added the v2 Issues and PRs for v2 label Oct 20, 2026
@cliffhall
cliffhall requested a balanced review from Copilot October 20, 2026 01:32

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.

🟡 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]>
@cliffhall

Copy link
Copy Markdown
Member Author

Copilot round 1: 1 finding, fixed in 619b620.

  • Enrichment can mislabel a server refusal as an Inspector rejection (ProtocolEntry.tsx): real. A failed send whose 404 carried a -32601 body ended up with both clientError and an enriched response. enrichProtocolEntries now drops the clientError when it folds the server's error body in, so that path renders as it did before this PR. Covered in correlateTransportErrors.test.ts.

npm run local:gate is green on the new head.

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

The focused failure-handling changes have regression coverage and no unresolved blocking findings.

1 open issue

Review effort: Balanced

@cliffhall

Copy link
Copy Markdown
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.

@cliffhall
cliffhall merged commit 455a1c1 into v2/main Oct 20, 2026
8 checks passed
@cliffhall
cliffhall deleted the v2/fix/2721-protocol-tab-403-pending branch October 20, 2026 02:51
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.

Protocol tab leaves a request PENDING when the server denies it with a bare HTTP 403

2 participants