Skip to content

Composer banner slot, with the PR segment and Info row in the GitHub PR Status plugin - #6023

Merged
ymichael merged 6 commits into
mainfrom
bb/git-plugin-pr2-thread-slots-thr_i4jcnrjiv8
Oct 23, 2026
Merged

ymichael merged 6 commits into
mainfrom
bb/git-plugin-pr2-thread-slots-thr_i4jcnrjiv8

Conversation

@ymichael

@ymichael ymichael commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Git and GitHub pull request status were still core UI. The composer's context banner hard-wired its parent-thread, changed-files and pull request rows. The Info tab drew the Pull request row from core, using PR data owned by the bundled GitHub PR Status plugin (#6125). There was no slot through which core and plugins could add context beside a thread's composer.

What changed

  • app.slots.experimental_threadContextSegment (SDK 0.6.75): segments share the context row above an existing thread's composer.

    • A registration takes separate summary, action? and details? components, like composer customizations take separate lists. The host mounts each in its own crash boundary: summary in the row, action at the row's end, details below the row.
    • group then order place segments, as for Info rows and thread actions. experimental_THREAD_CONTEXT_SEGMENT_GROUPS names only core's groups, thread (1_thread) and git (3_git); the PR plugin uses its own 2_pullRequest.
    • Props give threadId, projectId, environment, the visible segments as { key, pluginId } (key is <pluginId>/<id> with core as bb--core, the shape thread action keys use), and a shared one-open-at-a-time disclosure.
    • useVisible runs in plugin scope per thread.
    • The banner is drawn above ComposerBox, so it shows under every composer plugin.
  • Core uses the same path. The parent thread (including read-only history) and changed files (with the merge-base action) register through definePluginApp and the collector, and render through the same host as plugins. Core segments render without a plugin crash boundary, as core Info rows do, so their DOM is unchanged.

  • Active child threads are their own core row (ThreadChildThreadsBanner) above the context row, like the todo and workflow cards, with their own open state. They are not a segment, so the slot has no card placement that would overlap composer banners.

  • GitHub PR Status plugin gets an app entry (plugins/github-pr-status/app.tsx, ui/):

    • the pull request segment: status pill, label rules, Mark ready and the merge split button with Convert to draft, the remembered merge method under the same localStorage key, and the same toast copy;
    • the Info tab's Pull request row, through Add Info tab row and section slots that core uses #6117's experimental_threadInfoRow;
    • the display helpers, status pill, next-step label, favicon and the keyed read hook, moved from core with their tests.

    Core has no pull request UI or PR imports left. The one exception is the retired experimental_useSidebarThreadPullRequest runtime member for old marketplace plugins.

  • environment on slot props. It is { id } | null on the new slot and on ExperimentalThreadInfoProps.

    • On both, it is null when the thread has no environment, its host is not active, or the environment is not a usable checkout.
    • On the segment slot only, it is also null when "Show Git changes and Commit button" is off. That keeps main's behaviour, where the PR hides with changed files and the Info row does not.
  • No extra PR reads after the move.

    • The plugin hook refetches only when an environment starts showing, not for each extra view, so opening Info adds no read.
    • WebSocketManager sends its final unsubscribe a microtask later and cancels it when the same target resubscribes in that task. Without this, a thread switch on the same environment dropped the plugin read subscription and restarted the server's watch, which can run gh.
  • BannerActionSlot and the banner action buttons moved to @bb/shared-ui/prompt-banner-actions, so the plugin draws the same controls.

  • One toast path for core and plugins. The toast plugins import from sonner is now a facade over core's appToast (apps/app/src/lib/notifications/plugin-toast.ts), replacing the recording wrapper.

    • toast(), message, info, success, warning, error, loading, dismiss and promise render and record exactly like core's toasts.
    • custom, getHistory and getToasts pass through.
    • A toast whose action or cancel is a plain React node (sonner allows it; no bundled plugin uses it) falls back to sonner.
    • Every plugin's toasts change appearance to match core's, which is intended.
  • The retired experimental_useSidebarThreadPullRequest member keeps main's refresh. It uses main's hook, kept in core as useRetiredSidebarEnvironmentPullRequest with main's tests: a cached row refetches on mount, and a stale row on page show.

    • Core's copy and the plugin's copy of that hook announce every refetch they start with a window event (PULL_REQUESTS_REFETCH_EVENT in the plugin contract) and mark those rows loaded.
    • A stale-row refetch rechecks staleness right before it runs, so a row that already has a fetch in flight, or was refreshed within its staleness window, is not read twice. SDK refetch behaviour is unchanged.
  • Docs:

    • a docs/api_to_audit.md entry; the Info entry and the live-reads and retired-member text updated;
    • the Banners Guide card's symbols, bullets and fixture, with anatomy anchors;
    • frontend-registration.md and frontend-api-index.md;
    • the PR stories moved to the plugin and added to Ladle.

No database, daemon wire or CLI changes.

Rebased onto #6143. Its "hide cached PR status when the plugin is disabled" check in core's PR hook moved with that hook's last core caller, the retired sidebar shim (retired-sidebar-pull-request.ts), with #6143's test; the plugin's own hook only renders while the plugin is enabled. The keyed read stays one PR per environment, so the segment and Info row need no change.

Deviations from main

  • While core's commit or push runs, the PR buttons are no longer disabled; the plugin cannot see core's git actions. The replacement Michael asked for is to pass the displayed head to gh pr merge --match-head-commit. That needs headRefOid on the PR, which Share and persist GitHub PR refreshes #6143 adds, so it lands on top of Share and persist GitHub PR refreshes #6143.
  • A crash in the PR segment removes only that segment, or its part.
  • The active child threads card keeps its own open state, as Michael asked. On main it shared one open section with the context row. Now it can be open while changed files or the parent details are open, and it opens by itself when a child newly needs input even while another section is open.

Known follow-ups:

  • The segment slot's environment folds in the "Show Git changes and Commit button" setting. That setting should become the git plugin's own when changed files move out of core, and the git segment group moves with it.
  • experimental_THREAD_INFO_ROW_GROUPS.pullRequest (from Add Info tab row and section slots that core uses #6117) still names a plugin's group in core. Removing it is a public SDK removal, so it is left for a separate change.

How you verified

  • Parity checklist: every banner row and segment, the Info PR row, refresh sources, phone and desktop layout, and each composer. Item IDs: A composers, B inline row, C child card, D read-only, E disclosure, F data, G layout, H Info row.
Checklist results
Checklist Result
A1, A2, A3, A8 Same. A4–A7 unchanged code paths (banner only in the follow-up stack); not driven separately.
B1–B5, B11, B13–B15 Same text and pixels at 1400 and 390 px for: PR + changed files, PR alone, parent + PR + changed files, parent + PR.
B6–B8, B10 Same: menu items, Convert to draft, Mark ready, Squash merge on disposable PRs; toasts identical.
B7 persistence Same key bb.pullRequest.mergeMethod; Squash merge remembered.
B9 Deviation: core commit/push no longer disables the PR buttons.
C1–C6 Same content, auto-open on a new waiting question and 8 px spacing; the card is now its own row with its own open state (deviation above).
D1–D3 Same pixels for archived child with parent.
E1–E4 Same: parent disclosure body, focus to Collapse, focus back to toggle.
F1–F6 Same PR reads (4 per scripted session); fewer WS frames on the branch.
G1–G4 Same compact rules (390 px and narrowed by the right panel).
H1–H4 Same markup and row order; Show Git changes off keeps the row on both; plugin disabled hides it on both.

Each item was driven in two source dev instances side by side, one on this branch and one on origin/main 2884950, with identical fixtures and disposable PRs in ymichael/test-project.

  • Text was identical at 1400 and 390 px for PR + changed files, PR alone, parent + PR + changed files, and parent + PR.

  • Screenshots were pixel-identical apart from the caret and the scheduled-time text.

  • The same held for archived history, Show Git changes off, the plugin disabled, the child-thread card with a waiting question, the pending-question stack, and the parent disclosure with its focus handoff.

  • Toasts: the PR plugin's Mark ready toasts match main's pixel for pixel; the loading toast differs only in the spinner frame. The Drafts plugin's "Draft saved" and the probe's success, error, info and promise toasts render as core toasts, with the close button, the outlined icon and an entry in the notification center.

  • Actions on disposable PRs: Convert to draft, Mark ready and Squash merge went through with the same toasts and the segment refreshed. The merge method was remembered. A CLI bb pull-request draft updated the segment live in the production build (pnpm start:worktree).

  • Requests, from browser CDP counts of bb--github-pr-status HTTP reads and WebSocket frames. The scripted session: load a thread with a PR and wait 40 s, open Info, switch to a thread on the same environment and back, switch to another environment and back, then fire a page show after 35 s.

    PR reads WS frames
    main (dev) 4 12
    branch (dev) 4 8
    branch (production build) 4 8

    Before the WebSocket fix the branch sent 16 frames, because of resubscribes on same-environment switches.

    With a probe plugin that renders experimental_useSidebarThreadPullRequest in the thread header (an old marketplace sidebar's call), the same session gave:

    load 4 thread switches page show
    main 1 4 1
    branch 1 4 1

    Before the shared announcement, the branch's page show read twice.

  • Tests:

    • new host contract tests (ThreadPromptContextBanner.segments.test.tsx): group and order placement, a plugin's own group, segments keys, visibility, one-open disclosure, per-component and useVisible crash isolation, read-only, and the row held while git loads;
    • child-threads row tests: auto-open for a newly waiting child while changed files are open, and the question flow through ThreadChildThreadsBanner;
    • plugin tests for label rules, the attention matrix, actions and visibility;
    • query tests for refetch on first show and same-commit remounts, which fail without the deferral;
    • a WebSocketManager test for same-task resubscribe;
    • a plugin toast test through the real toaster (error and promise), which fails on the old shim;
    • a test with the plugin's hook and the retired member's hook on one environment: a stale page show makes one read, and two without the announcement.
  • pnpm exec turbo run test typecheck lint --filter='...[origin/main]' --continue: 239/244 passed on the first run.

    • Fixed: the Automations Info fixture (environment), the server's slot-prop docs table, and the 500-line cap on frontend-registration.md.
    • Passed when rerun alone: CommandPalette, PluginSettings, builtin-plugins hot-reload and the MCP CLI timeout (the first run had heavy parallel load).
    • Affected packages rerun green: bb-plugin-plugin-api-docs, bb-plugin-automations, @bb/server.
  • bb plugin build passes for plugins/plugin-api-docs and plugins/github-pr-status. The Plugin Guide's Banners card and fixture were checked in the app at desktop and phone layouts.

  • After the groups and component split: pnpm exec turbo run test typecheck lint --filter='...[origin/main]' --continue gave 242/244. A test-harness mock of the banner and the old auto-open test were updated and @bb/app reran green; bb-plugin-bb--storage-retention (untouched) passed when rerun alone.

  • In the production build (pnpm start:worktree) on a checkout of this branch: parent, PR and changed files in that order with Merge at the end; the child-threads row above the context row, open together with changed files; only the child row beside a waiting question.

  • CI: see the checks on this PR.

AGENT GENERATED

🤖 Generated with Claude Code

@ymichael
ymichael force-pushed the bb/git-plugin-pr-1-plugin-fixed-tabs-in-the-thread-thr_i4jcnrjiv8 branch from b833f61 to c74fea1 Compare October 22, 2026 23:53
@ymichael
ymichael force-pushed the bb/git-plugin-pr2-thread-slots-thr_i4jcnrjiv8 branch from 9009c2a to 572e9b6 Compare October 23, 2026 01:29
@ymichael ymichael changed the title Let plugins add composer context rows and narrow-header menu actions, with core's own rows on the same path Composer banner slot, with the PR segment and Info row in the GitHub PR Status plugin Oct 23, 2026
@ymichael
ymichael marked this pull request as ready for review October 23, 2026 02:04
Base automatically changed from bb/git-plugin-pr-1-plugin-fixed-tabs-in-the-thread-thr_i4jcnrjiv8 to main October 23, 2026 02:44
@ymichael
ymichael force-pushed the bb/git-plugin-pr2-thread-slots-thr_i4jcnrjiv8 branch from 10afe65 to cbc7f17 Compare October 23, 2026 03:16
@ymichael
ymichael force-pushed the bb/git-plugin-pr2-thread-slots-thr_i4jcnrjiv8 branch from cbc7f17 to 6e038d5 Compare October 23, 2026 18:44
ymichael and others added 6 commits October 23, 2026 11:54
Add app.slots.experimental_threadContextSegment. Core's parent thread,
changed files and active child threads register through it, and the
GitHub PR Status plugin now draws the pull request segment, its actions
and the Info tab's Pull request row from its own app entry, so core has
no pull request UI left.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The toast plugins import from sonner is now a facade over core's
appToast, so plugin toasts render and record exactly like core's. The
retired experimental_useSidebarThreadPullRequest member keeps main's
refetch of cached rows on mount and stale rows on page show.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Core's retired sidebar member and the plugin each keep a copy of the
refresh hook. Each copy announces the refetches it starts, and a stale
page-show refetch rechecks staleness first, so the two copies no longer
read the same row twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Segments now take a required group and sort like Info rows and thread
actions. experimental_THREAD_CONTEXT_SEGMENT_GROUPS names only the groups
core renders (thread, git); GitHub PR Status sorts between them with its
own 2_pullRequest group. Core's segments appear as bb--core, the owner id
thread actions already use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A segment registration now takes separate summary, action and details
components, as composer customizations take separate lists, and segments
are { key, pluginId } with the key shape thread actions use. The
before-card placement is gone: active child threads are a core row of
their own above the context row, with their own open state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#6143 hid cached PR status in core's PR hook when the GitHub PR Status
plugin is disabled. That hook now lives in the plugin, which only renders
while enabled, so the check moves to the retired sidebar shim, core's one
remaining reader, with #6143's test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/git-plugin-pr2-thread-slots-thr_i4jcnrjiv8 branch from 6e038d5 to 3a3b872 Compare October 23, 2026 19:00
@ymichael
ymichael merged commit efe9877 into main Oct 23, 2026
49 checks passed
@ymichael
ymichael deleted the bb/git-plugin-pr2-thread-slots-thr_i4jcnrjiv8 branch October 23, 2026 19:08
alexandre-vl added a commit to alexandre-vl/bb that referenced this pull request Oct 23, 2026
…t bar tidy onto thread context segments

get-bb#6023 split ThreadPromptContextBanner into thread context
segments and moved the pull request segment into the GitHub PR Status
plugin. Both conflicts take main's structure; the merge base chip and
the fitted changed-files toggle move into core's changed-files segment
(ChangedFilesMergeBaseAction and ChangedFilesSummary), and the segment
contract tests find the merge base by its accessible name now that its
visible label is gone.
alexandre-vl added a commit to alexandre-vl/bb that referenced this pull request Oct 23, 2026
Upstream get-bb#6023 moved active child threads out of the context banner into
ThreadChildThreadsBanner, a core row above the thread context segments,
and the pull request segment and its tests into the GitHub PR Status
plugin. ThreadChildThreadsBanner still renders ActiveChildThreadsCard, so
the rows and the count chip carry over as they are: the import takes
main's version without AnimatedBody, and the banner tests keep main's
Banner harness with this branch's expectations.
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.

1 participant