fix(gateway): add WebSocket ping keepalive to prevent idle connection drops#1601
Open
BingqingLyu wants to merge 1 commit intomainfrom
Open
fix(gateway): add WebSocket ping keepalive to prevent idle connection drops#1601BingqingLyu wants to merge 1 commit intomainfrom
BingqingLyu wants to merge 1 commit intomainfrom
Conversation
… drops Made-with: Cursor
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
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
socket.ping(). The existing keepalive is an application-level JSON"tick"event broadcast (every 30s), which is a regular data frame — not a WS protocol ping. Some intermediaries only honor WS-level ping/pong for idle detection. Additionally, the tick broadcast usesdropIfSlow: true, so slow clients can miss ticks entirely, leaving the connection truly idle.TICK_INTERVAL_MSapplication-level keepalive was the only mechanism; WS-level pings were never added.Regression Test Plan (if applicable)
setInterval+clearInterval— the 20 existing ws-connection tests pass and verify connection lifecycle. The actual bug (intermediary killing idle connections) is a network-level behavior not reproducible in unit tests.User-visible / Behavior Changes
WebSocket connections now send protocol-level ping frames every 25 seconds, preventing network intermediaries from dropping idle connections during long tool call chains.
Diagram (if applicable)
Security Impact (required)
Repro + Verification
Environment
Steps
Expected
Actual
Evidence
[ws] webchat disconnected code=1006— 12 disconnects in 17 minutesHuman Verification (required)
close()clears the ping interval;socket.ping()is wrapped in try/catch for safetyReview Conversations
Compatibility / Migration
Risks and Mitigations
Made with Cursor