Skip to content

fix(tui): report a removed checkout after a clean archive - #716

Merged
mohitranka merged 1 commit into
mainfrom
fix/cleanup-kept-message
Sep 17, 2026
Merged

mohitranka merged 1 commit into
mainfrom
fix/cleanup-kept-message

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Problem

Archiving a managed Session whose worktree is clean removed the checkout, but the TUI still reported:

worktree kept — it has uncommitted work

Root cause

crates/forge-tui/src/app/input.rs decided between the two messages by looking for a SessionLifecycle::Removed row in the roster. A removed Session never appears there: the supervisor's snapshots() drops the row from state.actors and it is not carried in unavailable_tasks. The lookup was therefore always None, so removed was always false and every successful archive + cleanup reported the blocked-cleanup warning.

A blocked cleanup is the case that keeps the row — as retained.

Fix

The retirement follow-up now reads the row's presence, not a lifecycle it never carries: absent (or explicitly Removed) means the checkout is gone; still listed means it is on disk. The blocked path still warns, which is the honest report for it.

Tests

  • a_clean_archive_reports_the_checkout_removed_not_uncommitted_work — reproduced the report before the fix (left: "worktree kept — it has uncommitted work"), now asserts the success message and Ok severity.
  • a_blocked_cleanup_reports_the_kept_checkout — the other direction: real uncommitted work still leaves the row retained, still listed, still warned.

Verification

  • cargo test --package forge-tui --locked app::tests::multi_task → 55 passed.
  • cargo fmt --all -- --check clean.
  • cargo clippy --package forge-tui --all-targets --locked clean.

The .forge/local runtime subtree is git-excluded, so the underlying cleanliness check is accurate — this was presentation only, no worktree is removed that was not removed before.

A successful archive and cleanup still reported "worktree kept — it has
uncommitted work". The retirement follow-up looked for a `removed` row in
the roster, but `snapshots` drops a removed Session entirely, so the check
was always false and the warning was always shown.

A blocked cleanup keeps the row as `retained`, so the row's presence — not
a lifecycle it never carries — is the signal that the checkout is still on
disk. Cover both directions with tests.
@mohitranka
mohitranka merged commit 8c8e817 into main Sep 17, 2026
3 checks passed
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.

1 participant