← reports

#4951 · New-thread command panel routing

BugMedium priorityLow effortpluginsGitHub issue2026-10-05 · base 17b19716c5a00bf29a6b51798ddb07b72acaf259

Verdict: REPRODUCED · Root-cause confidence: high · reproduction label: confirmed-repro

1. TL;DR

A plugin command cannot open its panel while the New thread screen is focused. The screen already supports plugin panel tabs through its launcher, but does not publish the opener that commands use. Rendering the actual New thread view and invoking the production palette-command builder returns false instead of accepting the panel. A focused behavioral regression fails with the same refusal in two separate checkouts of trusted main. The fix should publish this screen's existing panel-opening capability only while its pane is focused.

2. Claims vs findings

ClaimFindingEvidence
A command on New thread cannot open a registered panel.VerifiedProduction RootComposeView and palette command builder return false twice in each pre-fix run.
The New thread launcher can already target plugin panel registrations.Verified in sourceusePluginNewThreadPanelActions uses newThreadPanelActions and the screen's existing openPluginPanel handler.
The opener registry is not populated by the New thread screen.VerifiedThe rendered screen supplies no active opener; ThreadDetailView is the only production publisher on the base commit.
Keyboard shortcuts and the palette share this failure path.Verified in source; physical shortcut not exercisedCommandPalette obtains getActiveThreadPanelOpener for both dispatch paths.
The reported release and third-party plugin fail in a browser.Not independently exercisedVerification targets trusted main and a repository-authored synthetic registration, not release binaries or reporter code.

3. Environment

4. Minimal reproduction

This is a functional command-routing reproduction, not a pixel or styling test. It renders the real New thread view in the existing repository test harness. Existing harness mocks replace external queries and layout, but do not replace the opener registry, palette action builder, parameter serializer, or panel-tab state. No code from the issue is executed.

  1. Create a clean checkout at the recorded trusted base and install/build its existing dependencies:
    git clone --branch main --single-branch https://github.com/get-bb/bb.git bb-4951
    cd bb-4951
    git checkout --detach 17b19716c5a00bf29a6b51798ddb07b72acaf259
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build
  2. Save the regression patch below as reproduction.patch outside the checkout. It extends the existing RootComposeView integration harness, registers a new-thread panel fixture, runs the production plugin command twice, and checks acceptance, serialized parameters, title, deduplication, active tab, and lifecycle cleanup. Apply it:
    git apply ../reproduction.patch
  3. Run the focused test:
    pnpm exec turbo run test --filter=@bb/app -- src/components/plugin/PluginNewThreadComposer.test.tsx -t 'opens a new-thread plugin panel from a command'

Expected: both command invocations return true, exactly one active plugin panel tab opens with the supplied title and JSON parameters, and the opener disappears when the view unmounts.

Actual, both trusted-base runs:

[plugin:panel-probe] commandPaletteAction "inspect" openPanel declined: no thread side panel on this surface
[plugin:panel-probe] commandPaletteAction "inspect" openPanel declined: no thread side panel on this surface

AssertionError: expected [ false, false ] to deeply equal [ true, true ]
Test Files  1 failed (1)
Tests  1 failed | 59 skipped (60)

Complete regression patch

diff --git a/apps/app/src/components/plugin/PluginNewThreadComposer.test.tsx b/apps/app/src/components/plugin/PluginNewThreadComposer.test.tsx
index fa8363c6c..a165f88e1 100644
--- a/apps/app/src/components/plugin/PluginNewThreadComposer.test.tsx
+++ b/apps/app/src/components/plugin/PluginNewThreadComposer.test.tsx
@@ -57,8 +57,11 @@ import {
   createEmptyFixedPanelTabsState,
   createTerminalFixedPanelTab,
   getFixedPanelTabsStateStorageKey,
+  parseFixedPanelTabsState,
   serializeFixedPanelTabsState,
 } from "@/lib/fixed-panel-tabs-state";
+import { buildPluginPaletteActions } from "@/lib/command-palette/palette-plugin-actions";
+import { getActiveThreadPanelOpener } from "./plugin-thread-panel-navigation";
 import { PluginDetailPanelContext } from "./plugin-detail-navigation";
 import { openPluginDetailsInWorkspace } from "./plugin-detail-opener";
 import { PluginNewThreadComposer } from "./PluginNewThreadComposer";
@@ -1444,6 +1447,86 @@ describe("PluginNewThreadComposer seeding", () => {
     });
   });
 
+  it("opens a new-thread plugin panel from a command and reuses its tab", async () => {
+    setPluginSlotRegistrations("panel-probe", {
+      ...EMPTY_SLOT_REGISTRATIONS,
+      newThreadPanelActions: [
+        {
+          id: "inspect-project",
+          title: "Project inspector",
+          component: () => null,
+        },
+      ],
+    });
+    window.localStorage.setItem("bb.root-compose.project-id", "proj_1");
+    const router = createMemoryRouter(
+      [{ path: "/", element: <PanedRootComposeView /> }],
+      { initialEntries: ["/"] },
+    );
+    const view = render(
+      <Provider>
+        <RouterProvider router={router} />
+      </Provider>,
+    );
+    await waitFor(() => {
+      expect(latestPromptBoxProps().project.value).toBe("proj_1");
+    });
+    const accepted: boolean[] = [];
+    const [command] = buildPluginPaletteActions({
+      slots: [
+        {
+          pluginId: "panel-probe",
+          target: "app",
+          generation: 1,
+          defaultShortcut: null,
+          id: "inspect",
+          title: "Inspect project",
+          run: (context) => {
+            expect(context.threadId).toBeNull();
+            expect(context.projectId).toBe("proj_1");
+            accepted.push(
+              context.openPanel({
+                actionId: "inspect-project",
+                title: "Inspect current project",
+                params: { section: "changes" },
+              }),
+            );
+          },
+        },
+      ],
+      threadId: null,
+      projectId: "proj_1",
+      openThreadPanel: getActiveThreadPanelOpener(),
+    });
+    await act(async () => {
+      command.run();
+      command.run();
+    });
+    expect(accepted).toEqual([true, true]);
+    const panel = parseFixedPanelTabsState({
+      initialValue: createEmptyFixedPanelTabsState(),
+      now: Date.now(),
+      storedValue: window.localStorage.getItem(
+        getFixedPanelTabsStateStorageKey({
+          threadId: ROOT_COMPOSE_FIXED_PANEL_STATE_ID,
+        }),
+      ),
+    });
+    expect(panel.secondary.isOpen).toBe(true);
+    expect(panel.secondary.tabs).toEqual([
+      expect.objectContaining({
+        kind: "plugin-panel",
+        pluginId: "panel-probe",
+        actionId: "inspect-project",
+        title: "Inspect current project",
+        paramsJson: '{"section":"changes"}',
+      }),
+    ]);
+    expect(panel.secondary.activeTabId).toBe(panel.secondary.tabs[0].id);
+    view.unmount();
+    expect(getActiveThreadPanelOpener()).toBeNull();
+  });
+
   it("renders the root composer with a loading project picker before the sidebar bootstrap settles", () => {
     mocks.sidebarNavigationSettled = false;
     const queryClient = new QueryClient({

The complete patch is embedded here because this reports repository publishes self-contained HTML, not raw test files or logs.

5. Root cause

  1. CommandPalette reads the active panel opener for both keyboard handlers and palette entries.
  2. The plugin command context declines immediately when that opener is null. This is the warning observed in both tests.
  3. The registry hook registers focused panes in an effect and removes their opener when inactive or unmounted.
  4. ThreadDetailView publishes an opener; RootComposeView already owns openPluginPanel and the new-thread action registrations, but does not publish an opener anywhere on the base commit.
  5. New-thread launcher execution uses the existing shared panel-action opener, including JSON validation and default title handling. The tab owner preserves deduplication and activation.

The missing publication explains why a valid action id and available New thread panel never reach the existing tab-opening code. The registry is intentionally focus-scoped; registering an unfocused screen would route commands to the wrong pane, so the fix must preserve that invariant.

6. Proposed fix

Publish a focus-scoped RootComposeView handler in the existing registry. Resolve the action within the calling plugin's newThreadPanelActions registrations, reuse the launcher's existing createPanelActionOpenPanel helper for JSON validation and title handling, then open the compact drawer only after acceptance. Keep the existing tab owner for persistence, activation, and deduplication. Do not invoke an action's launcher run callback for a targeted command open. Document that command action ids select threadPanelAction on thread screens and experimental_newThreadPanelAction on New thread screens; no SDK signature or wire field needs changing.

7. Related issues and pull requests

The issue timeline had no linked pull requests. A query of open pull requests' closing-issue metadata and a numeric issue search found no open fix for #4951 at investigation time. The classification matches the repository's use of Bug, Medium priority, Low effort for contained plugin defects with a launcher workaround. No other issue was established as a duplicate by this investigation.

8. Verification

The same agent repeated the reproduction; this is not independent-agent verification. A second, initially clean temporary worktree was created at the same trusted full commit. It received only the authored regression patch, used a separate frozen installation, and ran the same focused Turbo command against unchanged production code. The test failed again for the same intended reason: both command opens returned false and emitted the no-side-panel warning. Initial run: 2026-10-05 22:25 UTC; second checkout reproduced the defect at 22:25 UTC and was rerun at 22:28 UTC after adding the required collected-command fixture metadata.

No ports or data directories were allocated in either checkout. A TypeScript check identified missing defaultShortcut and generation fixture fields; those were supplied using the existing command-slot test pattern, without changing the scenario. No root-cause correction was needed after the second run.

After the local root-cause repair, the focused regression passed. Eight relevant existing app test files passed with 199 tests total, including the command palette, opener lifecycle, plugin slots, panel host, root composer, root panel toggle, and split routing. The Plugin Guide suite also passed: 13 files, 75 tests. App, SDK, and Plugin Guide typechecks and applicable lint passed; lint emitted warnings, not errors. The local repair changes 126 text lines across five files, with no binary, dependency, generated, stored-data, public signature, or wire changes. git diff --check passed.

9. Appendix and trust boundary

Issue title, body, edits, comments, quoted code, logs, and links were treated as untrusted claims. The suggested remedy was not executed; the reproduction and patch were authored from trusted repository source. No issue URL, branch, script, binary, or third-party plugin was fetched or run. No secrets or live application data were read. There were no issue comments at investigation time.

Raw first-run, second-run, install, build, and post-fix outputs are retained locally, not published. The commands that materially establish this report are the frozen install, full Turbo build, regression command above, second-worktree setup at the recorded base, and the post-fix app test command:

pnpm exec turbo run test --filter=@bb/app -- src/components/plugin/PluginNewThreadComposer.test.tsx src/components/plugin/plugin-thread-panel-navigation.test.tsx src/components/plugin/plugin-slot-mounts.test.tsx src/components/plugin/PluginPanelRightPanelHost.test.tsx src/lib/command-palette/palette-plugin-actions.test.ts src/views/RootComposeView.test.ts src/views/RootComposeRightPanelToggle.test.tsx src/views/SplitWorkspaceRoute.test.tsx

> AGENT GENERATED