Skip to content

Finish requested picker removals before exiting - #4458

Open
max-sixty wants to merge 14 commits into
mainfrom
codex/picker-removal-completion
Open

max-sixty wants to merge 14 commits into
mainfrom
codex/picker-removal-completion

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Leaving the picker can terminate requested removal work before it finishes or before its error is shown. Join removal workers before exit, preserve their actual diagnostics, and restore optimistic rows when removal fails.

Depends on #4457, whose shared removal producer preserves errors after checkout deletion; review this diff against codex/branch-removal-errors.

Validation: 46 focused tests pass under Rust 1.98. Claude reviewed the source; its technical findings are addressed, with the follow-up reviewed independently by Codex.

This was written by Codex on behalf of max-sixty

worktrunk-bot
worktrunk-bot previously approved these changes Oct 12, 2026

@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.

codecov/patch fails on this head: 10 added lines in src/commands/picker/mod.rs are uncovered. AGENTS.md makes that check a merge gate needing explicit approval, so I've withdrawn my approval until it's addressed or waived.

The gap worth closing is the new else if let Some(error) = failure arm in both background closures (stash_failed_removal(&stashed_warnings, …) in drop_and_remove_in_background and morph_and_remove_in_background). It handles a removal that errors after the checkout is gone, which is the case the PR description calls out ("report it even when there is no row to restore"), and no test reaches it. The do_removal doc names a trigger: a post-remove/post-switch hook that fails to render or spawn during announcer.flush(). A test like test_apply_reverts_morph_when_pre_remove_fails with an approved post-remove that fails that way, then finish_removals and an assert on the stash, would cover both arms.

The other misses look fine to leave: the Err arm of spawn_removal (thread spawn failure) and the empty-diagnostic early returns in stash_failed_removal / stash_diagnostic aren't reachable from a normal test.

@worktrunk-bot
worktrunk-bot dismissed their stale review October 12, 2026 20:56

codecov/patch failed — merging needs a coverage fix or explicit maintainer approval

@max-sixty
max-sixty changed the base branch from main to codex/branch-removal-errors October 12, 2026 21:37
worktrunk-bot
worktrunk-bot previously approved these changes Oct 12, 2026

@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.

The new test_post_removal_ref_failure_preserves_drop_or_morph_outcome covers the post-checkout failure arm I asked about. codecov/patch is still red at 97.1%, though. The 7 lines it reports as missed are the Err arm of spawn_removal (thread spawn failure), the empty-diagnostic return in stash_diagnostic, and an assert-message argument in a test. None of them can be reached from a normal test. AGENTS.md makes a failing codecov/patch a merge gate that needs explicit approval, so I've withdrawn my approval again. A maintainer waiver is the remaining step. The code itself needs no change.

@worktrunk-bot
worktrunk-bot dismissed their stale review October 12, 2026 22:12

CI failed — codecov/patch below target; needs maintainer waiver

Base automatically changed from codex/branch-removal-errors to main October 28, 2026 17:32

This branch has not been deployed

No deployments
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