Skip to content

feat(picker): surface alt-x decline reasons in the header - #3336

Merged
max-sixty merged 2 commits into
mainfrom
picker-waiting-row
Jul 1, 2026
Merged

max-sixty merged 2 commits into
mainfrom
picker-waiting-row

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

When alt-x in the wt switch picker declines to remove a row, the row visibly stays put but the reason only drained to stderr after the picker exited — the user pressed the key, nothing seemed to happen, and the "why" scrolled past on quit. This adds an in-picker echo of that reason.

A new generation-guarded HeaderFlash shows a one-line message in the picker header (skim reserves exactly one non-selectable chrome line — the header — and has no footer slot) for a beat, then self-clears back to the column labels. It's wired into all three "can't remove" surfaces, each styled to match the canonical representation that path already stashes for the on-exit drain:

  • current worktree → ○ Can't remove the current worktree (info — a by-design decline)
  • unmerged branch-only row → ○ Kept <branch> — branch is unmerged (info — a by-design retain)
  • main worktree / dirty / locked → ✗ The main worktree cannot be removed (error — a genuine rejection)

The full diagnostic still drains to stderr on exit; the flash is additive. This closes the TODO(picker-feedback) the keep paths carried.

The same change also aligns the --prs loading marker with the watchdog and the picker's other in-flight placeholders (↳ <dim>Fetching…</>): loading open PRs… → ↳ Loading open PRs…. The hint symbol sits in the pointer gutter and "Loading" stays aligned at column 2 (↳ is the same two columns the old indent used).

Implementation notes

HeaderFlash is shared picker-lifetime between the header item (which renders it) and AltXRemover (which sets it). flash_header sets the message, repaints, and spawns a short-lived timer that clears it after HEADER_FLASH_DURATION and repaints again. The clear is generation-guarded — a newer flash arriving mid-beat replaces the old one and isn't wiped by the old timer — and clear_if_current reads the generation under the message lock so the check and clear are atomic against a concurrent set.

Testing

Unit tests cover the HeaderFlash mechanism (set / generation-guarded clear / display priority of flash › loading › labels), the keep-path symbol, and the timer driven to completion (so the detached thread's clear+repaint is covered under nextest's process-per-test). A PTY integration test confirms the flash actually paints on alt-x of an unremovable row. The loading-marker assertions were updated in lockstep.

This was written by Claude Code on behalf of max

When alt-x declines to remove a row, the row visibly stays put but the
reason only drained to stderr after the picker exited — the *why* scrolled
past unseen. A new generation-guarded HeaderFlash shows a one-line reason
in the picker header (skim's only writable chrome slot — there is no footer)
for a beat, then self-clears back to the column labels. Wired into all three
"can't remove" surfaces, each styled to match the canonical representation it
already stashes:

- current worktree      → info  (○) — a by-design decline
- unmerged branch-only  → info  (○) — a by-design retain
- main / dirty / locked → error (✗) — a genuine rejection

The full diagnostic still drains to stderr on exit; the flash is the additive
in-picker echo. This closes the TODO(picker-feedback) the keep paths carried.

Also aligns the --prs loading marker with the watchdog and the picker's other
in-flight placeholders: `loading open PRs…` → `↳ Loading open PRs…` (hint
symbol in the gutter, "Loading" capitalized, text still at column 2).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean, additive feedback layer — the HeaderFlash generation guard reads correctly (the bump-before-lock / load-under-lock ordering makes the stale-clear race unrepresentable), and the three keep/error surfaces each match the symbol of the diagnostic they already stash (○ for the by-design retains, ✗ for the genuine rejection). Coverage of the mechanism (set / guarded clear / display priority) and the self-clearing timer is thorough.

Holding the verdict as a COMMENT rather than approving: this edits src/commands/picker/mod.rs, which carries the alt-x removal dispatch (is_force() / do_removal / branch force-delete), and per the repo's data-loss-surface review policy a change to that file is a human's call to merge. For the record, the removal dispatch in apply and the background-removal paths are unchanged here — the new flash_header calls sit only in the declined-removal arms (keep current worktree, keep unmerged branch-only row, and the Err rejection arm), so this is feedback-only and doesn't alter what gets deleted. Flagging for @max-sixty's merge decision on the deletion-surface grounds, not on any correctness concern.

One inline doc nit below.

The Err-arm flash renders via error_message (✗), not warning_message (▲);
the test's doc comment predated that symbol change. Addresses tend's inline
review note on PR #3336.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 7f6f34d into main Jul 1, 2026
36 checks passed
@max-sixty
max-sixty deleted the picker-waiting-row branch July 1, 2026 03:56
max-sixty added a commit that referenced this pull request Jul 2, 2026
Release v0.65.0. Version bump plus the 0.65.0 changelog section.

**User-facing changes in this release:**

- **Picker `alt-x` flashes why a worktree wasn't removed** (#3336,
#3350) — the keep/failure reason now appears in the picker header
instead of only draining to stderr on exit.
- **`-vv` diagnostics consolidate on `diagnostic.md`, led by the
performance profile** (#3329). This entry's bullet was previously
misfiled under the already-released `0.63.0` section (the PR merged
after `0.64.0` was tagged); this release moves it into `0.65.0`, where
the change actually ships, and drops a misleading "removed
`profile.txt`" clause for a file that never existed.
- **`wt remove` preserves your subdirectory position** (#3344, closes
#3343, thanks @caillou for reporting).

**Also included:** a fix to the release skill's reporter-finding grep —
`sort -un` on `#`-prefixed lines collapsed the whole issue-reference
list to a single entry (every line sorts as numeric 0), which nearly
dropped @caillou's credit. Now sorts on the numeric field after `#`.

The nightly cross-platform suite (full-tests linux/macos/windows,
feature-powerset, release-target, nix-flake, minimal-versions) passed
green on the cut-from tip before this PR was opened.

> _This was written by Claude Code on behalf of max_

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
worktrunk 0.65.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## Release Notes

### Improved

- **Picker `alt-x` flashes why a worktree wasn't removed**: When `alt-x` in the `wt switch` picker keeps a row instead of removing it, the reason now flashes in the picker header for a beat, rather than only draining to stderr after you quit — so the "why" is visible while the row is still in front of you. It covers both the by-design keeps (the current worktree; an unmerged branch-only row shows `○ Kept <branch> — branch is unmerged`) and genuine removal failures (a dirty, locked, or main worktree, shown as an error). The full diagnostic still drains on exit. The `--prs` loading marker now also matches the picker's other in-flight placeholders (`↳ Loading open PRs…`). ([#3336](max-sixty/worktrunk#3336), [#3350](max-sixty/worktrunk#3350))

- **`-vv` diagnostics consolidate on `diagnostic.md`, led by the performance profile**: A `-vv` run now opens with a one-line pointer to the log directory (`○ Verbose logging to .git/wt/logs/`) and closes by naming what it captured — `○ Logs, performance profile, and diagnostics saved @ diagnostic.md` — with the raw `trace.jsonl` / `subprocess.log` companions listed beneath and the `gh gist create` bug-report hint. `diagnostic.md` now leads with the performance profile, expanded by default and promoted above the environment / worktree / config dumps; that profile reports the 20 slowest calls (was 8) and 10 same-context redundant-command offenders (was 3). The profile lives in the `diagnostic.md` bundle, and `wt config state logs profile` re-renders it live from `trace.jsonl`. ([#3329](max-sixty/worktrunk#3329))

### Fixed

- **`wt remove` preserves your subdirectory position**: Removing a worktree from a subdirectory (e.g. `apps/gateway/`) now lands you in the equivalent subdirectory of the destination worktree rather than at its root — matching how `wt switch` already behaves, and falling back to the root when that subdirectory doesn't exist there. `wt merge` lands through the same handler, so it gains the same behavior. ([#3344](max-sixty/worktrunk#3344), closes [#3343](max-sixty/worktrunk#3343), thanks @caillou for reporting)

## Install worktrunk 0.65.0

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-installer.sh | sh && wt config shell install
```

### Install prebuilt binaries via powershell script

```sh
powershell -ExecutionPolicy Bypass -c "irm https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-installer.ps1 | iex"; git-wt config shell install
```

### Install prebuilt binaries via Homebrew

```sh
brew install worktrunk && wt config shell install
```

## Download worktrunk 0.65.0

|  File  | Platform | Checksum |
|--------|----------|----------|
| [worktrunk-aarch64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-aarch64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-x86_64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-pc-windows-msvc.zip](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-x86_64-pc-windows-msvc.zip.sha256) |
| [worktrunk-aarch64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-aarch64-unknown-linux-musl.tar.xz) | ARM64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-aarch64-unknown-linux-musl.tar.xz.sha256) |
| [worktrunk-x86_64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-x86_64-unknown-linux-musl.tar.xz) | x64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.65.0/worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256) |



### Install via Cargo

```sh
cargo install worktrunk && wt config shell install
```

### Install via Winget (Windows)

```sh
winget install max-sixty.worktrunk && git-wt config shell install
```

### Install via AUR (Arch Linux)

```sh
paru worktrunk-bin && wt config shell install
```
</pre>
  <p>View the full release notes at <a href="https://github.com/max-sixty/worktrunk/releases/tag/v0.65.0">https://github.com/max-sixty/worktrunk/releases/tag/v0.65.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!13428
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