fix(client): handle remote terminal hangup - #2827
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe client now performs idempotent terminal restoration, propagates cleanup errors, and handles terminal and transport closure during shutdown. A PTY integration test covers concurrent hang-up, and the changelog records the fix. ChangesTerminal cleanup and shutdown
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The change improves shutdown handling when the remote terminal disappears, but a panic path may still restore terminal state twice, which could leave the local terminal in an inconsistent state during failures. The PR is mergeable with explicit owner awareness or follow-up on this bounded risk. Sequence Diagram(s)sequenceDiagram
participant Client
participant Transport
participant TerminalGuard
Transport-->>Client: Connection loss
Client->>TerminalGuard: Explicit terminal restoration
TerminalGuard-->>Client: Restoration result
Client-->>Client: Classify shutdown as clean
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 77d9ff0e-20f2-4e34-be64-3fa1c1e77466
📒 Files selected for processing (3)
docs/next/CHANGELOG.mdsrc/client/mod.rstests/client_mode.rs
272b8ef to
236d177
Compare
Greptile SummaryThe PR makes terminal restoration and final diagnostics best-effort when a remote client loses its controlling terminal, while preserving ordinary connection-loss errors. It also adds deterministic PTY regression coverage for simultaneous terminal and transport hangup and documents the fix.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security defects identified. The changed shutdown path preserves reporting for ordinary connection failures, handles concurrent terminal and transport disappearance as intended, and is covered by a bounded end-to-end PTY regression test.
|
| Filename | Overview |
|---|---|
| src/client/mod.rs | Adds single-use terminal restoration with observable failure handling and narrowly combines restoration failure with transport loss for clean shutdown. |
| tests/client_mode.rs | Adds deterministic Unix PTY coverage for concurrent terminal and server-transport loss with bounded process cleanup. |
| docs/next/CHANGELOG.md | Documents that closing a remote-client terminal no longer causes a local core dump. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Client loop ends] --> B[Restore terminal]
B -->|Success| C{Client result}
B -->|Failure| D{Connection lost?}
D -->|Yes| E[Clean shutdown]
D -->|No| C
C -->|Detached| E
C -->|Ordinary error| F[Report error and fail]
C -->|Success| E
Reviews (1): Last reviewed commit: "fix(client): handle remote terminal hang..." | Re-trigger Greptile
Summary
Verification
herdr --remote rohanunder a disposable tmux PTYjust checkrefs #2424