Skip to content

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

Merged
ymichael merged 1 commit into
mainfrom
bb/2318-skill-chip-picked-mid-message-is-serialized-thr_bh2v6jgtcw
Oct 29, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/2318-skill-chip-picked-mid-message-is-serialized-thr_bh2v6jgtcw

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

A composer pill (skill, file, thread, …) is an atomic node whose text (/poteto-mode, @src/foo.ts) was joined directly to the text beside it. The only separator was the space the picker inserts at pick time, and that space is easy to lose:

  • Send trims it when the pill is the last token.
  • History recall and queued/sent-message edit rebuild the draft from that trimmed text, leaving the caret right after the pill.
  • Voice insertion reads the pill as "\n" and decides it needs no leading space.
  • Deleting the space by hand.

Text typed next to the pill is then sent glued to it (/poteto-modeAlso testing). The pill has a border but no margin, so it looks separated on screen. The model and bb thread log see the corrupted word, and a file pill sends a broken path. Investigation report: https://get-bb.github.io/reports/issues/2318.html

Since #6576, all three providers (Claude Code, Codex, Pi) find a skill by its mention range, so the glue no longer stops the skill from running. This PR fixes the text.

What changed

  • plugins/composer/src/editor/prompt-editor-serialization.ts: when the editor contents are turned into text, one space is emitted where a pill directly touches a letter, a digit or another pill on the same line.
    • Punctuation is left alone: @foo.ts, stays as typed.
    • The separator is not mapped in offsetMapping, like the "\n" for hard breaks. Mention ranges still cover exactly the pill text.
    • The editor document is untouched, so the caret, undo and IME composition are unaffected.
    • This covers every entry path: typing, restore, voice, paste and copy.
  • I considered and rejected giving the pill node a leafText. An explicit leafText argument to textBetween takes priority over the node spec, every caller passes "\n", and trigger detection relies on the pill reading as a line break.
  • No wire, protocol, CLI or SDK changes.

How you verified

  • New serialization table in prompt-editor-serialization.test.ts:
    • Pill/word, word/pill, pill/pill and pill-in-quote cases separate.
    • Each result is stable when converted back and forth.
    • Punctuation, whitespace and line breaks are unchanged.
  • Two PromptBoxInternal tests: typing after a restored trailing pill, and a voice transcript inserted after it.
  • The separation cases and both composer tests fail on unchanged code and pass with the fix.
  • pnpm exec turbo run test typecheck lint --filter=bb-plugin-bb--composer --filter=@bb/app passes (96 + 6,474 tests).
  • Live, on an isolated dev app with Claude Code:
    • Picked a skill, deleted the space the picker added, typed Also testing. The editor had the pill directly followed by the text; the server stored I am lost. /poteto-mode Also testing with the mention on /poteto-mode.
    • Typing , then reply. straight after a pill was stored as /poteto-mode, then reply..

Fixes #2318

🤖 Generated with Claude Code

AGENT GENERATED

…ializing

Text typed right after a pill (after restoring a sent prompt, voice
insertion, or deleting the pick-time space) was glued onto the pill's
text, e.g. /poteto-modeAlso. Serialization now emits a space where a
pill touches a letter, digit, or another pill on the same line.

Refs #2318

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 38c939c into main Oct 29, 2026
44 checks passed
@ymichael
ymichael deleted the bb/2318-skill-chip-picked-mid-message-is-serialized-thr_bh2v6jgtcw branch October 29, 2026 21:05
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.

Skill chip picked mid-message is serialized without trailing space and never reaches Claude Code as a skill

1 participant