Skip to content

feat(composer): let completion providers add rows beside the caret owner - #3836

Merged
LordMelkor merged 13 commits into
mainfrom
clod/completion-supplement
Nov 21, 2026
Merged

LordMelkor merged 13 commits into
mainfrom
clod/completion-supplement

Conversation

@LordMelkor

@LordMelkor LordMelkor commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What a person gets: someone types @design to reach a team. Today a plugin can't put its rows in the @ popup without taking the popup over and hiding the people. With this hook, the plugin's rows show in the same popup under their own heading, and the people rows stay as they are. With no supplement registered, nothing changes.

@b with a plugin that adds groups @b today
The popup shows Bob Member, then a Groups heading with Bobsled Team, 1 person The popup shows one row, Bob Member

Size: production +327/−158, tests +611/−3, docs +25, at e4cdd8ff1.

Status: an automated review approved the code at 275173f99 and left the two product rules below to a person. The author has decided both. Two commits since then: cd95a6906 (production +1/−1) applies the decision on the second rule and adds the real-composer Enter and Tab cases that review suggested, and e4cdd8ff1 brings the contract's comment and the docs in line with it (no code change).

Two product rules, both decided by the author.

  1. A plugin's row can be the default Enter or Tab pick under @. Decided: yes, as written. This happens when the plugin orders its section above the people rows: the first row is the default, as it is today. On main, a plugin can already take Enter under @ by registering a provider that owns the caret, and then the people rows are hidden. A typed Space still accepts only the people provider's exact match.
  2. A supplement that has published nothing holds nothing. Decided: no silent hold and no timer. Only a published holdAutoSelect: true keeps Space from picking the people provider's exact match, so a supplement that is still loading publishes the hold itself. One that never publishes changes nothing: @Bob and Space picks Bob, as on main. Up to 275173f99, a supplement that hadn't published yet for the query held Space for as long as the query was open.

Moved from #3726, so that the branch is in this repository. The earlier review history is on #3726.

Summary

More than one completion provider can contribute rows to the same composer trigger. Today one provider wins the caret at a given start and only that provider mounts, so a plugin that offers rows for @ either loses to the bundled people provider or replaces it.

A provider registered with ctx.conversation.registerCompletionSupplement(provider):

  • mounts beside the winning provider when its own match returns the same start, with its own query;
  • never wins the caret, so it never opens a popup alone.

Registration: older hosts have no registerCompletionSupplement, so a plugin calls it as registerCompletionSupplement?.(provider) and adds nothing there. registerCompletion refuses a provider with supplement set, so the method is the only way to register one. A flag on registerCompletion would not degrade safely: a host that doesn't know it treats the provider as an ordinary one, and with an order below the bundled mentions' that provider owns the @ caret and hides the people rows. An end-user test on Buzz 1.0.5 showed this with the earlier flag-only form of this PR.

Sections: each provider's rows form a section, ordered by the existing order field, then the contribution key, with the winner among them. A supplement chooses its place through order. Its section sits under a host-drawn heading with the provider's title. The winner's section gets its title heading too when another section comes first and the winner draws no heading of its own, so its rows never read as part of the section above. Alone or first, the winner looks as it does today. Each provider keeps its own 50-row cap. There is no shared quota.

Rows keep their provider: a row is identified by its provider plus its item id, so two providers may use the same id. Accept, canSelect, disabled, retry and status each go to the provider that published the row.

Exact match: a supplement decides no exact match. The host reads terminator evidence (spaceId, spacePending) only from the winner, and drops a supplement row's agent mark.

  • holdAutoSelect: true on a supplement's result says that its whole source, not only its shown rows, has or extends the typed name, or is still loading. While any supplement holds, a typed terminator never accepts the winner's exact match and types as text. This is the general form of the rule the bundled teams use: @eng followed by Space must not pick a person called Eng while a group named eng exists.
  • Only a published hold holds. A supplement that has published nothing for this query holds nothing, so one that is still loading publishes holdAutoSelect: true itself.
  • A supplement that throws, in its component or in one of its row previews, drops only its own section and releases its hold. From then on, for this query, the host refuses its publications and its rows.
  • Escape still dismisses the popup while a supplement's published hold is on, even when no row is shown. With nothing shown and no hold, Escape goes on to the composer, as it does with no supplement.
  • The first row is selected by default, so Enter and Tab take a supplement row ordered above the winner's. A typed terminator still accepts only the winner's exact match.

With no supplement registered, behaviour is unchanged.

Why this is in core (Necessity and Minimality)

Features belong in plugins, and core gets only the smallest general capability a plugin needs. This is the rule in this repository's AGENTS.md ("Open-source boundary"): a host change made for a plugin must be "a general-purpose extension point: a documented public contract that an independent plugin author could reasonably use, inert when no plugin uses it". The table measures each change two ways. Necessity: a plugin can't do it with today's API. Minimality: it is the smallest general hook any plugin could use.

Change Necessity: a plugin can't do this today Minimality: the smallest general hook
registerCompletionSupplement on Conversation (service.tsx), kept as supplement: true on the existing completion contribution (contracts.ts) and matched in completion.ts Supplements: matchCompletion keeps one winner per caret (completion.ts:36-75 on the base), and ComposerCompletions mounts only that provider. A plugin on @ either loses to bundled mentions (order -10, src/bundled/mentions/index.tsx:13) or replaces every people row. Wrapping or replacing the bundled provider isn't possible from a plugin. A method, not only the flag: a host that doesn't know the flag treats a supplement as an ordinary provider. It sorts providers by order, then key, and a later one replaces the winner only at a later start (completion.ts:42-48 and :60 at v1.0.5). With order below -10, the plugin's provider owns @ and hides the people rows, which the end-user test found on Buzz 1.0.5. With order above -10, it still owns @ wherever the bundled matcher declines, such as right after a completed identity link (src/bundled/mentions/mention-query.ts:13-16), and on a host with supplements its rows sit below the people's 50 (next row). Nothing in that host's API tells a plugin whether supplements exist, so a plugin can't guard the flag itself. One method beside registerCompletion, writing to the same contributions, so no new reader or component changes. It names no feature, and reuses order for placement and title for the heading. Its absence on older hosts is the capability check, as with registerLinkPreview and registerIdentityMark.
Sections in order, then key (ComposerCompletions.tsx) The popup is max-height: 17.5rem (Completions.module.css:16), about 6 to 7 rows, and bundled people fill up to 50 rows (MentionCompletion.tsx:314-320). Rows placed after the winner sit below row 50 for short queries such as @e, reachable only by a wrap-around ArrowUp. Reuses the existing order field. No quota, no new field.
Rows keyed by provider plus id Provider ids are local. Without the provider in the key, two providers that both publish x share selection and acceptance. Test: "accepts each row through its own provider when their ids collide". A key change only. Each provider's results stay separate.
holdAutoSelect?: boolean on CompletionResult The host accepts the winner's spaceId on a terminator. Only the supplement knows whether its whole source, rather than its shown rows, has a longer or equal name. Test: "keeps Space from picking the winner's exact match while a supplement holds it". One boolean, read only from supplements. It's the general form of the bundled teamBlocksSpace rule (use-team-mentions.ts:32-50).

FOUNDATION: this PR edits two FOUNDATION files. src/features/conversation/contracts.ts gets two optional fields, supplement and holdAutoSelect. src/features/conversation/service.tsx gets registerCompletionSupplement and the refusal in registerCompletion (+17/−1). The PR's author, who directs this work, gave the human guidance for the contracts.ts fields. For the service.tsx method, the author had a second agent review the design, and that review approved this shape. The author, who holds the Maintain role on this repository, has since approved the whole change for merge, including both FOUNDATION edits and the published-hold rule above.

Merge order

This PR goes before the multi-recipient chip rework (#3837), which is stacked on it, because both edit the completion types in contracts.ts. No other order is needed.

Size

Measured against main (cf2355f1e) at e4cdd8ff1, with git diff.

Added Removed
Production 327 158
Tests 611 3
Docs 25 0

Most of it is ComposerCompletions.tsx (+269/−148): mounting supplements beside the winner, their sections, and per-provider results, failures and holds. completion.ts is +29/−9, service.tsx +17/−1 and contracts.ts +12, of which 2 lines are the two fields and 10 are their comments.

Validation

Published holds only, at cd95a6906: one commit on 275173f99. Production is one line: held() in ComposerCompletions.tsx counts a supplement only when it has published holdAutoSelect: true. The docs say the same in docs/plugin-architecture.md.

  • Unit tests: "leaves Space to the winner when a supplement %s" gets the row "has not answered", which replaces the test of the old rule. The Escape test now says that a published hold beside an empty winner keeps Escape, and a silent supplement doesn't.
  • Real composer, in tests/browser/completion-work.spec.mjs, Chromium and WebKit. The fixture's supplement publishes in an effect, as a plugin does.
    • With a published hold: @Mary Jane and Space typed with no pause gives no chip, and the Space stays as text.
    • With a supplement that publishes nothing: Space picks Mary Jane, as on main.
    • Enter, and Tab, on a supplement row ordered first: each puts in that row's two member chips.
    • The two Space cases, run 20 times each in each engine: 80 of 80.
  • Controls. With the old rule put back, the new unit row, the Escape test and the silent browser case fail. With no hold at all, the browser hold case fails with one chip where none is expected.
  • On a separate Linux machine at cd95a6906: pnpm check passes. src/features/conversation and src/features/messages pass, 142 files and 3,860 tests. The nine browser specs for mentions, completions and the composer pass in Chromium and WebKit, 122 of 122.
  • In the app, built from cd95a6906 without feat(composer): one chip for several recipients, sent as @label #3837, with the plugin these hooks were built for: @Ops Shared shows one group row, a pick gives one chip per member, and the sent message has a p tag for each. 5 of 5 cases pass. That plugin publishes its own hold while its groups load, so it doesn't depend on the old rule.

e4cdd8ff1: a comment, the docs and one test name, after an independent review of cd95a6906 found no code defect and one stale sentence. The comment on supplement in contracts.ts and docs/plugin-architecture.md now say that a supplement which is still loading publishes holdAutoSelect: true in its mount effect, for every query. No type changes. pnpm check passes and src/features/conversation passes, 19 files and 190 tests.

Some text below, written at earlier heads, describes the old rule ("the hold before a first answer"). cd95a6906 replaces it.

Updated from main at 275173f99: a merge of main at cf2355f1e (#4133) and one test commit. #4133 changed accept in ComposerCompletions.tsx, which this PR also changes, so the merge had three conflicts, all in that file:

  • accept takes Expose confirmed owner send evidence #4133's browser event and keeps this PR's lookup of the row's own provider.
  • Expose confirmed owner send evidence #4133's withHumanMentionSelection wraps the replace call for every row, a supplement's too. A supplement row that a person picks marks its recipients as the owner's mention, and a scripted pick marks none. That is what main already does for every provider's row, a plugin's ordinary registerCompletion row included: accept wraps each pick and checks no provider. A supplement gets nothing more.
  • Expose confirmed owner send evidence #4133's edit to the single Retry row goes with that row. This PR draws one Retry row per provider through the same option element as every other row, and its click passes the event.

All three callers of accept run inside their key or click event. A supplement ordered above the people rows holds the first row, so Enter or Tab there gives that evidence for the supplement's recipients, as a plugin provider that owns the caret already does on main. The merge leaves this PR's diff against main as it was: production is +326/−158 before and after.

The test commit adds one browser case to tests/browser/completion-work.spec.mjs, run for a people row and for a supplement row. A scripted click puts the chips in and the send is confirmed, but there is no owner mention evidence. A real click gives the evidence, with exactly the send's p-tag recipients. With the wrap taken out of accept, the case fails for both rows in Chromium and WebKit and nothing else fails: #4133's own journeys pick from the member picker, not from the completion list.

On a separate Linux machine at 275173f99:

  • pnpm check (Biome, types and design checks) passes.
  • The mention and completion browser journeys pass in Chromium and WebKit: 114 of 114. The new case, run five times in each engine, passes 20 of 20.
  • The full unit suite passes: 1,188 files, 25,309 tests. It ran before two comment lines were removed from the browser spec; nothing else changed after it.
  • In the app, built from this head without feat(composer): one chip for several recipients, sent as @label #3837, with the plugin these hooks were built for: @Ops Shared shows one group row with its two members. A real click gives one chip per member, and the sent message has a p tag for each. 5 of 5 cases pass.
  • An independent review of the merge and the test commit found nothing that blocks it. It noted that the new case picks by click only: Enter and Tab pass their key event to the same accept, but no browser case picks a supplement row with a key.

CI passed at 275173f99. The rest of this section describes earlier heads.

Checks at earlier heads

Selection fix at 644624b50: one commit. A row the user moved to with the arrow keys stays selected when a supplement is added or removed while the popup is open. Before, that change remounted the popup's rows, and the selection went back to the first row. The selection now lives above that remount, and it is dropped when the winner's query changes. Its test, "drops a supplement removed while the menu is open, with its hold", moves to the second person, removes the supplement and checks that Enter takes that person. The collision test now also accepts the winner's row. The commit removes "never opens for a supplement alone" from ComposerCompletions.test.tsx, because completion.test.ts already checks that a supplement alone gives no match. One of main's comments moves with the state it describes.

On a separate Linux machine at 644624b50:

  • pnpm check (Biome, types and design checks) passes.
  • bin/node scripts/check-push.mjs (types and related tests): 72 files, 2,385 tests pass. check-push.mjs --design passes. No Rust changed.
  • The three test files this PR changes pass: 67 tests.
  • In the app, built from this head without feat(composer): one chip for several recipients, sent as @label #3837, with the plugin these hooks were built for: @Ops Shared shows one group row with its two members. Picking it gives one chip per member, and the sent message has a p tag for each. 5 of 5 cases pass.
  • An independent review of the commit found no defects.

CI passed at that head. The rest of this section describes earlier heads.

Registration at ba160730f: one commit adds registerCompletionSupplement and makes registerCompletion refuse supplement. Its test, "makes a supplement only through registerCompletionSupplement" (service.test.tsx), registers an owner and a supplement, checks that the refused call throws, and reads back which contribution is a supplement.

On a separate Linux machine at ba160730f:

  • pnpm check (Biome, types and design checks) passes.
  • src/features/conversation/ and src/bundled/mentions/ pass: 28 files, 529 tests.
  • bin/node scripts/check-push.mjs (types and related tests): 72 files, 2,386 tests pass. check-push.mjs --design passes. No Rust changed.
  • The landmines lint finds nothing on this commit's lines.
  • An independent review of the commit found no defects.

The rest of this section describes earlier heads.

Lint cleanup at 702432464: two commits from a pass with the landmines lint rules, with no behavior change. They remove the prose comments this PR added (production +296/−152 became +278/−151), and they replace the two test helpers' return types with satisfies Source, which keeps supplement: true a literal. One comment on an added line stays: main's "Only the name ellipsizes" note, which moved with its row. The test doubles stay, because they copy what main's tests already do in the same file for what jsdom lacks or what a test observes: the replace spy, the ResizeObserver stub and the console.error spy. The lint found no sleeps, polling, retries or raised timeouts on this PR's lines.

On a separate Linux machine at 702432464:

  • bin/node scripts/check-push.mjs (types and related tests): tsc passed. 12 of the 72 related test files failed while two other branches' test runs shared the machine. All 12 then passed when rerun as a set with nothing else running (1,105 tests). This PR changes none of them.
  • check-push.mjs --design: pass.

An independent review of the two commits found no behavior or type change. The rest of this section describes earlier heads.

Size cut at 36a7ec245: one commit makes the change smaller with no behavior change. Production went from +390/−216 to +296/−152, and no test changed.

  • matchCompletion returns the winner and its supplements in provider precedence, so the second sort goes.
  • Per-provider state is keyed by the contribution key.
  • The option row is back at main's indentation.
  • Group checks that only the winner's rows could reach are dropped, because supplements never carry a group.

On a separate Linux machine at that SHA:

  • the types and related-tests lane passes (72 files, 2,385 tests);
  • the design lane passes;
  • the Clippy lane has no Rust inputs;
  • src/features/conversation/ passes (19 files, 183 tests).

An independent review of the commit found no behavior change. The rest of this section describes earlier heads.

Updated from main at 5d5400bd22: a merge of main (46a09dbfd), with no change to this PR's diff. CI passes at this head. The end-user test below ran on that same main with this PR's commits.

Later commit 4ccb32df12 (a test and docs), on a separate Linux machine: Biome and tsc --noEmit are clean, and src/features/conversation/ passes: 19 files and 181 tests. #3837's runs below contain this commit too.

Later commit 4f31f7798 (a test only), on the same machine: ComposerCompletions.test.tsx passes, 40 tests, and so does vitest related on it. Biome and tsc --noEmit are clean. With the ArrowDown pin removed, its "keeps a row the user moved to" case fails. #3837 doesn't contain this commit yet; it adds no app code.

At HEAD 3c3191c967dfa1494cdde6cdd64a3977060eb85b:

  • New test cases: 13 in ComposerCompletions.test.tsx and 1 in completion.test.ts. 13 of the 14 fail with this PR's three source files reverted to the base. The fourteenth, Escape while a supplement has not answered, passes on the base, which has no supplements; it covers a path this PR adds.

  • Mutation checks: with each guard removed in turn, its test fails. The guards are:

    • the holds on spaceId and spacePending, and the hold before a first answer;
    • release on failure;
    • after a failure, clearing the failed section and refusing its later publications;
    • error isolation for a supplement's previews;
    • Escape wiring while a supplement holds;
    • dropping a supplement row's agent mark;
    • rows keyed by provider;
    • the winner's heading after another section;
    • the matcher's same-start filter.
  • A carried result is also cleared for a provider that is no longer beside the query, such as a supplement that stopped matching mid-word. Without this, typing @xy, then @xyz, then Backspace would paint the stale @xy section for one render before its provider publishes again. No test isolates this, because the test harness keeps one observation per mount.

  • The three pre-push lanes ran on a separate 64-core Linux machine at this SHA:

    • check-push.mjs (types and related unit tests): 68 files and 2,323 tests passed, with the existing suites unchanged. Two tests failed while three lanes ran at once: a 5-second timeout in InboxPage.test.tsx, and a list count in NewMessage.test.tsx. The same two failed in a concurrent run of another branch. This PR touches neither file. Rerun alone, both files pass at this SHA and at the base: 234 tests each.
    • check-push.mjs --design passes. The Clippy lane has no Rust inputs to check.
  • tsc --noEmit and biome check are clean.

  • Agent reviews: the first found two defects, both fixed. The winner's rows had no heading when a supplement section came first, and the stripping of a supplement's spaceId and spacePending was dead code, since the host reads that evidence only from the winner. It also named two missing tests, now added: a winner with no rows beside a supplement with rows, and a held spacePending. A later review found that a failed supplement kept its rows, and that its previews could close the popup; both are fixed, with tests. A fresh review of that fix found no defects.

  • In the app: an agent ran the flow in the app's browser build (tests/browser, headless Chromium, on the same machine), with a fixture plugin whose supplement offers crew for @ (order -20, holdAutoSelect while crew starts with the query).

    • At this HEAD: @cr shows a "Groups" heading with crew above the "Mention" heading and the matching people. @ alone shows the same Groups section above all the people. ArrowDown and ArrowUp move across both sections in order.
    • At feat(composer): one chip for several recipients, sent as @label #2878's commit 8824d8c1e, which contains this PR: a plain mention (@Grace Hopper, then Space) still gives her person chip. With a member named Crew, @crew then Space types a space and picks no one. Control: with holdAutoSelect forced to false, Space inserts a chip.
    @cr: the supplement's section above the people @crew, Space: no one picked
    Groups heading with crew above the Mention heading with Crew and Crystal Ng The composer holds the text @crew and no chip

End-user test (AGENTS.md step 3)

The PR author's agent ran the end-user test again on a separate Linux machine, with this PR at ba160730f, #3837 at 01260a91c, relay main and the plugin these hooks were built for, which registers its @ rows through registerCompletionSupplement?.():

  • Buzz built from main with both PRs: with a group Bobsled Team saved, @b shows Bob Member and, under a Groups heading, Bobsled Team in one popup. @ shows the 29 people and the group row. Alice typed @des and the popup showed the group Design Team (Alice, Bob and Carol; no person matches des). Enter made one chip. The sent message, @Design Team, has one p tag each for Bob and Carol; Alice, who sent it, isn't tagged.
  • Buzz 1.0.5, which has no supplements: @ lists the same 29 people as the same Buzz with no plugin. @b lists only Bob, and no group rows show.

The first run of this test used the flag-only form of this PR and found the problem that registerCompletionSupplement fixes: on Buzz 1.0.5, the plugin's @ rows emptied the people picker.

@b on main with both PRs: Bob Member, then the Groups section @b on Buzz 1.0.5 with the same plugin: Bob Member only @b on Buzz 1.0.5 with no plugin
The popup shows Bob Member, then a Groups heading with Bobsled Team, 1 person The popup shows one row, Bob Member The popup shows one row, Bob Member

Try it yourself

Run this branch (just desktop). The test uses a small unsigned plugin, built like the ones in examples/plugins. Make a folder with these two files:

manifest.json

{ "id": "example.supplement", "name": "Supplement example", "apiVersion": 1 }

plugin.js

export const inject = ["react", "conversation"];

export function apply(ctx) {
  const React = ctx.react;
  ctx.conversation.registerCompletionSupplement?.({
    id: "groups",
    title: "Groups",
    order: -20,
    match: ({ text, start }) => {
      const at = text.lastIndexOf("@", start - 1);
      const query = text.slice(at + 1, start);
      return at >= 0 && !/\s/.test(query) ? { start: at, end: start, query } : null;
    },
    component: function Groups({ query, publish }) {
      React.useEffect(() => {
        const hold = "eng".startsWith(query.query.toLowerCase());
        const rows = hold ? [{ id: "eng", label: "eng", edit: { text: "@eng " } }] : [];
        return publish({ items: rows, holdAutoSelect: hold }) || undefined;
      }, [query.query]);
      return null;
    },
  });
}
  1. Open Settings → Plugins → Load from folder, choose the folder, install Supplement example and enable it.
  2. In a channel, type @e. Working: a "Groups" heading with eng sits above a "Mention" heading (the bundled provider's existing title) and the people rows.

An agent ran the rest of the flow in the app (arrow keys across sections, Space with a namesake, a plain mention); see Validation. With no supplement registered, the existing completion tests pass unchanged.

#3837 contains this PR, so its steps also cover this one.

🤖 Generated with Claude Code

LordMelkor and others added 3 commits November 17, 2026 12:36
A provider registered with `supplement: true` mounts beside the provider
that owns the caret when its own match has the same start, with its own
query. It never owns the caret, so it never opens a popup alone.

Each provider's rows form a section, in `order` then contribution key,
with the winner among them. A supplement's section sits under a heading
with its `title`, and so does the winner's when another section comes
first. Rows are keyed by provider and id, so ids may repeat across
providers; acceptance, retry, status and failure stay per provider.

Terminator evidence still comes only from the winner. A supplement's
`holdAutoSelect: true`, or a supplement that has not published yet,
withholds the winner's `spaceId` and `spacePending`, so a typed
terminator stays text. A supplement that throws drops only its section
and releases its hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
… hold

A supplement whose plugin is removed while the menu is open loses its
rows and its hold, and a publish from its old owner is refused. Nothing
covered that before.

The docs now say that a supplement publishing later with a lower order
moves the default row until the user moves the selection, and that a
hold has no time limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
… untouched default

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 This is a comment, not an approval. A human maintainer (design or core team) still needs to review this PR: it changes the plugin completion contract, and contracts.ts is a FOUNDATION file.

This head (4f31f7798) is the same commit I reviewed on #3726 before the branch moved here. My earlier reviews stand: #3726 (review). In short, I have no correctness findings, and both test gaps from my first review are covered. Two policy questions are still open for a maintainer, and both are documented and tested:

  • may a plugin's row be the default Enter/Tab target under @
  • may a plugin that never publishes hold mention chips for as long as the query is open

@LordMelkor
LordMelkor marked this pull request as draft November 18, 2026 16:33
LordMelkor and others added 3 commits November 18, 2026 12:31
matchCompletion returns the winner and its supplements in provider
precedence as `sources`, so byOrder and the second sort go. Per-source
state is keyed by contributionKey. The option row is back at main's
indentation, with headings and descriptions computed before the JSX.
Drop group checks that only winner rows could reach, since supplements
never carry a group. The key handler reads no publication while a
supplement holds. Restore main's comment wording where the change only
reflowed it. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor
LordMelkor marked this pull request as ready for review November 18, 2026 23:11
@LordMelkor
LordMelkor requested a review from a team November 18, 2026 23:16
A provider with `supplement: true` passed to `registerCompletion` on a
host without supplements is an ordinary provider there: with a lower
`order` than the host's mentions it owns the `@` caret and hides the
people rows. `registerCompletionSupplement` is the only way to register
a supplement, and `registerCompletion` refuses one, so a plugin calls
it as `registerCompletionSupplement?.()` and registers nothing on a
host that lacks it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>

@joahg joahg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Follow-up on 4f31f77. Most of the change refactors ComposerCompletions and completion.ts: matchCompletion now returns the winner plus supplements as sources. I read it against the old code and found it equivalent. That covers winner and supplement selection, key handling while a supplement holds, group headings and described-by ids, and per-provider state keys.

The one contract change is registerCompletionSupplement. It's now the only way to register a supplement, and registerCompletion throws when supplement is set. A service test covers it. The ComposerCompletions, completion and service tests pass locally (68), and the touched files typecheck.

No new findings. Two policy questions from before are still open for a maintainer:

  • whether a plugin row should be the default Enter/Tab target under @;
  • whether a plugin that doesn't publish should be able to hold mention chips.

This needs a human maintainer and a design reviewer.

@LordMelkor
LordMelkor requested a review from a team November 19, 2026 09:22
LordMelkor and others added 3 commits November 20, 2026 13:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
…ement

Co-Authored-By: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
A completion row the person clicks or picks with a key marks its recipients
as the owner's explicit mention; the same row picked by a script does not.
Cover a people row and a plugin supplement row in the browser, where only a
real input event is trusted.

Co-Authored-By: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 @joahg thanks for the two reviews. The head is now 275173f99: main up to #4133 merged in, plus one browser test. CI passes.

Your two open questions for a maintainer are now answered at the top of the description: what the PR does, what it costs, and the other way each could go. The description also opens with what a person gets and a screenshot.

This is ready for a maintainer's review.

@jedwards27 jedwards27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 :bot: Jude’s code review agent — integrated review of cf2355f1e34d760e13968318f79dbb0687b6a905..275173f99b83a4c04cfc0032abcbce15e9d88fa9 (exact head 275173f99b83a4c04cfc0032abcbce15e9d88fa9).

Verdict: APPROVE the code at this head; not an assertion that the two product-policy decisions below have been made.

Risk: high — the popup can turn a selected completion into signed p-tag recipients, so provider provenance, stale results and keyboard acceptance matter. The changed paths are local composer/plugin registrations, tests and docs; this diff does not alter the relay's send/accept contract.

Behavior/contracts traced: registerCompletionSupplement reuses scoped contributions while preventing an older host from accidentally treating a supplement as the caret owner (src/features/conversation/service.tsx:418–435, completion.ts:45–83). Each result/row retains its source; publications are revocable and rejected after removal, query change or provider failure; a typed terminator uses only the owner’s exact-match evidence (ComposerCompletions.tsx:410–483,530–645). Manual picks pass through the existing human-event/recipient transaction (ComposerCompletions.tsx:530–551; tests/browser/completion-work.spec.mjs:318–379). Section headings, editor-owned focus and viewport bounds were inspected (ComposerCompletions.tsx:509–523,553–565,715–745; useCompletionPosition.ts:28–52).

Findings: no unresolved author-actionable code defect in the integrated systems, product/UI and contract passes. Author action: none for this code verdict. Optional confidence improvement: exercise supplement Enter and Tab in the real composer in Chromium and WebKit; current browser fixture verifies trusted/synthetic clicks, while component tests cover key dispatch (ComposerCompletions.test.tsx:625–726). This is not a demonstrated regression and is not a request for author rework.

Human decision before merge: a maintainer must explicitly choose whether a plugin section may become the default Enter/Tab @ pick, and whether an unpublished supplement may suppress Space auto-pick indefinitely. Both are intentionally documented (docs/plugin-architecture.md:3442–3465) but not settled by the prior desktop implementation; block/buzz/VISION_MOBILE.md calls for shared autocomplete ordering across clients. The changed FOUNDATION completion contract also needs the repository-required human guidance/signoff (AGENTS.md, FOUNDATION/Reviewing). Approval here does not substitute for those decisions.

Verification owner: reviewer/tooling for an independent real-composer keyboard, narrow/enlarged-text, accessibility and exact installed/native journey; human maintainer for the two policy choices and FOUNDATION governance. Validation: at clean matching head on isolated Linux Blox carl-buzz-app-3836, bin/pnpm check passed; bin/pnpm exec vitest run --reporter=dot passed (1,188 files/25,309 tests; 10 files/38 tests skipped; 449.87 s). On the Mac, git diff --check <base> HEAD passed at matching clean head. GitHub exact-head checks: 69 passing, one skipped, including Chromium/WebKit browser jobs. Manual/native evidence: no independent running-app, screen-reader or installed-artifact observation in this review; author-provided screenshots/journey claims are not reviewer proof. Residual risk: real browser Enter/Tab dispatch for supplement rows and native visual/accessibility behavior remain unwitnessed; the outstanding verification is reviewer/tooling-owned, not a code finding. A new head invalidates this approval.

@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 @jedwards27 thanks for the review.

This PR won't merge on this approval alone. It waits for a maintainer to make the two decisions and to sign off on the FOUNDATION change. Both decisions are at the top of the description, each with its cost and the other way it could go.

No new commit is planned in the meantime, so the head you reviewed stays as it is. The Enter and Tab cases in the real composer, in Chromium and WebKit, go in with the next commit if a maintainer asks for a change.

LordMelkor and others added 2 commits November 20, 2026 23:01
A supplement that has published nothing for the query no longer holds
Space. Only a published `holdAutoSelect: true` keeps Space from picking
the winner's exact match, so a supplement that is still loading
publishes the hold itself. One that never publishes leaves Space, and
Escape, to the winner.

Cover a held and a silent supplement in the browser with an unpaused
Space, and Enter and Tab taking a supplement row ordered first.

Co-Authored-By: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
…nt effect

The supplement remounts on each keystroke, so a hold published after an
async step leaves Space open until it lands. Say so in the contract's TSDoc
and the architecture doc, and name the Escape test for both of its cases.

Co-Authored-By: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 @jedwards27 an update on what your review left open, and a correction. I wrote above that this PR waits for a maintainer and that no further commit was planned. Both have changed.

Who decided. The author holds the Maintain role on this repository, made both product calls, and approved the change as a whole for merge, including the edits to the two FOUNDATION files.

  • A plugin's row as the default Enter or Tab pick: yes, as written. No change.
  • A supplement that never publishes: the other way from the head you reviewed. A supplement that has published nothing now holds nothing, with no timer. One that is still loading publishes holdAutoSelect: true itself.

What changed since 275173f99. Two commits, and the head is now e4cdd8ff1. Together they are one production line, a comment, docs and tests.

  • cd95a6906 makes the change to the second rule: one line in held() in ComposerCompletions.tsx.
  • It also adds the cases you suggested, Enter and Tab on a supplement row in the real composer, in Chromium and WebKit. With them come two Space cases typed with no pause: one against a supplement that holds, one against a supplement that stays silent.
  • e4cdd8ff1 brings the comment in contracts.ts, the docs and one test name in line with the new rule. No code or type changes.
  • A separate review of cd95a6906 found no code defect. Its one finding was the stale sentence in that comment, which e4cdd8ff1 fixes.

What happens next. The PR merges when every check is green at e4cdd8ff1. Your review says a new head invalidates its approval, so the list above is exactly what it hasn't seen. Nothing here needs an answer. If you do look and find something, say so here and it gets fixed straight away, before or after the merge.

@LordMelkor
LordMelkor merged commit 1e64fd5 into main Nov 21, 2026
72 checks passed
@LordMelkor
LordMelkor deleted the clod/completion-supplement branch November 21, 2026 04:35
wpfleger96 added a commit that referenced this pull request Nov 21, 2026
* origin/main:
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  docs(agents): build new features as directory plugins first (#4022)
  Reduce frozen tag scans on relay reads (#4162)
  feat(agents): let a plugin harness show its sessions in the host transcript viewer (#4153)
ljknight added a commit that referenced this pull request Nov 21, 2026
…ent-creation-request

* origin/main: (28 commits)
  feat(conversation): let plugins hold a composer message and publish it later (#2971)
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  docs(agents): build new features as directory plugins first (#4022)
  Reduce frozen tag scans on relay reads (#4162)
  feat(agents): let a plugin harness show its sessions in the host transcript viewer (#4153)
  Expose confirmed owner send evidence (#4133)
  Keep the sidebar steady when a channel disappears (#4000)
  feat(unread): list a channel's unread messages from evidence (#3996)
  fix(panels): keep the board still while a profile panel opens (#3130)
  Keep the sidebar stable during refresh (#3997)
  Let a region channel group render under its Team sidebar row (#4099)
  Sign agent invocation intent in thread replies (#3876)
  feat(search): send people, mention and membership facts to the rerank (#3989)
  ...

Signed-off-by: Laura Knight <lauraknight@squareup.com>

# Conflicts:
#	docs/plugin-authoring-guide.md
joahg added a commit to joahg/buzz-app that referenced this pull request Nov 21, 2026
…ds-setup

* origin/main:
  feat(conversation): let plugins hold a composer message and publish it later (block#2971)
  Never run the full JS suite on pre-push (block#4176)
  Hold channel rows until a window's first page lands (block#4154)
  Verify desktop agent reads off the renderer (block#4137)
  Remove Engineering Discipline from the agent base prompt (block#4175)
  feat(composer): let completion providers add rows beside the caret owner (block#3836)
  feat(agents): let an agent type name its skill folders (block#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (block#4087)
  Let agents request plugin installs from a local folder (block#4158)
  docs(agents): build new features as directory plugins first (block#4022)
  Reduce frozen tag scans on relay reads (block#4162)
  feat(agents): let a plugin harness show its sessions in the host transcript viewer (block#4153)
  Expose confirmed owner send evidence (block#4133)
  Keep the sidebar steady when a channel disappears (block#4000)

Signed-off-by: Joah Gerstenberg <joah@squareup.com>

# Conflicts:
#	docs/plugin-authoring-guide.md
johnmatthewtennant added a commit that referenced this pull request Nov 22, 2026
…ke-deadline

* origin/main: (133 commits)
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (#2953)
  perf(messages): cut per-update timeline work while agents are active (#4211)
  feat(agents): file any conversation in the owner's workspaces (#4173)
  Read membership notices with each channel head (#4179)
  fix(goose): forward Databricks AI Gateway turns (#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (#4108)
  Stabilize the sidebar presence geometry click (#4059)
  docs(channels): list the 3-day Active tile (#4118)
  feat(conversation): let plugins hold a composer message and publish it later (#2971)
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  docs(agents): build new features as directory plugins first (#4022)
  Reduce frozen tag scans on relay reads (#4162)
  feat(agents): let a plugin harness show its sessions in the host transcript viewer (#4153)
  ...

# Conflicts:
#	src/features/agents/service.test.ts
ljknight added a commit that referenced this pull request Nov 22, 2026
…t-chrome-icons

* origin/main: (402 commits)
  docs: cut implementation narration down to short references (#4213)
  chore(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (#4222)
  feat(plugins): let plugins copy text through Buzz's clipboard (#2920)
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (#2953)
  perf(messages): cut per-update timeline work while agents are active (#4211)
  feat(agents): file any conversation in the owner's workspaces (#4173)
  Read membership notices with each channel head (#4179)
  fix(goose): forward Databricks AI Gateway turns (#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (#4108)
  Stabilize the sidebar presence geometry click (#4059)
  docs(channels): list the 3-day Active tile (#4118)
  feat(conversation): let plugins hold a composer message and publish it later (#2971)
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  ...

Signed-off-by: Laura Knight <lauraknight@squareup.com>
Co-authored-by: Fizz <03d4666a4a2c5eacc22719b407aa15c36e5a4380ec913485e22753d35a7d1897@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	src/shared/design-system/DESIGN.md
morgmart added a commit that referenced this pull request Nov 22, 2026
…ge-unread

* origin/main: (22 commits)
  docs: cut implementation narration down to short references (#4213)
  chore(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (#4222)
  feat(plugins): let plugins copy text through Buzz's clipboard (#2920)
  feat(plugins): let a plugin show a notice, and stop tool calls when their turn ends (#2953)
  perf(messages): cut per-update timeline work while agents are active (#4211)
  feat(agents): file any conversation in the owner's workspaces (#4173)
  Read membership notices with each channel head (#4179)
  fix(goose): forward Databricks AI Gateway turns (#4127)
  feat(agents): let a bundled plugin choose the gateway's harnesses (#4108)
  Stabilize the sidebar presence geometry click (#4059)
  docs(channels): list the 3-day Active tile (#4118)
  feat(conversation): let plugins hold a composer message and publish it later (#2971)
  Never run the full JS suite on pre-push (#4176)
  Hold channel rows until a window's first page lands (#4154)
  Verify desktop agent reads off the renderer (#4137)
  Remove Engineering Discipline from the agent base prompt (#4175)
  feat(composer): let completion providers add rows beside the caret owner (#3836)
  feat(agents): let an agent type name its skill folders (#4002)
  perf(agents): index activity triggers so idle rows skip turn replay (#4087)
  Let agents request plugin installs from a local folder (#4158)
  ...

Signed-off-by: morgmart <98432065+morgmart@users.noreply.github.com>

# Conflicts:
#	docs/unread.md
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.

3 participants