core: make EnvClient WebSocket keepalive configurable#877
Closed
sergiopaniego wants to merge 1 commit into
Closed
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Collaborator
|
Addressed in #878 |
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
Adds
ping_interval_s/ping_timeout_stoEnvClient, forwarded to the WebSocketws_connect. Default is20.0(thewebsocketsdefault, so existing behavior is unchanged); passingping_interval_s=Nonedisables client-side keepalive, which sandbox tunnels that drop WebSocket ping/pong frames require to stay connected. Surfaced in #821 (Modal), where the E2E previously needed a monkeypatch ofws_connect.Closes #875.
Type of Change
Alignment Checklist
Before submitting, verify:
.claude/docs/PRINCIPLES.mdand this PR aligns with our principles.claude/docs/INVARIANTS.mdand no invariants are violated/pre-submit-pr(orbash .claude/hooks/lint.shand tests) and addressed all issuesRFC Status
Test Plan
New unit tests (no network) patch
ws_connectand assert the keepalive args are forwarded:ping_interval=20.0,ping_timeout=20.0(behavior unchanged)ping_interval_s=None/ping_timeout_s=None→ forwarded asNone(keepalive disabled)PYTHONPATH=src:envs pytest tests/test_core/test_generic_client.py -m "not integration"→ 68 passed. Lint clean (ruff format --check,ruff check).Claude Code Review
N/A
Note
Low Risk
Small, backward-compatible addition to core WebSocket connect options with targeted unit tests; no auth or data-path changes.
Overview
EnvClient(and subclasses likeGenericEnvClient) now acceptping_interval_sandping_timeout_s, which are passed through tows_connecton connect. Defaults stay 20s for both, so behavior is unchanged unless callers override.Setting either to
Noneturns off client-side keepalive / pong timeout—needed when sandbox tunnels (e.g. Modal) drop WebSocket ping/pong frames and would otherwise drop the session on timeout.Unit tests patch
ws_connectto assert default forwarding andNonewhen keepalive is disabled.Reviewed by Cursor Bugbot for commit 3866684. Bugbot is set up for automated code reviews on this repo. Configure here.