Repository navigation
Conversation
An expired session-plane re-attach window set `reconnection_failed`, and only a later session-plane success cleared it. A full reconnect, /switch, /new or a session_binding rebind attached a healthy connection but left every submit refused with "Daemon reconnection failed". The flag is per-connection, so attach_session now clears it beside `daemon_closing_notice`; the session-plane arm's own clear is gone.
Replace the minute-long headless e2e and its direct-link mock helpers with an in-crate test on the layer that owns the flag: attach_session against the existing mock session must clear reconnection_failed.
This branch has not been deployed
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.
After the session re-attach window expired, a later successful reconnect still left every submit blocked with "Daemon reconnection failed". This PR clears that failure on every successful attach.
Bug
When the direct worker link dies, the session-plane driver retries the attach for a fixed 1-minute window. When the window expires, it sets
SessionUi.reconnection_failed, andsend_promptrefuses every submit while that is set. Only a later session-plane success cleared it.These paths attach a healthy connection but never cleared the flag:
/switchand/newsession_bindingrebindSo after any of them, every submit was still refused.
Fix
attach_sessionnow clearsreconnection_failednext todaemon_closing_notice. Both are per-connection state. Every successful attach goes throughattach_session, including the session-plane driver and the recovery reattach. Because of that, the separate clear in the session-plane success arm (run.rs) is deleted. One comment inreconnect.rsnamed this bug as a reason for the shutdown yield rule; that clause is removed.Test
New unit test
an_attach_clears_the_reconnection_failureinsession_ui/lifecycle.rs. It sits on the layer that owns the flag and reuses the module's existingmock_sessionhelper. The test setsreconnection_failed, callsattach_sessionagainst the mock daemon, and asserts the flag isNone.Mutation check (Prime sandbox): with the new
self.reconnection_failed = None;line removed fromattach_session, the test fails:An earlier revision of this PR had a minute-long headless e2e. It drove the full path: direct link lost, the window expires, full reconnect, then a submit. On main, that e2e showed the submit refused after the reconnect:
It was replaced by the unit test above to keep the suite fast.
Validation
All green in a Prime sandbox with toolchain 1.98.1:
cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p pa-tui --no-fail-fastcargo build -p pa-cliOverlap
#3893, #3424 and #3650 touch
run.rs,session_ui.rsandlifecycle.rs; #3825 touchesrun.rs. The production change here is one added line inattach_sessionand one deleted line inrun.rs, so conflicts should be trivial.Note
Low Risk
Small lifecycle/state-reset change on the attach path; no new networking or auth behavior, with a targeted unit test.
Overview
Fixes prompts staying blocked with "Daemon reconnection failed" after the TUI had already reattached to a healthy daemon.
Previously
reconnection_failedwas only cleared on one session-plane reconnect success path inrun.rs, even though other recoveries (attach_session, shutdown/lost reconnect,/switch, rebind) also established a live connection.attach_sessionnow clearsreconnection_failedwithdaemon_closing_noticeon every successful attach, and the redundant clear in the reconnect success arm is removed.Docs/comments in
session_uiandreconnect.rsreflect that this flag is per-connection. A focused unit test asserts an attach wipes a preset failure state.Reviewed by Cursor Bugbot for commit 5fb51fc. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Clear
SessionUi.reconnection_failedinattach_sessioninstead of reconnect handlingThe TUI could keep showing "Daemon reconnection failed" and block submits even after a later reconnect succeeded, because the failure marker was only cleared in one branch of the reconnect flow.
reconnection_failedtoSessionUi.attach_sessionin lifecycle.rs, so every successful attach clears it after reconstructed session state is applied.an_attach_clears_the_reconnection_failure) and a release note in .changes/tui-reconnect-failed-sticky.md.Macroscope summarized 5fb51fc.