Skip to content

Add "Reply in side chat" to code-review (git-diff) selections #6166

Description

@kolsha

Summary

From the code-review (git-diff) panel you can only send a selection to the main composer; you cannot pull it into a side chat to ask a focused follow-up or fix without cluttering the main thread. This proposes a "Reply in side chat" action on git-diff (and file-preview) selections that auto-creates a side chat seeded with the selected code — reusing the side-chat plugin flow the timeline already uses for messages, so no new plugin-SDK surface is needed. Opening this first per CONTRIBUTING, since it is a UI/feature change.

Context

The side-chat plugin already lets you fork a hidden side thread from a message ("Reply in side chat"): the selected message text becomes the fork's quoted context, and the side chat opens in a panel beside the thread (plugins/side-chat). Core already drives this plugin directly — ThreadDetailView opens the side-chat panel for the "open-plugin-side-chat" title action (apps/app/src/views/thread-detail/ThreadDetailView.tsx ~L2018-2025) and can call plugin RPCs via callPluginRpc (apps/app/src/lib/plugin-sdk-hooks.ts:137).

The code-review panel has no equivalent. Its selection menu offers only "Add to chat", which routes through onSelectionAddToChat to the main composer (ThreadDetailView.tsx ~L1122-1131, appendQuoteAndAttachmentsToDraft). So a reviewer who wants to interrogate or fix one hunk in isolation has to dump it into the main thread.

Proposal

Add a second selection action, "Reply in side chat", available alongside "Add to chat" in the shared selection menu (apps/app/src/components/thread/timeline/TimelineSelectionMenu.tsx), surfaced in the git-diff panel and file previews via SecondaryPanelSelectionActions.

Behavior (chosen scope: always available + auto-create): clicking it always starts a fresh side chat seeded with the selected text and opens its panel — no requirement that a side chat already be open.

Wiring (mirrors the existing onSelectionAddToChat path, no new plugin-SDK slot):

  • New optional prop onSelectionReplyInSideChat?(text) threaded down the same chain as onSelectionAddToChat (ThreadDetailView → ThreadSecondaryPanel → GitDiffTabContent → DiffFilesPanel → DiffFileCard / selection menu).
  • Terminal handler in ThreadDetailView: call the side-chat plugin RPC createSideChat({ sourceThreadId, anchorText: selectedText }) (omitting sourceSeqEnd forks from current thread state — appropriate for a code selection with no message anchor; plugins/side-chat/server.ts:69-135), then open the side-chat panel with the returned thread id using the existing handleOpenTimelinePluginPanel path.
  • Likely enrich anchorText with the file path and a fenced code block so the quote reads as code in the side chat (TBD during implementation).

Design questions for maintainers

  1. Is piggybacking on the side-chat plugin id + its createSideChat RPC from core acceptable here, or should this go through a more generic "selection action" plugin surface? Core already couples to the side-chat plugin for panel opening, so this extends an existing pattern rather than introducing a new one.
  2. Should the selected diff text be wrapped as a fenced code block with its file path, or passed verbatim like message selections?

Out of scope / ruled out

  • A new plugin-SDK selection-action slot for the secondary panel: heavier, and unnecessary given core already integrates with the side-chat plugin.
  • "Only when a side chat is open" and "follow the focused chat" variants were considered; the chosen behavior is always-available with auto-create.

Prototype branch to follow once the approach is signed off. Environment: bb 0.46.1 / current main.

Activity

  1. added
    ui
    side-chat
    on Oct 23, 2026
  2. bb-slop-cop commented on Oct 23, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied classification:

    • Type: Feature — adds a code-selection workflow rather than correcting unexpected behavior.
    • Priority: Low — a convenience improvement with the existing main-composer workflow available.
    • Effort: Medium — spans selection controls, panel wiring, and side-chat integration.
    • Labels: ui, side-chat.

    All values were missing; no existing classifications were replaced. Final Type verified as Feature. Bug reproduction and an automated fix PR are skipped because this is a feature request requiring product/design review.

  3. kolsha commented on Oct 23, 2026

    @kolsha
    Author

    Prototype pushed: https://github.com/kolsha/bb/tree/feat/git-diff-reply-in-side-chat

    Implements the "always + auto-create" behavior described above:

    • New optional onSelectionReplyInSideChat prop threaded alongside the existing onSelectionAddToChat down the git-diff and file-preview chains; a "Reply in side chat" action added to the shared TimelineSelectionMenu (icon SideChat), gated on the handler being present.
    • Terminal handler in ThreadDetailView calls the side-chat plugin's createSideChat RPC (seeded with the selection, forking from current thread state) and opens the side-chat panel via the existing plugin-panel path.
    • Main-timeline selection menu intentionally left untouched (already covered by the plugin's message action).

    18 files, +214/-2. typecheck + oxlint clean; 78 tests pass in the affected suites, including two new TimelineSelectionMenu tests covering the action.

    Not yet done: live run-through in the app, and the per-line diff gutter "add to chat" button still has no side-chat sibling (the text-selection menu does). Both design questions above are still open — happy to adjust (e.g. drop the core→plugin-id coupling for a generic selection-action surface) before this becomes a PR.

  4. kolsha commented on Oct 30, 2026

    @kolsha
    Author

    Update: reworked prototype (force-pushed) — now two explicit targets

    Refined the "always + auto-create" behavior into two explicit selection-menu actions, since always creating a new side chat clutters the panel when you just want to keep iterating in the one you have open:

    • "Reply in new side chat" — forks a fresh side chat seeded with the selection (the side-chat plugin's createSideChat RPC) and opens it.
    • "Reply in open side chat" — appends the selection to the composer draft of the last-active open side chat; shown only when at least one side chat is open.

    Key mechanism for the "open" target (no plugin or plugin-SDK change needed): core resolves the last-active open side-chat panel from the secondary-panel tab state, then appends the quote to that thread's composer draft via the shared prompt-draft store (appendToThreadComposerDraft). The mounted side chat subscribes to that store and picks up the appended text live. "Last-active" is tracked because at selection time the active tab is the diff, not a side chat; target resolution (last-active → currently-active → most-recent) is a pure module with unit tests guarding the last-vs-first regression.

    Clean prototype (force-pushed, old "always new" history dropped): https://github.com/kolsha/bb/tree/feat/git-diff-reply-in-side-chat — 21 files, +659/-3. typecheck + oxlint clean; 23 tests pass (TimelineSelectionMenu actions + openSideChatTarget resolution). Reviewed via an adversarial review loop (fully approved). Verified working on a local build against a copy of real data.

    Still main-timeline selection menu is untouched (it already offers the plugin's own message action). Design question from the original post stands: OK to drive the side-chat plugin id + its RPC from core, or prefer a generic selection-action surface?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    side-chatui

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions