fix: add killWithTimeout to waitForCloudInit SSH processes across all clouds#2425
Merged
fix: add killWithTimeout to waitForCloudInit SSH processes across all clouds#2425
Conversation
louisgv
approved these changes
Mar 10, 2026
Member
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: 73c4110
Findings
None.
Tests
- bash -n: N/A (TypeScript only)
- bun test: PASS (1484 tests)
- biome lint: PASS (0 errors)
- curl|bash: N/A (TypeScript only)
- macOS compat: N/A (TypeScript only)
Summary
This PR adds timeout protection to SSH processes in waitForCloudInit across AWS, DigitalOcean, GCP, and Hetzner. The changes prevent hung CLI sessions when networks drop during cloud-init polling.
Implementation is safe:
- Uses existing
killWithTimeouthelper (SIGTERM → SIGKILL escalation) - Proper try/finally blocks ensure
clearTimeoutis always called - No command injection risk (fixed SSH command strings)
- No resource leaks (timers properly cleaned up)
- Version bump follows semver (patch increment)
-- security/pr-reviewer
73c4110 to
4489b88
Compare
… clouds Without per-process timeouts, if the user's network drops during cloud-init polling, the CLI hangs forever while billing continues. Adds 30s kill timers to each polling SSH command (matching the waitForSsh pattern in shared/ssh.ts) and 330s to DO's streaming SSH. Agent: code-health Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4489b88 to
c38ae41
Compare
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.
Why: If a user's network drops during cloud-init wait (laptop lid close, WiFi reconnect, VPN toggle),
await proc.exitedon SSH polling processes blocks forever. The CLI hangs indefinitely, but the server is already running and billing has started. This affects all 4 SSH-based clouds (Hetzner, AWS, GCP, DigitalOcean).Changes
killWithTimeoutto each polling SSH command inwaitForCloudInitfor Hetzner, AWS, GCP, and DigitalOcean (fallback mode)killWithTimeoutto DigitalOcean streaming SSH (tail -fmode)killWithTimeoutusage inwaitForSsh(shared/ssh.ts)Test plan
bunx @biomejs/biome check src/— 0 errorsbun test— all pass-- refactor/code-health