Skip to content

Plugin commands can't open panels on the New thread screen #4951

Closed

Description

@antoni-libriseed

Summary

A plugin registers the same panel through threadPanelAction and experimental_newThreadPanelAction, plus a command (app.commands.register) with a default shortcut that calls openPanel. In an open thread, the shortcut opens the panel. On the New thread screen it does nothing, even though that screen's side panel offers the same plugin tab in its launcher. Expected: the command opens the plugin's New thread panel tab, the same tab you get from the launcher.

Versions and environment

  • bb 0.45.0 (bb-app npm package, server and host on Linux 6.8 x86_64)
  • @get-bb/plugin-sdk 0.6.15
  • Local plugin installed with bb plugin install <path>; no agent or provider involved
  • Also present on main at 17b19716c5a00bf29a6b51798ddb07b72acaf259 (checked by reading the code, not run; see Evidence)

Steps to reproduce

  1. Scaffold a plugin (bb plugin new repro) and replace app.tsx with:

    import { definePluginApp } from "@get-bb/plugin-sdk/app";
    
    const Panel = () => <div>repro panel</div>;
    
    export default definePluginApp((app) => {
      app.slots.threadPanelAction({ id: "repro", title: "Repro", component: Panel });
      app.slots.experimental_newThreadPanelAction({ id: "repro", title: "Repro", component: Panel });
      app.commands.register({
        id: "open-repro",
        title: "Repro: open panel",
        defaultShortcut: { key: "g", mod: true, shift: true },
        run: ({ openPanel }) => {
          console.log("openPanel returned", openPanel({ actionId: "repro" }));
        },
      });
    });
  2. bb plugin build && bb plugin install .

  3. Open any existing thread and press Mod+Shift+G. The "Repro" tab opens in the side panel.

  4. Click New thread, pick a project, and press Mod+Shift+G (or run "Repro: open panel" from the command palette).

  5. On the same screen, open the side panel launcher and pick "Repro". The tab opens, so the screen does have a side panel and the plugin's action is registered.

Unverified repro: I haven't run the minimal plugin above. What I observed live was step 3 vs step 4 with the real plugin (Git History, a fork of yusuf8834/bb-git-history), which guards its command with isAvailable: ({ threadId }) => threadId !== null. That guard is there because of the code path below. Steps 4–5 for the minimal plugin are what that code path predicts.

Expected vs actual

Expected (step 4): the plugin's experimental_newThreadPanelAction tab "Repro" opens
                   in the New thread side panel, as it does from the launcher in step 5.
Actual (step 4):   nothing opens. openPanel returns false. Per the code path below,
                   the console shows:
[plugin:repro] commandPaletteAction "open-repro" openPanel declined: no thread side panel on this surface

The console line is quoted from the code that runs when openPanel declines, not captured from a live run.

Evidence

Code on main at 17b19716c5a00bf29a6b51798ddb07b72acaf259:

Possible fix (a suggestion, not tested): RootComposeView calls usePublishThreadPanelOpener with a handler that resolves actionId against the plugin's experimental_newThreadPanelAction registrations and opens the tab through its existing openPluginPanel, the same way runPluginNewThreadPanelAction does. Plugins that register both slots under the same id would then work unchanged on both screens. The openPanel doc comment would need updating.

What you ruled out

  • Not a duplicate: searched open and closed issues for openPanel new thread, newThreadPanelAction, experimental_newThreadPanelAction, openPanel declined, PluginCommandContext, command openPanel, thread-panel-opener, and New thread / root compose plugin panel and shortcut queries. Nothing related (Allow disabling managed worktree environments #2285 only mentions the slot in passing).
  • Not something the plugin's isAvailable guard could fix: with threadId === null the palette builds the context with openThreadPanel: getActiveThreadPanelOpener(), and the only screen that publishes an opener is ThreadDetailView (from the code; dropping the guard was not tried live).
  • Same code on main at 17b1971 as in 0.45.0.

Suggested priority and effort

Low to medium. It affects every plugin that registers both panel slots, such as repo explorers and Git history. The workaround is to click through the panel launcher. No data loss. Effort probably low, since the opener registry and openPluginPanel already exist.

Checks

  • Partly reproduced on the latest release (0.45.0) with the real plugin (see "Unverified repro"); on main I checked the code, not a live run.
  • I searched open and closed issues for the same problem.
  • An agent wrote this; investigation thread: bb thr_ksjawiiuxf (local).

AGENT GENERATED

Activity

  1. added theissue type on Oct 5, 2026
  2. added
    plugins
    confirmed-repro
    on Oct 5, 2026
  3. bb-slop-cop commented on Oct 5, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Low · labels: plugins, confirmed-repro.
    • Verdict: REPRODUCED on trusted main in two clean checkouts; root-cause confidence: high.
    • Root cause: The focused New thread view never publishes its panel opener to the registry used by plugin commands.
    • Reproduction report: includes the regression test, expected/actual output, source permalinks, and second-checkout verification. Functional test reproduction; no physical browser shortcut check.
    • Fix: PR #4954, ready for review and not merged. Regression fails before and passes after; 199 app tests and 75 Plugin Guide tests pass, plus typechecks/lint. 126 changed text lines across 5 files; no binary, dependency, schema, or wire changes.

    AGENT GENERATED

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

    confirmed-reproplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions