fix(java): stop logging the legacy 'connect' probe failure as a warning - #2310
fix(java): stop logging the legacy 'connect' probe failure as a warning#2310rinceyuan wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds configurable RPC failure logging to suppress warnings for legacy connect probes.
Changes:
- Adds an internal failure-log-level overload.
- Uses
FINEfor protocol negotiation. - Adds logging-level tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
CopilotClient.java |
Downgrades connect probe failures. |
JsonRpcClient.java |
Adds configurable failure logging. |
JsonRpcClientTest.java |
Tests default and custom levels. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| var connectResponse = connection.rpc.invoke("connect", connectParams, ConnectResult.class, Level.FINE) | ||
| .get(30, TimeUnit.SECONDS); |
313992a to
ddfaecf
Compare
|
Good catch - fixed. The level is no longer decided up front. The probe passes exactly the condition cause -> cause instanceof JsonRpcException rpcEx && isUnsupportedConnectMethod(rpcEx)Added
|
CopilotClient probes the 'connect' RPC and falls back to 'ping' when the server does not implement it. JsonRpcClient.invoke logged every failed request at WARNING with a stack trace, so this fully recovered probe printed a scary 'Unhandled method connect' trace on every startup under the JUL default console handler. Give invoke an internal overload that takes the level used for failures and have the protocol-negotiation probe pass FINE. Unexpected failures still log at WARNING. Fixes github#2291.
ddfaecf to
134f55d
Compare
Summary
CopilotClient.verifyProtocolVersionprobes theconnectRPC and falls back topingwhen the server does not implement it. That fallback works, butJsonRpcClient.invokelogged every failed request atWARNINGwith a full stack trace, so the recovered probe printed this on a plain tutorial run (JUL sendsWARNINGto the console by default):Change
JsonRpcClient.invokegets an internal (package-private) overload that takes the level used for failure logging; the existing 3-arg overload still defaults toWARNING.connectprobe passesLevel.FINE, sinceCopilotClientalready catches and recovers from that exact failure.No public API change -
JsonRpcClientis package-private. Genuinely unexpected RPC failures still log atWARNING.Tests
Two cases added to
JsonRpcClientTest, both driving a real socket pair and a-32601 Unhandled method connecterror response while capturing the JUL records:testInvokeLogsFailureAtWarningByDefault- unexpected failures are stillWARNING.testInvokeHonorsCustomFailureLogLevel- an expected/recovered failure produces nothing atWARNINGor above.Verified
testInvokeHonorsCustomFailureLogLevelfails when the level argument is ignored.Fixes #2291.