Repository navigation
Fix nesting worktree groups under threads - #4078
Merged
ymichael merged 10 commits intoSep 23, 2026
Merged
Conversation
ymichael
force-pushed
the
bb/fix-dragging-threads-into-worktrees-thr_pex33uqdb4
branch
4 times, most recently
from
September 23, 2026 20:06
5632fa6 to
81a5e10
Compare
ymichael
force-pushed
the
bb/fix-dragging-threads-into-worktrees-thr_pex33uqdb4
branch
from
September 23, 2026 20:34
b467c90 to
c3db162
Compare
ymichael
force-pushed
the
bb/fix-dragging-threads-into-worktrees-thr_pex33uqdb4
branch
from
September 23, 2026 20:51
c3db162 to
b6c4c32
Compare
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ymichael
deleted the
bb/fix-dragging-threads-into-worktrees-thr_pex33uqdb4
branch
September 23, 2026 21:37
ymichael
added a commit
that referenced
this pull request
Sep 23, 2026
## Human comments ## What was wrong #4078 made worktree groups draggable onto threads, into sections, and into and out of Pinned by adding a group copy of every drop decision (`nest-group`, `detach-group`, `pin-group`, `unpin-group`, next to `move-group`). Each copy had its own resolver branch, landed check, and handler, so single-thread and group drops had to be fixed twice and drifted: group drags did nothing in grouped (project/machine) mode, a group pin ignored the Pinned insert marker it displayed, and group section moves rewrote `sectionId` on every nested descendant even though nested threads follow their parent. A worktree group is only a display grouping, so it is really a list of top-level threads — the same thing as a single-thread drag with one entry. ## What changed `plugins/thread-list/app/dnd/useSectionThreadDnd.ts` (1742 → 1422 lines): - A dragged item resolves to its top-level threads: `[thread]`, or a group's `nodes`. - Decisions shrink to `move` (covers move, detach, and unpin into a section), `nest`, and `pin`, plus the unchanged `reorder-pinned`/`rejected`/`unchanged`. Each carries the exact `unpinThreadIds`, `updates`, and `pinThreadIds` for its threads, computed per thread from its own pin and nesting state. - One executor applies unpin → updates → pin, toasts once if an update fails, and stops before pinning. - Pinned inserts chain one request per thread so a group lands together at the marker, and use the pinned thread order rather than sortable item ids. That fixes #4078's pinned grouping sending an `environment:` item id as a neighbour thread. Behaviour changes that follow from applying one rule to both: - Group drags work in grouped mode, with the same rules as single threads there. - Group section moves write only the top-level threads. - Dropping a group back into its own section, or a pinned group back into Pinned, shows the "unchanged" state instead of nothing. - Nesting the child of a pinned thread no longer sends a redundant unpin. - Failure toasts read "Failed to move thread(s)." / "Failed to pin thread(s)."; "Failed to unpin and move thread." and the "worktree group" wording are gone. - A thread whose stored section differs from where it is displayed gets its section rewritten when dropped in its displayed section (previously treated as unchanged). Also removes the unused `useUpdateThreads` hook (and its tests) from `apps/app`; the plugin SDK's update batching stays. No wire, CLI, SDK, or guide changes. ## How you verified - Rewrote the decision tests for the new shape, including group nest/move/pin/unpin, grouped mode, own-descendant rejection, the unchanged cases, chained pinned inserts, and thread neighbours next to a pinned environment group. - New projection test: a group whose un-parenting fails is not pinned. It fails when the executor keeps going after a failed update. - `pnpm exec turbo run typecheck lint test --filter=bb-plugin-thread-list --filter=@bb/app` passes (thread-list 434 tests; app 5059 passed, 5 skipped). - Rebuilt and ran `pnpm start:worktree` from this change for manual testing. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Human comments
This makes a worktree/environment group a valid thread-row drag target, supports dragging it back to a section to unparent it, makes thread nesting less finicky, gives group drags an accurate preview, and applies the whole group optimistically on drop.
What was wrong
Environment-group drags were excluded from the nest-target heuristic, so dropping a Worktree group on a thread row could never establish the requested parent relationship. After adding that path, section drops moved the group section but did not clear its root parent relationships. The heuristic also used a narrow row band, a 350 ms delay, and the dragged card edge for horizontal cancellation, making valid targets easy to miss. The group preview inherited the representative root thread's cached display title, so its floating overlay and projected child looked like one root thread. Group persistence also launched one independent optimistic transaction per root, repeatedly cancelling queries and allowing partial intermediate hierarchy states.
What changed
nest-groupdrop decision that reparents only group root threads, preserving descendants and preventing cycles.detach-groupdecision that unparents only group roots while moving the represented group into the target section.HANDOFF.mdand before/after reviewer evidence for parenting, unparenting, and the corrected child preview.How you verified
pnpm exec turbo run test --filter=bb-plugin-thread-list --force -- --run app/dnd/useSectionThreadDnd.test.ts app/dnd/useSectionThreadDnd.projection.test.tsx(46 passed)pnpm exec turbo run typecheck --filter=bb-plugin-thread-list --forcepnpm exec turbo run test --filter=@bb/app --force -- --run src/hooks/mutations/thread-state-mutations.test.tsx src/lib/plugin-bound-sdk.test.ts src/components/sidebar/useSectionThreadDnd.test.ts src/components/sidebar/useSectionThreadDnd.projection.test.tsx(65 passed)pnpm exec turbo run typecheck --filter=@bb/app --forcepnpm exec turbo run typecheck --filter=@get-bb/plugin-sdk --forceReviewer worktree group (2 threads).Related: #3029