Skip to content

feat(minimald): add a save-changes-then-delete lane to the shell-exit prompt - #1124

Merged
norrietaylor merged 8 commits into
mainfrom
feat/exit-prompt-archive
Jul 31, 2026
Merged

feat(minimald): add a save-changes-then-delete lane to the shell-exit prompt#1124
norrietaylor merged 8 commits into
mainfrom
feat/exit-prompt-archive

Conversation

@norrietaylor

@norrietaylor norrietaylor commented Jul 31, 2026

Copy link
Copy Markdown
Member

Stacked on #1123 (base is its branch; rebases onto main when it merges). The exit prompt's only destructive option throws away changed files; a middle lane archives the delta and only then deletes, so deletion only ever follows a confirmed save.

  • Save changes to <state>/archives/<name>-<timestamp>.tar.zst, then delete — shown only when files changed; archives added+modified files, then destroys the session.
  • Archive write failure leaves the session intact and re-renders the prompt with the error.
  • Empty/unavailable delta renders the existing two-option prompt unchanged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KyZLpkRf9G4A2hUDgDvn5f

Note

Add save-then-delete lane to the shell-exit prompt in minimald

  • Introduces a session_delta module with workspace change detection and archiving: walks the workspace before process launch to snapshot file state, re-walks on exit to compute added/modified/deleted files, and writes zstd-compressed tar archives of changed files.
  • Extends the shell-exit prompt in session_host to display changed files (up to 10 rows) and offer a 'Save changes to , then delete' option when changes are detected; cancel defaults to keeping the session.
  • Adds a save_changes routine that re-computes changed paths and writes the archive before deletion, re-prompting on failure to prevent accidental data loss.
  • Walk is time-bounded to 5 seconds, excludes .git, never follows symlinks, and uses blake3 digests (capped at 4MiB) for modification detection.

Macroscope summarized 2d88c04.

norrietaylor and others added 2 commits July 30, 2026 23:21
…e activation

The keep-or-delete prompt asked users to decide without saying what a
delete would lose. The host now baselines the workspace before the
session process launches and the prompt lists the delta: added,
modified, and deleted files (capped at 10 rows), or states that nothing
changed — in which case the delete option says so. Change detection is
best-effort: an unwalkable workspace or a failed re-walk renders the
plain prompt and never blocks exit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyZLpkRf9G4A2hUDgDvn5f
… prompt

The prompt's only destructive option threw away changed files. When the
delta is non-empty a middle option archives the changed files to
<state>/archives/<name>-<timestamp>.tar.zst and only then deletes, so
deletion only ever follows a confirmed save; a failed archive write
leaves the session intact and re-renders the prompt. The option is
omitted when nothing changed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyZLpkRf9G4A2hUDgDvn5f
@norrietaylor
norrietaylor marked this pull request as ready for review July 31, 2026 06:59
@norrietaylor
norrietaylor requested a review from a team as a code owner July 31, 2026 06:59
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 29408101-bf96-4244-9a14-a7960ca76ddf

📥 Commits

Reviewing files that changed from the base of the PR and between d392e00 and 2d88c04.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • crates/minimald/Cargo.toml
  • crates/minimald/src/session.rs
  • crates/minimald/src/session_delta.rs
  • crates/minimald/src/session_host.rs

Comment @coderabbitai help to get the list of available commands.

norrietaylor and others added 4 commits July 31, 2026 10:19
… exit walk

Review follow-ups: the walk moves to walkdir (no symlink following, no
hand-rolled recursion), file signatures gain a size-capped blake3
content digest so same-length mtime-preserved edits cannot masquerade
as "no files changed", and the exit-time re-walk is bounded by a
timeout that degrades to the plain prompt instead of blocking teardown.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyZLpkRf9G4A2hUDgDvn5f
Carries the delta-branch review follow-ups into the archive lane; the
save path's changed_paths/write_archive pick up the digest-bearing
signatures unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyZLpkRf9G4A2hUDgDvn5f
….git in the delta walk

Review follow-ups: Binding::run's ProcessExited epilogue moves into a
shell_exit_prompt associated fn (byte-identical channel output), and
both workspace walks now skip the root-level .git directory — the delta
reports working-tree files, and git-internal churn (index, refs,
objects) would otherwise flood the capped row list the moment any git
command runs in the session. Nested .git directories (vendored
subrepos) remain ordinary workspace content.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyZLpkRf9G4A2hUDgDvn5f
The extracted shell_exit_prompt helper carries the archive lane's extra
save-then-delete arm (plus the archives_dir/name capabilities it
needs), and the root .git exclusion now also keeps git-internal churn
out of the save archive.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KyZLpkRf9G4A2hUDgDvn5f
Base automatically changed from feat/exit-prompt-delta to main July 31, 2026 20:24
# Conflicts:
#	Cargo.lock
#	crates/minimald/src/session_delta.rs
#	crates/minimald/src/session_host.rs
@norrietaylor
norrietaylor force-pushed the feat/exit-prompt-archive branch from a3bd2d9 to b458aa8 Compare July 31, 2026 20:32
@norrietaylor
norrietaylor enabled auto-merge (squash) July 31, 2026 20:49
@norrietaylor
norrietaylor merged commit 4a738d4 into main Jul 31, 2026
30 checks passed
@norrietaylor
norrietaylor deleted the feat/exit-prompt-archive branch July 31, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants