Repository navigation
Leave a running session alone when restart's prompt gets no answer - #216
Merged
Merged
Conversation
pty restart asks Kill and restart? [Y/n] before it stops a running session, through the same ask that #215 replaced for attach. At EOF that read as yes, so a caller with no terminal stopped live work and started it again although nobody agreed to it. Node leaves the session running there and exits 0. The prompt now uses ask_consent, by decision 0020's rule: - At a terminal, any line but a lone n restarts, as before. - Off a terminal, only y or yes restarts. - EOF never does. With no answer, restart exits 1, leaves the session running and names -y. A lone n still exits 0 and -y still restarts without asking. The old ask has no callers left and is removed. Decision 0020 gains an addendum and parity.md a row. The conformance ledger records the two new tests that fail on Node as intended. One of #215's test lines is reformatted to rustfmt's layout.
restart checked the publication binding only after its prompt. It asked Kill and restart? and then refused a revoked or unverifiable managed launch, and with no terminal the refusal could not be reached at all: publication_fence's restart_refuses_revoked_binding_before_stopping_survivor runs restart --force without -y and got the no-answer message instead. The check now runs before the prompt. After a yes it runs again before the session is stopped, since an answer can take any time. Decision 0020's addendum says so.
Contributor
Author
|
Independent read GO at exact head Read:
Release note (behavior change): Risks (low):
|
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.
pty restartno longer stops a running session when nobody answers its prompt. This applies #215's rule (decision 0020) to the other[Y/n]prompt, as Factory decided.Before.
restartaskedSession "<name>" is running. Kill and restart? [Y/n]through the oldask, which has no terminal check. EOF read as an empty answer, which proceeds. A caller with no terminal stopped live work and started it again, although nobody agreed. Node leaves the session running at EOF.Now. The prompt uses
ask::ask_consent:nrestarts, an empty line included. This is unchanged.yoryesrestarts.restartends the prompt line and exits 1. The session is left running, and stderr shows:nexits 0, and-yrestarts without asking.-yalready existed, so no new flag is added.The old
askhas no callers left, so it's removed. Both prompts now share one rule.The publication check comes before the prompt. A revoked or unverifiable managed launch is now refused before
restartasks anything. After a yes, it checks again before it stops the session, because an answer can take any time. Before, the check came after the prompt. That meant asking "Kill and restart?" and then refusing, and with no terminal the refusal couldn't be reached at all.publication_fence::restart_refuses_revoked_binding_before_stopping_survivorrunsrestart survivor --forcewith no terminal and no-y. It failed on this PR's first head,d437d5bb, with the no-answer message. With this order it passes unchanged.Every
restartwithout-yin this repo:crates/pty/tests/publication_fence.rs:163, the test above.crates/pty-conformance/tests/restart_prompt.rs:59/73/86, this PR's own prompt tests.pty restart myserver(crates/pty/tests/fixtures/help/restart.txt). These are Node's exact bytes, and the example is still right at a terminal.-y, or only mentionsrestartin prose. That covers the conformance files and the README,docs/andscripts/.The same shape in
attach, left as it is here:attach's dead-session restart also checks publication only after its prompt, and again under the locks. So a revoked dead session is askedRestart? [Y/n]and then refused.-rstill reaches the refusal. I can move that check ahead of the prompt as its own change.Node, measured against the pinned reference (
f005432a) on Node 22.23.2, with no terminal. Rust before is main9e46e7e8; Rust now is this branch:</dev/nullny-yDecision and docs.
restart. Its title already covers both prompts, and the reason is the same. Its release note now names-ytoo.docs/parity.mdgets a row, and the README paragraph from Decline attach's restart prompt when nobody answers (#214) #215 now coversrestart.Release note.
pty restartno longer stops a running session when its restart prompt gets no answer. That covers stdin at EOF, and stdin that isn't a terminal unless it givesyoryes. It exits 1 instead and leaves the session running. Any script or seat that relied onrestartwithout a terminal must pass-ynow.I found no caller of
pty restartas a subprocess in fractal atb923a6fb.Tests. New file
crates/pty-conformance/tests/restart_prompt.rs, with no terminal:a_running_session_is_left_running_at_eof:</dev/null.a_running_session_is_left_running_without_a_yes: a piped empty line, then relayed input.a_piped_yes_restarts_a_running_session: the old daemon exited and the command started again.yes_flag_restarts_without_a_terminal.PTY_SESSIONso thatrestartskips its trailing attach, as the existingrestart -yconformance tests do.divergences.tomlrecords the two decline tests as intended, side node.Also here.
attach_no_restart.rshas one line from #215 reformatted to rustfmt's layout. I had missed that diff when checking #215. Formatting is report-only in CI, so nothing was red. The file's other rustfmt diffs are older code and are left as they are.Measured on Linux at this head, based on main
9e46e7e8:scripts/conformance-both.sh restart_prompt attach_no_restartagainst the pinned Node build. Exactly the five ledger entries differ: two new, three from Decline attach's restart prompt when nobody answers (#214) #215.restart_promptalone gave Node 2/2 and Rust 4/0.restart_promptfails the two decline tests and passes the other two.cargo test -p pty-conformanceagainst this head's binary: 697 passed, 0 failed.cargo test -p pty --no-fail-fast: all 47 test files ran. 476 passed and 1 failed:interactive::typing_filters_the_list_and_escape_clears_it, which fails in my checkout (the fuzzy filter matches the checkout path) and passes in CI.publication_fencepasses.--no-fail-fast. Cargo stopped at that same failing binary, so seven later test files never ran there,publication_fence.rsamong them. Decline attach's restart prompt when nobody answers (#214) #215's CI ran all of them and was green.