Skip to content

Show the thread context banner when the card does not fit - #6875

Merged
ymichael merged 1 commit into
mainfrom
bb/show-context-banner-on-narrow-cards-thr_82etaevp8i
Nov 2, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/show-context-banner-on-narrow-cards-thr_82etaevp8i

Conversation

@ymichael

@ymichael ymichael commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

With the threadContextCard experiment on, useThreadContextKind() returned card for every thread page, whatever its width. In a pane narrower than 1072px (760px transcript + 312px card) the card isn't drawn, but plugins still saw card and hid their banner segments: the parent thread, git changes and pull request. Narrow windows and split panes only showed that context in the header popover.

What changed

  • apps/app/src/components/plugin/PluginThreadContextCard.tsx
    • useThreadContextKind() now returns card only while the measured layout is gutter or shift, so the card fits beside the transcript.
    • Narrower panes return banner, so the context row above the composer shows those segments.
    • The narrow layout is renamed from overlay to banner to match.
    • The header button still opens the card as a popover in narrow panes, because the card can show more than the banner.
    • Resizing switches between the two live.
  • Phones still always use the banner; that check is unchanged.
  • No changes to the SDK signature, the wire format, or the server. experimental_useThreadContextKind keeps its values; it just returns banner in more cases. The plugin-authoring reference, docs/api_to_audit.md and docs/configuration.md now describe the width rule.

How you verified

  • PluginThreadContextCard.test.tsx:
    • The layout table now expects banner below 1072px.
    • New useThreadContextKind cases measure the pane: 1600px → card, 900px → banner. Before the fix the 900px case returned card.
  • ThreadPromptContextBanner.segments.test.tsx renders a measured wide card so its card-mode assertions still hold.
  • pnpm exec turbo run typecheck --filter=@bb/app passes, and both test files pass (24 tests).
  • Manual check on a pnpm start:worktree server with a child thread that has uncommitted changes:
    • At 900px the banner shows "Uncommitted · 2 files, +3 −1" with the parent icon, and the header "Thread context" button opens the card popover.
    • At 1600px the card shows, the button reads "Unpin thread context", and there's no banner.
    • Live resizes switch between the two.

AGENT GENERATED

🤖 Generated with Claude Code

A pane with the thread context card turned on reported its context kind
as "card" even when it was too narrow to draw the card, so plugins hid
their banner segments and that context only appeared in the header
popover. The kind is now "card" only while the measured layout fits the
card beside the transcript; narrower panes show the banner and keep the
header popover.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 456dd4f into main Nov 2, 2026
51 checks passed
@ymichael
ymichael deleted the bb/show-context-banner-on-narrow-cards-thr_82etaevp8i branch November 2, 2026 23:49
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