Skip to content

Start a thread handoff with /handoff, and cancel it by deleting its pill - #7480

Merged
ymichael merged 3 commits into
get-bb:mainfrom
smsunarto:scott/composer-handoff-command
Nov 16, 2026
Merged

ymichael merged 3 commits into
get-bb:mainfrom
smsunarto:scott/composer-handoff-command

Conversation

@smsunarto

@smsunarto smsunarto commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

A same-provider handoff could start only from the model picker's Handoff to new thread row, and exit only through the banner's ✕. Deleting the Continue from @thread:… pill left the composer in handoff mode. Separately, the effect that strips a leftover handoff block while no handoff is active depended on the whole promptDraft object, which changes identity on every draft write. So it re-ran on each keystroke, and it raced any handoff start not batched with its draft write: it stripped the block that had just been seeded. Starting a handoff from a submitted command, which runs inside the composer's passive effect, triggered that race every time.

What changed

  • /handoff built-in command (packages/client-core/src/prompt/thread-handoff-request.ts, useCommandSuggestions, useComposerTypeahead):
    • THREAD_HANDOFF_COMMAND_SUGGESTION is a / suggestion with origin builtin.
    • The thread composer offers it while no handoff is active and no sent message is being edited. It is not offered in the inline queued editor or in the new-thread composer.
    • Built-in commands are merged ahead of provider commands. A provider command also named handoff is shadowed in the thread composer.
  • Submit path (ThreadDetailPromptArea.tsx):
    • submitFollowUpDraft and handleModifierSubmit check for a leading built-in /handoff mention.
    • When one is there, they start the handoff with the rest of the draft as the follow-up message, and send nothing.
    • Composers that auto-submit built-in commands on pick, which includes plugin composers, get this through the existing command search and submit(), with no new SDK member.
  • Cancel on pill delete:
    • While a handoff is active, a draft-store subscription exits the handoff when the source-thread mention disappears, and drops the leftover Continue from text.
    • The send path's own clearIfCurrentMatches is excluded during thread creation, so sending never cancels.
  • Strip-effect race:
    • The leftover-block strip effect now depends on the draft store's stable getCurrent and setDraft, not the per-render promptDraft object.
    • It still strips on mount and on handoff exit, but no longer on every draft change.
  • No CLI change: a handoff is a composer mode. Its CLI equivalent is bb thread spawn with a Continue from @thread:<id> prompt, which already works.

How you verified

  • New tests:
    • thread-handoff-request.test.ts covers command stripping and the source-removed draft.
    • ThreadDetailPromptArea.test.tsx covers that /handoff is offered only outside a handoff, that it starts a handoff instead of sending, that deleting the pill exits the handoff, and that the handoff survives the send's draft clear.
    • Disabling the send guard fails the last test.
  • pnpm exec turbo run typecheck lint --filter=@bb/app --filter=@bb/client-core: pass, with no new lint warnings.
  • vitest for src/views/thread-detail, src/components/promptbox and useCommandSuggestions: 838 passed. @bb/client-core: 239 passed.
  • Browser check on pnpm dev with bb's own composer, against a Claude Code thread:
    • /hand lists handoff, and Enter starts the handoff with the model unchanged.
    • Deleting the pill exits the handoff and keeps the typed text. Select-all delete exits it too.
    • ✕ still exits.
    • Sending creates the new thread and opens it.
    • The picker's Handoff to new thread row and its exit still work.
    • Reloading with a leftover block still strips it.
  • Not checked: the phone drawer, or the effect of the shadowed provider command on a provider that ships its own /handoff.

Fixes #7479

AGENT GENERATED

…ting its pill

A same-provider handoff could only start from the model picker's row and end
from the banner's X. /handoff is now a built-in thread-composer command,
handled in the follow-up submit path so plugin composers get it too, and
deleting the Continue-from thread pill exits the handoff. The leftover-block
strip effect now keys on the draft store's stable methods, so it no longer
re-runs on every draft change and races a handoff that starts outside a
React event.
@smsunarto
smsunarto marked this pull request as ready for review November 13, 2026 03:54
ymichael and others added 2 commits November 16, 2026 11:27
Clicking a built-in command in the / menu only inserted its pill, while
Enter inserted it and submitted. Route menu clicks through the same path
as Enter so /handoff and /compact behave the same either way. Tab still
only inserts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 1983b0d into get-bb:main Nov 16, 2026
94 of 95 checks passed
smsunarto added a commit to smsunarto/bb-plugins that referenced this pull request Nov 18, 2026
…BBP-14) (#184)

* fix(t3-composer): size the empty composer editor to one line

* fix(t3-composer): inset the Project and Environment search field from the sheet's top

Monokai now draws bb's picker search row as a bordered field. T3 Composer's
older rule zeroed its top margin, so the field touched the sheet's edge. Inset
it 4px like the rows, size the field rather than the input so it no longer
overflows the border, and give phones a 44px field with 16px text.

* feat(t3-composer): open the desktop composer two lines tall

The empty editor's minimum grows from one 20px line to two (48px). Touch
screens keep their one-line 32px minimum.

* fix(t3-composer): stop text typed after a mention pill from gluing onto it

Port of get-bb/bb#6581 (38c939c85). Serialization adds a space between a
pill and an adjacent word or pill, so the agent sees /review Also, not
/reviewAlso.

* fix(t3-composer): close a multiword @ query once it settles with no matches

Port of get-bb/bb#7002 (631a62619). Typing on after an unmatched @query
("@see you later") no longer keeps an empty menu over the prose. Shortening
the query back reopens it, shown again only once something matches.
typeahead.test.tsx covers it in the mounted composer, since upstream's
tests live in bb's app.

* fix(t3-composer): cap the editor by the visible shell height

Port of get-bb/bb#7061 (9519ec685). On iOS dvh ignores the software
keyboard, so a long draft pushed the composer under the header. The caps
now read BB's --bb-shell-height (bb 0.49 defines it), including the
plugin's own !important thread-composer rule in app.css, which would
otherwise keep the old 50dvh cap.

* fix(t3-composer): keep slash command names visible when an argument hint is long

Port of get-bb/bb#7565 (dafe34edc). A long argument hint, such as Claude
Code's code-review, collapsed the command name and pushed the / menu
sideways on phones. Description, then hint, now give way before the name.
Uses gap-1, not upstream's gap-1.5, to stay on the plugin's 4px grid; the
Storybook story is skipped since Storybook was removed here.

* feat(t3-composer): run a built-in / command when its row is clicked

Port of the composer part of get-bb/bb#7480 (1983b0dfb): a click on a
built-in command now sends it, as Enter already did. The plugin's own
/handoff stays excluded, so a draft before it is not sent with the
handoff. #7480's host-side /handoff is not in bb 0.49 and the plugin
keeps its own; its pill-delete cancel was already ported (a9aada1).

* perf(t3-composer): share one resize observer and read before writing

Port of get-bb/bb#7635 (2d04779a1). The composer's height tracker, editor
cap and typeahead max-height observe through one shared ResizeObserver
that runs every read before any write. lib/shared-resize-observer.ts is
vendored from packages/shared-ui with its tests, less the case for
useMeasuredValue, which this plugin does not have. bb 0.49's plugin
runtime exposes the full react-dom namespace, so its flushSync resolves.

* docs(t3-composer): record the upstream sync base and held changes

The fork base d4fa9cb is not on get-bb/bb's main; its content matches
21d5db72c. The plugin is now synced through 2d04779a1. Also corrects the
stated BB and SDK requirement to match package.json.

* fix(t3-composer): clear the last 4 frozen lint errors

Bare oxlint on the plugin now exits 0. Each is a reasoned suppression with
precedent elsewhere in the repo: attachment videos carry no captions, the
form delegates its children's keys and presses, the test fake mirrors
BB's role-based picker DOM, and an object URL is created and revoked as
one effect pair. Removes their lint-baseline entries.
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.

Start a thread handoff with /handoff, and cancel it by deleting its pill

2 participants