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
Cloud sandbox session feed: an unreadable message before the handshake is retried, after it stops the feed #345282
Follow-up to #345216 (part of #345234). Raised by the Copilot reviewer on the cherry-pick (#345268, thread); not a regression that needs to block 1.144.
What happens today
The cloud sandbox session feed (cloudSandboxSessionFeed.ts) treats a message it cannot parse (not a string, too large, invalid JSON, unexpected shape) as a sign that it no longer understands the server, and stops using the push connection for the rest of the window's life, falling back to polling. That is the invalidMessage outcome.
That only holds once the connection is established. If the unreadable message arrives before the server's connected event:
the message handler calls disconnected(false),
the handshake promise is rejected with a generic "socket failed" error, which loses the "this was an invalid message" classification,
the surrounding catch treats it like any other setup failure and schedules a retry with the slow negotiation backoff (about 1 minute, doubling to 30 minutes), reporting socketFailed.
So the same kind of message leads to a permanent stop after the handshake but to slow retries before it. Before #345216 both paths gave up for good, since setup failures were never retried; the retry commit (633e294aa8d) introduced the asymmetry.
Why it matters, and why it is minor
Impact is small: it needs a corrupt frame to arrive before connected, and the retries are capped at one negotiation every 30 minutes per window.
It is mostly a consistency and telemetry question. Today the pre-handshake case shows up as socketFailed rather than invalidMessage, so dashboards could undercount protocol mismatches.
Decision to make
Both paths should behave the same; the open question is which behavior to share:
Stop for good in both cases (what the reviewer suggested). Carry the invalid-message classification through the handshake rejection, cancel retries, and report invalidMessage. Consistent with "we no longer understand the server", but a single garbled frame before the handshake would take the window off the push connection until reload, which is the failure mode chat: reduce cloud sandbox discovery load on the task list #345216 set out to remove.
Retry slowly in both cases. Treat an unreadable message after the handshake like a dropped connection with backoff, so a one-off bad frame does not permanently disable the feed, while a real protocol change still costs at most one negotiation per 30 minutes per window.
Either way, add a test for an invalid message that arrives before connected, asserting the outcome reported and whether a retry is scheduled.
Activity