Repository navigation
Refuse a legacy exit before the restart prompt while its daemon lives - #211
Merged
Merged
Conversation
Since #209, attach admits a legacy record (no daemonBootId) whose recorded start token verifies against the live daemon. That admission was not limited to a running session. A record whose exit is written while its daemon is still finishing went on to the dead-session path: it printed the exit, asked "Restart? [Y/n]", read a closed stdin as yes, and then refused at the owner-loss wait with "Refusing to remove session ... daemon identity is unknown". Nothing reran, because a restart needs proof that the daemon is gone and a live legacy daemon can't give it, but the prompt offered a restart that could not happen. Admit legacy-verified records only while the session is running. In that window attach now refuses up front with "daemon identity is unknown", as it did before #209. Once the daemon is gone, its identity reads Gone and attach offers the restart as before.
Contributor
Author
|
Independent read GO at exact head Read:
Risks (low): attach gives one more refusal in that short window; the test uses the test process itself as the stand-in daemon. |
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.
A follow-up to #209, from its post-merge read. It is separate from #210.
What happened. #209 lets attach admit a legacy record (no
daemonBootId) whose recorded start token verifies against the live daemon. That admission wasn't limited to a running session. When the exit record was already written but the daemon was still finishing, attach went on to the dead-session path:Restart? [Y/n].Refusing to remove session "z": daemon identity is unknown.and exited 1.Nothing reran. A restart needs proof that the daemon is gone, and a live legacy daemon can't give that proof. So the prompt offered a restart that couldn't happen, and the refusal talked about removing.
Change. Legacy-verified records are admitted only while the session's status is running. In that window attach now refuses up front with
pty attach: refusing session "z": daemon identity is unknown., as it did before #209. Once the daemon is gone, its identity readsGone, and attach offers the restart as before. The README's #209 paragraph gets one sentence about this.Test.
cli_attach_guard::legacy_exit_with_a_live_daemon_is_refused_before_the_restart_promptsets up a legacy record withexitedAtandexitCode, a verified live daemon and a PID sidecar. It runs four commands:attachwith a closed stdinattachwithyon stdinattach -rattach --forceEach must exit 1 with the up-front refusal, and must not show
Restart?or the exit details. The stored command must not run, and the record bytes must be unchanged.Session "finishing" exited with code 0. … Restart? [Y/n]and whose stderr isRefusing to remove session "finishing" ….-p ptywithcli_attach_guard(6/6),client_library,cli_rm,cli_e2e,cli_binary_upgrade,cli_up_downanddaemon_lifecyclegives 72 passed, 1 ignored.Not changed. No tier-1 files, no JSON shape, and no change for records with boot evidence or for running legacy sessions.