Repository navigation
feat(tui): confirm before quitting stops every session - #700
Merged
Merged
Conversation
Quitting Forge has always retired every session actor, so the sessions the operator is not looking at die with the one they are. Nothing said so: neither Ctrl+D nor /quit reported how many turns, queued prompts, pending approvals or unsaved editor buffers went with them. Ask first, and only when the answer is not obvious: quitting one busy session the operator is watching stays instant, while a second session with a turn running or queued raises a two-row confirm that defaults to Cancel and names what the quit would discard. It is the one gate for Ctrl+D, /quit on the primary session, and the exit that follows a resolved unsaved-changes dialog; /quit in any other session view stays a per-session close. The sweep is a new CloseAllSessions command that attempts the whole roster, reports what refused per session, and returns a count, so the app can exit on either outcome with the failure travelling out in the exit summary. Shutdown had the same shape wrong: it propagated the first retirement failure out of its loop, stranding every session after it behind an exit that claimed success. refs: FORGE-DESIGN.md 9.15
mohitranka
force-pushed
the
feat/quit-all-sessions
branch
from
September 15, 2026 17:49
b9dd02b to
0151c50
Compare
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.
What
Quitting Forge has always retired every session actor, so the sessions the operator is not looking at die with the one they are. Nothing said so: neither
Ctrl+Dnor/quitreported how many turns, queued prompts, pending approvals, or unsaved editor buffers went with them.This adds one quit gate:
Ctrl+D,/quiton the primary session, and the exit after a resolved unsaved-changes dialog all route through it./quitin any other session view stays a per-session close, so the confirm exists in exactly one place.RunningorQueued. Quitting one busy session the operator is watching stays instant; prompting for it would put a dialog in front of every quit.Cancelselected first. The dialog names only the categories that lose something (running turns, queued prompts, requests waiting on the operator, unsaved buffers by session label) and escalates its border todangeronce a session view holds unsaved changes.ExitSummary::quit_failureand print after the terminal is restored, because a toast on the final frame is a report nobody reads.Shutdownhad the same shape wrong: it propagated the first retirement failure out of its loop, stranding every session after it behind an exit that claimed success. Both it and the newCloseAllSessionsnow attempt the whole roster and collect failures.Findings worth knowing
/quiton it previously closed the primary session rather than exiting. That path now goes through the gate.Shutdowncallsretire_actor_resourceswithallow_pending_interaction: true, so a session parked on an approval or an agent question was retired anyway and the request silently discarded. The confirm's summary is now the only place that says so.reconcile_running_prompt_claimsalready repairs a stalerunningrow on the next launch, so a session cancelled mid-turn comes backInterruptedrather than◐ working.Tests
app::tests::multi_task): the gate threshold, the default-Cancelkeymap,/quitrouting on the primary, the rendered loss lines, the end-to-end sweep, and the pure loss-line formatting.1 of 2, and does not strand the other.cargo fmt --all -- --checkand clippy clean onforge-tui,forge-session,forge-cli. Release build +forge --versionverified.cargo test -p forge-tuiis 1343 passed / 5 failed andcargo test -p forge-session78/1 on this host. All failures reproduce on a clean base revision — they aresandbox unavailable: this host refused to apply confinementbackground-task and watcher tests, not this change.Deliberately not in scope
The double-
Ctrl+Cescalation stays ungated (documented inFORGE-DESIGN.md9.15);/quitgains noallargument; nothing crosses the repository lease into another Forge process.refs: FORGE-DESIGN.md 9.15