fix(java): stop logging the legacy 'connect' probe failure as a warning - #2310
Open
rinceyuan wants to merge 1 commit into
Open
fix(java): stop logging the legacy 'connect' probe failure as a warning#2310rinceyuan wants to merge 1 commit into
rinceyuan wants to merge 1 commit into
Conversation
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.
Contributor
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.
Comment on lines
+323
to
+324
| var connectResponse = connection.rpc.invoke("connect", connectParams, ConnectResult.class, Level.FINE) | ||
| .get(30, TimeUnit.SECONDS); |
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.
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.