You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Client never answers a server ping sent during the initialize handshake #1362
This is about the 2025-11-25 initialize handshake. While the client waits for the initialize response, expect_response in service/client.rs drops any ping from the server:
// Server could send pings before handshakeServerJsonRpcMessage::Request(ref request)ifmatches!(request.request,ServerRequest::PingRequest(_)) =>
{
tracing::trace!("Received ping request. Ignored.")}
Nothing is written back, so the server's ping never gets a response. A server that times out its pings can treat the connection as stale and drop it. A ping sent after notifications/initialized is answered normally.
The server side already does this. #745 made the server answer a client ping that arrives before initialize.
To Reproduce (main at 8d226f4)
Over a tokio::io::duplex transport, with both sides on 2025-11-25, a raw server reads initialize, writes a ping, and then writes the InitializeResult:
The client writes {"jsonrpc":"2.0","id":"srv-ping-pre","result":{}} during the handshake and then carries on waiting for the InitializeResult.
Additional context
The 2025-11-25 lifecycle lets the server send pings before it gets notifications/initialized, and the ping page says the receiver MUST respond promptly with an empty response.
expect_response is also used while waiting for server/discover. 2026-07-28 removes ping and servers there don't send requests, so I'd leave that path as it is and only answer during initialize.
Opened the fix as a draft in #1366, since the open-PR limit still applies with #1361 open. Happy to mark it ready once that one lands, or sooner if a maintainer wants to.
Activity
github-actions commentedon Oct 14, 2026
@bolinfest is on triage rotation this week and is the reviewer for this one.
Codex labeled this bug / P1 (T-service). Please confirm or correct those labels.
Automated triage. Labels are a first pass and the assigned maintainer has the final say.
gocamille commentedon Oct 14, 2026
I have a fix with tests on my fork: https://github.com/gocamille/rust-sdk/tree/fix/client-ping-during-initialize. I'm at the open-PR limit with #1361, so I'll open the PR once that one lands.
gocamille commentedon Oct 15, 2026
Opened the fix as a draft in #1366, since the open-PR limit still applies with #1361 open. Happy to mark it ready once that one lands, or sooner if a maintainer wants to.
fix(client): answer a server ping during the initialize handshake
fix(client): answer a server ping during the initialize handshake (mo…