You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Frun1na (via GitHub)" <gi...@apache.org> on 2026/10/07 17:50:40 UTC

[PR] fix(rmqctl): keep the failure cause in stdio proxy error frames [rocketmq-dashboard]

Frun1na opened a new pull request, #5656:
URL: https://github.com/apache/rocketmq-dashboard/pull/5656

   ### Which Issue(s) This PR Fixes
   
   - Fixes #5655
   
   ### Brief Description
   
   `writeStdioError` only described an MCP call failure when the failure was a structured HTTP status error. Everything else — connection refused, DNS, TLS, timeouts, protocol-decode errors — produced a bare `-32603 stdio proxy call failed` with no `data`, and the actual cause stayed on stderr, which the MCP client never reads.
   
   The fallback branch now classifies the failure with the same `normalizeCLIError` the CLI's own error path uses, and carries the sanitized code, message and hint in the frame:
   
   ```
   $ printf '{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{}}\n' | rmqctl mcp stdio --config <closed port> --instance-id inst1
   
   # before
   {"jsonrpc":"2.0","id":7,"error":{"code":-32603,"message":"stdio proxy call failed"}}
   
   # after
   {"jsonrpc":"2.0","id":7,"error":{"code":-32000,
     "message":"failed to send request: ... dial tcp 127.0.0.1:1: connect: connection refused",
     "data":{"code":"UNAVAILABLE",
             "message":"failed to send request: ... connect: connection refused",
             "hint":"Check --server, network connectivity, and Studio Server status."}}}
   ```
   
   Two deliberate choices: the frame uses the same `-32000` server-error code as the HTTP branch, so a client sees one shape for "the upstream call failed" and reads the precise classification from `data.code`; and the text goes through the existing `safeStdioDiagnostic` sanitizer, so the frame stays a single line and within the 512-byte diagnostic cap. The HTTP status branch is untouched, and a request without a parsable id still gets no frame (there is nothing a JSON-RPC error could address).
   
   ### How Did You Test This Change?
   
   End to end against a context pointing at a closed port (`127.0.0.1:1`), built from this branch and from the base revision:
   
   ```
   $ go build -o rmqctl . && printf '{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{}}\n' |
       rmqctl mcp stdio --config closed-port-config.yaml --instance-id inst1
   # (frame with code UNAVAILABLE, the connection-refused cause and a hint, as above)
   ```
   
   Unit level, with a new `cmd/mcp_stdio_error_test.go` (the writer had no coverage before):
   
   ```
   $ cd rmqctl && go test ./cmd/ -run TestStdioErrorFrame -v
   --- PASS: TestStdioErrorFrameKeepsTheFailureCause (0.00s)
       --- PASS: TestStdioErrorFrameKeepsTheFailureCause/transport_failure (0.00s)
       --- PASS: TestStdioErrorFrameKeepsTheFailureCause/deadline_exceeded (0.00s)
       --- PASS: TestStdioErrorFrameKeepsTheFailureCause/protocol_decode_failure (0.00s)
   --- PASS: TestStdioErrorFrameKeepsTheHTTPStatusShape (0.00s)
   --- PASS: TestStdioErrorFrameSanitizesAndCapsTheCause (0.00s)
   --- PASS: TestStdioErrorFrameSkipsUnparsableRequests (0.00s)
   
   $ cd rmqctl && go test ./cmd/ && go vet ./cmd/
   ok  	github.com/apache/rocketmq-dashboard/rmqctl/cmd	0.219s
   (gofmt -l and go vet print nothing)
   ```
   
   Without the change the new tests fail on exactly the gap: `frame code = -32603, want -32000` with no `data` payload.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / `refactor:` / `chore:` / `docs:` / `perf:`)
   - [x] Tests added or updated for non-trivial changes, test methods named `...Test`
   - [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit checks)
   - [x] New source files carry the ASF license header
   - [ ] Documentation touched where behaviour changed (README / `docs/` / in-app help)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): keep the failure cause in stdio proxy error frames [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #5656:
URL: https://github.com/apache/rocketmq-dashboard/pull/5656#issuecomment-6094728411

   Merged as part of #5643 (squashed into `rocketmq-studio` as b205d5f4f).
   
   It kept the underlying failure cause in the stdio proxy's fallback error frame instead of swallowing it.
   
   We are consolidating same-author changes into one commit rather than landing several near-identical ones on the trunk; your commit stays visible on this pull request and is named in the merge body. Closing - no action needed, and thanks for the fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): keep the failure cause in stdio proxy error frames [rocketmq-dashboard]

Posted by "Frun1na (via GitHub)" <gi...@apache.org>.
Frun1na commented on PR #5656:
URL: https://github.com/apache/rocketmq-dashboard/pull/5656#issuecomment-6093184038

   Friendly ping — this is still open for review whenever you get a chance. (Keeping it from the stale bot for now.)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(rmqctl): keep the failure cause in stdio proxy error frames [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #5656: fix(rmqctl): keep the failure cause in stdio proxy error frames
URL: https://github.com/apache/rocketmq-dashboard/pull/5656


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org