Skip to content

feat: add entire sessions stop command#739

Merged
gtrrz-victor merged 10 commits intomainfrom
feat/entire-stop
Mar 31, 2026
Merged

feat: add entire sessions stop command#739
gtrrz-victor merged 10 commits intomainfrom
feat/entire-stop

Conversation

@peyton-alt
Copy link
Copy Markdown
Contributor

@peyton-alt peyton-alt commented Mar 19, 2026

Summary

Adds entire sessions stop to manually mark one or more active sessions as ended, preventing future checkpoint leakage without waiting for the agent to stop naturally.

  • Introduces entire sessions parent command to group session management
  • Pure state mutation — no writes to the checkpoints branch, no condensation. The existing PostCommit hook handles any remaining condensation on the next commit.
  • Session ID is a positional argument: entire sessions stop <session-id>
  • Flags: --all (worktree-scoped), -f/--force (skip confirmation)
  • All paths (no args, positional ID, --all) require confirmation unless --force is set

Usage

entire sessions stop                     # Interactive: confirm single / multi-select
entire sessions stop <session-id>        # Stop a specific session by ID
entire sessions stop --all               # Stop all active sessions in current worktree
entire sessions stop --force             # Skip confirmation prompt

Output

Session with a committed checkpoint:

✓ Session 2026-03-19-demo-checkpoint stopped.
  Checkpoint: a3b2c4d5e6f7

Session with uncommitted work:

✓ Session 2026-03-19-demo-uncommitted stopped.
  Work will be captured in your next checkpoint.

Session with no recorded work:

✓ Session 2026-03-19-demo-empty stopped.
  No work recorded.

Test plan

  • mise run fmt && mise run lint passes
  • mise run test:ci passes (unit + integration + E2E canary)
  • entire sessions stop --help shows correct usage with positional arg
  • Tests cover: no sessions, single session, --all, positional session ID, worktree scoping, already-stopped, not-a-git-repo, mutual exclusion of --all + session ID arg, batch stop, legacy sessions with empty WorktreePath, confirmation prompt consistency

Adds `entire stop` to manually mark one or more active sessions as ended,
preventing future checkpoint leakage without waiting for the agent to stop
naturally or for a SessionStop lifecycle hook.

Pure state mutation — no writes to the checkpoints branch, no condensation.
The existing PostCommit hook handles any remaining condensation on the next commit.

Flags: --session <id>, --all (worktree-scoped), --force/-f
TUI multi-select for 2+ sessions; confirmation prompt for single session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 19, 2026 22:54
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Comment thread cmd/entire/cli/stop.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new entire stop command to manually mark one or more sessions as ended (state-only mutation) to prevent further checkpoint leakage without waiting for the agent lifecycle to naturally close the session.

Changes:

  • Introduces entire stop with --session, --all (worktree-scoped), and --force flows, including interactive selection when multiple sessions exist.
  • Adds unit tests covering the non-interactive stop flows and common error cases.
  • Documents the new command in README.md and CHANGELOG.md, and wires it into the root command.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
README.md Adds entire stop to the command list.
cmd/entire/cli/stop.go Implements the stop command logic (single/all/multi-select) and output messaging.
cmd/entire/cli/stop_test.go Adds unit tests for stop behavior (force, flags, not-found, non-git repo, etc.).
cmd/entire/cli/root.go Registers the new stop subcommand.
CHANGELOG.md Notes the addition of entire stop.

Comment thread cmd/entire/cli/stop.go Outdated
Comment thread cmd/entire/cli/stop.go Outdated
Comment thread cmd/entire/cli/stop.go Outdated
Comment thread cmd/entire/cli/stop.go Outdated
Comment thread cmd/entire/cli/stop.go Outdated
peyton-alt and others added 3 commits March 19, 2026 16:22
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ire stop

- stopSelectedSessions: print ✗ per failed session to stderr so batch
  failures are visible immediately, not just as a joined error at the end
- stopSessionAndPrint: wrap markSessionEnded error with session ID for
  context in both single and batch stop paths
- runStopMultiSelect: warn and skip sessions concurrently removed between
  TUI render and confirmation; guard empty toStop after filtering
- filterActiveSessions: add nil guard; document intentional dual-check
  vs status.go's EndedAt-only filter
- handleFormCancellation: treat huh.ErrTimeout same as ErrUserAborted;
  wrap unexpected errors with action name for context
- --session flag description: note it is not scoped to current worktree
- tests: add TestStopCmd_AllFlag_ExcludesOtherWorktrees,
  TestStopCmd_AllFlag_NoActiveSessions, TestStopSelectedSessions_StopsAll
  (replaces non-executing cop-out multi-select test); add PhaseActive
  coverage to filter unit test; rename SingleSession_Force to clarify
  empty-WorktreePath intent; add ErrTimeout case to utils_test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Explicitly passing a session ID is already a deliberate action — no
confirmation prompt needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@peyton-alt peyton-alt marked this pull request as ready for review March 20, 2026 19:05
@peyton-alt peyton-alt requested a review from a team as a code owner March 20, 2026 19:05
peyton-alt and others added 4 commits March 30, 2026 18:07
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduce `entire sessions` parent command to group session management.
The stop command is now `entire sessions stop` with no alias for the
old top-level `entire stop`. Also fixes pre-existing broken
TestStopCmd_NotGitRepo assertion (expected SilentError but command
returns plain error since f009902).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 454bce9f05c7
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 3a713bd16a46
@gtrrz-victor gtrrz-victor changed the title feat: add entire stop command feat: add entire sessions stop command Mar 31, 2026
gtrrz-victor and others added 2 commits March 31, 2026 16:35
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 677601cfbf7f
`entire sessions stop <session-id>` instead of
`entire sessions stop --session <session-id>`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 5ccdcb0fdb9c
@gtrrz-victor gtrrz-victor enabled auto-merge March 31, 2026 14:51
@gtrrz-victor gtrrz-victor merged commit 1ccc0ee into main Mar 31, 2026
3 checks passed
@gtrrz-victor gtrrz-victor deleted the feat/entire-stop branch March 31, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants