Repository navigation
fix(remote): recover runtime streams after client wake - #9093
matheustimbo wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughRuntime transport errors are classified as recoverable by code or message and handled without terminal failure. Remote PTY transport now uses capped resubscription retries with cycle guards and cancellation across lifecycle transitions. Shared-control connections continue reconnecting until explicitly closed while retaining subscriptions. Tests cover transient failures, eventual attachment, and stale retry prevention. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9258d1f8-e819-4501-b0fe-7d50d66c3231
📒 Files selected for processing (7)
src/renderer/src/components/terminal-pane/remote-runtime-pty-transport.test.tssrc/renderer/src/components/terminal-pane/remote-runtime-pty-transport.tssrc/renderer/src/runtime/remote-runtime-terminal-multiplexer.tssrc/renderer/src/runtime/runtime-terminal-stream.tssrc/shared/remote-runtime-shared-control-connection.test.tssrc/shared/remote-runtime-shared-control-connection.tssrc/shared/remote-runtime-shared-control-reconnect.ts
|
Thanks, @matheustimbo! This was rebuilt on current main and merged in #29444 (your approach was used). Closing as superseded. |
Fixes #9092
Summary
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
git diff --checkpassed for the changed surface.src/relay/git-handler.test.tsbecause this host Git returnsStopping at filesystem boundarywhere the test expectsnot a git repository.src/renderer/src/components/skills/skill-freshness-group.tsx:101.AI Review Report
The review focused on reconnect timer ownership, terminal lifecycle transitions, stale async completions, duplicate subscriptions, and explicit-close cancellation. It initially found stale retry races across detach/reattach and replacement stream closes; the implementation added cycle/generation guards and regression coverage. CodeRabbit then identified that a recoverable error arriving before multiplex readiness could be converted into a generic close and stop the initial attach retry. Commit
28ded1af4preserves the transport error message, prevents the original attach rejection from scheduling a duplicate retry, and adds a regression test for that ordering.The review explicitly checked macOS, Linux, and Windows compatibility, including shortcuts, labels, paths, shell behavior, and Electron-specific differences. This change is transport-level: it adds no shortcuts, labels, paths, shell commands, or platform-specific Electron behavior, and uses existing cross-platform timer and IPC abstractions. The SSH use case was included alongside native and Tailscale-backed remote runtimes.
Security Audit
The change introduces no new user input, command execution, path handling, authentication, secrets, dependencies, or IPC surface. Review covered error-code/message classification, retry bounds, lifecycle cancellation, and whether transport errors or secrets could be newly exposed. Retry delay remains capped at 15 seconds, explicit close/terminal retirement cancels pending work, and no new logging or secret-bearing payloads were added. No security follow-up is currently needed.
Notes
Recovery applies to native, SSH, and Tailscale-backed remote runtimes. Explicit close and terminal retirement still stop retries. The unchecked global lint and test boxes are documented above; their observed failures are outside this PR's changed surface.
ELI5
After your laptop sleeps or Wi‑Fi drops, remote terminals and control streams could stop updating permanently. They now keep retrying reconnection so streams recover when the network comes back.