Repository navigation
Startup picker: distinct Resume, New and Kill; counted kill confirmations - #542
Draft
raiseCatError wants to merge 2 commits into
Draft
raiseCatError wants to merge 2 commits into
raiseCatError wants to merge 2 commits into
Conversation
…ions With several detached sessions, Enter resumes the highlighted session (or the selected ones) instead of starting a new one; N or Esc starts new. X kills the selection or the highlighted session after a confirmation that names the count and lists them, so A then X is Kill all; sessions attached in another window are never touched and each outcome is reported. Rows and the one-session prompt show name, directory, shell and the same evidence based status as /sessions. The picker redraws on resize. Nothing about launching or leaving NMSh ends a session.
The one-session prompt treated a kill the service refused (attached in another window) as done and swallowed failures; it now returns to the prompt with the reason. Ending a session goes through one function, endDetachedSession: an unreachable service is a failure (it used to read as "already ended"), a refusal because a window attached meanwhile is "not touched", and a shell this window ended whose archive failed is reported as ended but not archived yet, with the spool kept. The service refuses to attach a session between its confirmed kill and the shell's exit. Bulk confirmations list every target by name, and the outcome line puts failures first.
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.
Startup session picker: clear Resume, New and Kill, with counted confirmations.
What changed and why
The startup picker (shown when NMSh starts and detached sessions exist) mixed up resuming and starting new. Enter with nothing selected started a new session, and there was no way to kill several sessions at once. This PR improves the existing picker.
/sessionsand/resumeare unchanged, and nothing is added alongside them.liveStatusPartsas/sessions, such as "idle 1m" or "running …".Safety review fixes (b63cc3b)
An adversarial review of the bulk kill found these problems; each is fixed with a regression test in
tests/startupKillSafety.test.ts.askWithKillstill returned "kill", and startup went on as if it had ended. Errors were also swallowed silently. It now returns to the prompt with the reason..catch(() => []), so a service that timed out made every target look gone. A listing failure is now a failure for that session.~looked the same, and targets after 6 were collapsed into "and N more". Every target is now named.All of these go through one function,
endDetachedSession(src/session/liveSessions.ts). It re-reads the service's list, addresses the kill by the service's session id (never a PID), and reports only what the service proved. The service still re-checks attachment atomically when it receives the kill. Draft PR #544 builds on this branch: it adds the session lifecycle and cleanup policy. Merge this PR first./resume).Automated verification
At b63cc3b:
tests/startupKillSafety.test.ts(new, 7 tests): every kill outcome; a stale, gone or attached target; partial failures; exact targets; the one-session prompt; and a real-service test that attach is refused while a kill is pending. That last test fails without the fix.Every
tests/startup*,tests/session*and related session test file (248 tests): the only failures were live-frontend tests timing out at about 20 s while the machine was under heavy load (load average 27–36 from other sessions' suites). The four files with failures, run side by side on 4aeb848 and b63cc3b under the same load, failed the same 15 tests on both, so this commit adds no failure there.GitHub CI run 43065468653 on b63cc3b: every job succeeded, covering Detect, Quality (Node 26), Node 22 compatibility, Tests ubuntu-24.04 1–3/3 and macos-latest 1–3/3, CI, and Verify 22.x/26.x. Fedora and the timing smokes are dispatch-only and were skipped.
Logs:
/Volumes/T7Tmp/ai-dev/nq/evidence/session-lifecycle/(see README.md there). The timeouts are not proven to be load: they also occur on the original head under the same conditions, and hosted CI passes them.Unresolved risks
/resumeonly after the next launch, which archives the spool. The message says so.Earlier, at 4aeb848:
tests/startupRestore.test.tsandtests/startupPickerHostile.test.ts: 21/21 pass. Two new tests cover multi-kill with a count, Kill all with a mixed result tally, and rows showing shell and status.npm run verify: 4,567 of 4,586 tests pass before the final wording fix. Of 5 failures, 4 also fail on pristineorigin/devon this Mac (GNU screen interop, live alias refresh, text editor panel, suite-runner tmpdir hygiene). The fifth (startupDiscovery: "idle at the prompt") was this change: fixed by keeping that wording on the one-session screens.startupDiscovery,startupRestoreandstartupPickerHostilethen pass 27/27.Needs human terminal testing
In Rex, Ghostty and Terminal.app, with 2–4 throwaway detached sessions (
nmsh --new, then close the window):