Handle session reconnecting for remote server executor#11482
Draft
MaggieShan wants to merge 1 commit into
Draft
Conversation
ATERCATES
pushed a commit
to ATERCATES/warp
that referenced
this pull request
May 22, 2026
The control-plane reader task previously exited silently when stdout EOF'd unexpectedly (i.e. the underlying SSH transport died without emitting a tmux %exit). Detection deferred to the heartbeat path, which has interval 30s and timeout 10s — up to ~40s of "dead but appears alive" state during which send_command would write to a half-closed pipe and time out at RESPONSE_TIMEOUT (10s) per call instead of failing fast. This commit: - Adds signal_master_died(stdin, events_tx) helper that idempotently takes the stdin and emits MasterDied. Idempotent because the first caller takes the Option<ChildStdin>; subsequent callers see None and no-op, preventing duplicate events when reader and heartbeat race to detect. - Reader task now distinguishes clean exit (via ControlEvent::Exit) from unexpected exit (stdout EOF, parse error). On unexpected exit it invokes signal_master_died, but only when closing was not initiated by us (avoids spurious MasterDied on graceful close). - Heartbeat path routes its existing MasterDied emits through the same helper so the stdin is also closed there, making subsequent send_command calls fail immediately with "stdin closed" instead of waiting RESPONSE_TIMEOUT. Inspired by warpdotdev#11217 (SSH disconnect detection in tmux parser) and warpdotdev#11482 (fail-fast pattern for remote_server executor), but minimal: leverages the existing Arc<Mutex<Option<ChildStdin>>> indirection instead of adopting RwLock<Option<Arc<...>>>. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
Description
RwLock<Option<Arc<RemoteServerClient>>>so that we can clear/set aRemoteServerClientduring disconnection and reconnectionSessionReconnectingevent to coverTesting
Verified locally that on disconnection the run command request does not get sent + client error is not logged.
./script/runAgent Mode