fix(reliability): bound three unbounded waits that could hang the CLI#151
Open
tiantt wants to merge 1 commit into
Open
fix(reliability): bound three unbounded waits that could hang the CLI#151tiantt wants to merge 1 commit into
tiantt wants to merge 1 commit into
Conversation
Three status/connection waits could block the CLI indefinitely when a backend stalls or silently dies: - cr.py `_create_instance`: `while True` status poll had no deadline; a CR instance stuck in "Creating" hung the CLI forever. Add a monotonic-clock deadline that raises TimeoutError. - ve_agentkit.py `_wait_for_runtime_status_multiple`: `timeout=None` made `if timeout and elapsed > timeout` dead code, so the poll never timed out. Fall back to a bounded poll timeout when None. - cli_exec.py sandbox terminal: `websocket run_forever()` had no ping_interval/ping_timeout, so a dead peer left the session wedged with only Ctrl-C as an exit. Enable keepalive pings. All three bounds are env-tunable via a single source of truth in http_defaults.py (AGENTKIT_POLL_TIMEOUT / AGENTKIT_WS_PING_INTERVAL / AGENTKIT_WS_PING_TIMEOUT), matching the existing http_timeout idiom. Adds offline regression tests covering each bound.
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.
Three status/connection waits could block the CLI indefinitely when a backend stalls or silently dies:
_create_instance:while Truestatus poll had no deadline; a CR instance stuck in "Creating" hung the CLI forever. Add a monotonic-clock deadline that raises TimeoutError._wait_for_runtime_status_multiple:timeout=Nonemadeif timeout and elapsed > timeoutdead code, so the poll never timed out. Fall back to a bounded poll timeout when None.websocket run_forever()had no ping_interval/ping_timeout, so a dead peer left the session wedged with only Ctrl-C as an exit. Enable keepalive pings.All three bounds are env-tunable via a single source of truth in http_defaults.py (AGENTKIT_POLL_TIMEOUT / AGENTKIT_WS_PING_INTERVAL / AGENTKIT_WS_PING_TIMEOUT), matching the existing http_timeout idiom.
Adds offline regression tests covering each bound.