Confirm before archiving active thread work - #2344
Open
jshph wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
The sidebar's hover-revealed archive button intentionally makes routine cleanup one click, but it used the same immediate archive path even when the selected thread or one of its visible children was still working. A small targeting mistake could therefore interrupt active work without giving the user a chance to reconsider.
What changed
Thread archive actions now inspect BB's existing React Query cache synchronously at click time. Idle thread trees retain the current one-click behavior. When the selected thread or a cached child has an active runtime, workflow, background agent or command, plan, or goal, BB opens an “Archive active work?” confirmation before running the existing archive mutation.
The guard lives in
ThreadActionsProvider, so the sidebar quick action, overflow menu, keyboard command, and plugin-exposed single-thread action share the same behavior. It is deliberately a best-effort UI guard: it adds no preflight request, server enforcement, wire contract, protocol bump, or new subscription, preserving the sidebar's existing responsiveness and archive lifecycle.How you verified
Added regression coverage for idle trees, active parents, active children, withholding the archive mutation until confirmation, and performing the confirmed archive exactly once.
pnpm exec turbo run typecheck --filter=@bb/apppnpm exec turbo run test --filter=@bb/app --force -- src/components/thread/ThreadActionsProvider.test.tsx src/hooks/cache-owners/thread-archive-cache.test.ts@bb/appsuite on the feature worktree before rebasing: 430 files passed; 3,338 tests passed and 3 skipped.