#6223 · Plugin pane URL decoding

BugMedium priorityLow effortuipluginsGitHub issue

October 24, 2026 · trusted main 5e1acd765039e874643f34c4d35409e58484e408

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

1. TL;DR

Plugin pages can lose their original route when a pane URL is parsed into layout content and rebuilt. Two host-side parsers retain URL-escaped wildcard text instead of semantic text. The existing route builder correctly escapes semantic path segments, so it escapes those retained percent signs again. Direct tests of both production boundaries reproduce the problem without installing any third-party plugin. The smallest repair decodes matched plugin parameters once and makes both boundaries use the same parser.

2. Claims vs findings

ClaimFindingEvidence
Escaped plugin routes grow after host parse/build round trips.VerifiedThe two production parsers return items/key%3A42, not items/key:42. The builder escapes the retained percent sign.
The defect exists at two pathname-to-pane boundaries.VerifiedOne shared regression table exercises paneContentForPathname directly and SplitWorkspaceRoute rendered under a real MemoryRouter.
A third-party plugin must be running to trigger it.Not requiredAll failures reproduce using synthetic notes/board routes and trusted repository code only.
The reported installed macOS assets and third-party workaround behave as described.UnverifiedNo reporter installation, external scripts, or third-party plugin code was executed. This report proves the source-level route defect on trusted main.

3. Environment

4. Minimal reproduction

  1. Prepare a clean checkout of trusted main at the recorded commit:
    git clone --branch main --single-branch https://github.com/get-bb/bb.git bb-repro-6223
    cd bb-repro-6223
    git checkout --detach 5e1acd765039e874643f34c4d35409e58484e408
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk
    pnpm exec turbo run build
    The explicit SDK build avoids a clean-checkout plugin build ordering failure observed in the first all-package build.
  2. Replace apps/app/src/views/SplitWorkspaceRoute.test.tsx with the full test file below. It preserves the existing workspace tests and adds the same route contract for both parsing boundaries.
  3. Run:
    pnpm exec turbo run test --filter=@bb/app -- src/views/SplitWorkspaceRoute.test.tsx
  4. Expected: semantic subpaths match the fixture; canonical URLs remain identical through five parse/build rounds. Actual on unchanged production code:
    AssertionError: expected 'items/key%3A42' to be 'items/key:42' // Object.is equality
    Expected: "items/key:42"
    Received: "items/key%3A42"
    
    Test Files  1 failed (1)
         Tests  14 failed | 8 passed (22)
    The failures cover seven route cases on each of the two surfaces. Canonical colons, percent signs, Cyrillic, and literal escape-looking strings fail immediately; the malformed-percent case fails after canonicalization because the next parse retains its newly escaped percent sign.

Complete repeatable regression test

// @vitest-environment jsdom

import { Suspense, useEffect } from "react";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { MemoryRouter, Route, Routes, useNavigate } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { PaneContent } from "@/lib/split-layout";
import {
  paneContentForPathname,
  paneContentRoute,
} from "./thread-detail/splitThreadNavigation";
import SplitWorkspaceRoute from "./SplitWorkspaceRoute";

const workspaceLifecycle = vi.hoisted(() => ({ mounts: 0, unmounts: 0 }));

afterEach(cleanup);

vi.mock("./thread-detail/SplitThreadArea", () => ({
  SplitThreadArea: ({ routeContent }: { routeContent: PaneContent }) => {
    useEffect(() => {
      workspaceLifecycle.mounts += 1;
      return () => {
        workspaceLifecycle.unmounts += 1;
      };
    }, []);
    return (
      <output
        data-testid="route-content"
        data-subpath={
          routeContent.kind === "plugin-panel" ? routeContent.subPath : ""
        }
        data-route={paneContentRoute(routeContent)}
      >
        {routeContent.kind}
      </output>
    );
  },
}));

vi.mock("./LegacyProjectComposeRedirect", () => ({
  LegacyProjectComposeRedirect: () => <div>legacy redirect</div>,
}));

vi.mock("./ToolsView", () => ({
  PluginsView: ({ detailKey }: { detailKey?: string }) => (
    <output data-testid="tools-view">{detailKey ?? "overview"}</output>
  ),
}));

function NavigationControls() {
  const navigate = useNavigate();
  return (
    <>
      <button onClick={() => navigate("/")}>compose</button>
      <button onClick={() => navigate("/plugins/docs/docs/work/today.md")}>
        plugin
      </button>
      <button onClick={() => navigate("/threads/thread-1")}>thread</button>
    </>
  );
}

describe("SplitWorkspaceRoute", () => {
  beforeEach(() => {
    workspaceLifecycle.mounts = 0;
    workspaceLifecycle.unmounts = 0;
  });

  it("preserves the workspace mount across focus-driven page URL changes", () => {
    render(
      <MemoryRouter initialEntries={["/"]}>
        <NavigationControls />
        <Routes>
          <Route path="*" element={<SplitWorkspaceRoute />} />
        </Routes>
      </MemoryRouter>,
    );

    expect(screen.getByTestId("route-content").textContent).toBe("new-thread");

    fireEvent.click(screen.getByRole("button", { name: "plugin" }));
    expect(screen.getByTestId("route-content").textContent).toBe(
      "plugin-panel",
    );

    fireEvent.click(screen.getByRole("button", { name: "thread" }));
    expect(screen.getByTestId("route-content").textContent).toBe("thread");
    expect(workspaceLifecycle).toEqual({ mounts: 1, unmounts: 0 });
  });

  it("passes the plugin id from the full-window detail URL to PluginsView", async () => {
    render(
      <MemoryRouter initialEntries={["/plugins/github"]}>
        <Routes>
          <Route
            path="*"
            element={
              <Suspense fallback={null}>
                <SplitWorkspaceRoute />
              </Suspense>
            }
          />
        </Routes>
      </MemoryRouter>,
    );

    expect((await screen.findByTestId("tools-view")).textContent).toBe(
      "github",
    );
  });
});

describe.each([
  {
    surface: "pane navigation",
    readRoute(pathname: string) {
      const content = paneContentForPathname(pathname);
      if (content?.kind !== "plugin-panel") {
        throw new Error("Expected a plugin panel");
      }
      return { subPath: content.subPath, route: paneContentRoute(content) };
    },
  },
  {
    surface: "workspace route",
    readRoute(pathname: string) {
      const view = render(
        <MemoryRouter initialEntries={[pathname]}>
          <SplitWorkspaceRoute />
        </MemoryRouter>,
      );
      const output = view.getByTestId("route-content");
      const result = {
        subPath: output.getAttribute("data-subpath"),
        route: output.getAttribute("data-route"),
      };
      view.unmount();
      return result;
    },
  },
])("plugin URL round trips through $surface", ({ readRoute }) => {
  it.each([
    { subPath: "items/key:42", encoded: "items/key%3A42" },
    { subPath: "items/discount%", encoded: "items/discount%25" },
    { subPath: "items/план", encoded: "items/%D0%BF%D0%BB%D0%B0%D0%BD" },
    { subPath: "items/key%2Fpart", encoded: "items/key%252Fpart" },
    { subPath: "items/key%3Apart", encoded: "items/key%253Apart" },
    { subPath: "items/key/part", encoded: "items/key/part" },
    {
      subPath: "items/key/part",
      encoded: "items/key%2Fpart",
      canonical: "items/key/part",
    },
    {
      subPath: "items/key/part",
      encoded: "items/key%2fpart",
      canonical: "items/key/part",
    },
    {
      subPath: "items/bad%ZZ",
      encoded: "items/bad%ZZ",
      canonical: "items/bad%25ZZ",
    },
    { subPath: "", encoded: "" },
  ])(
    "preserves semantic subpath $subPath across five rounds",
    ({ subPath, encoded, canonical = encoded }) => {
      const expected = `/plugins/notes/board${canonical ? `/${canonical}` : ""}`;
      let pathname = `/plugins/notes/board${encoded ? `/${encoded}` : ""}`;
      for (let round = 0; round < 5; round += 1) {
        const parsed = readRoute(pathname);
        expect(parsed.subPath).toBe(subPath);
        expect(parsed.route).toBe(expected);
        if (parsed.route === null) {
          throw new Error("Expected a rebuilt plugin route");
        }
        pathname = parsed.route;
      }
    },
  );
});

This is a URL/data round-trip defect, not a visual-layout assertion. Real route rendering is exercised in jsdom; no screenshot or live split-pane click sequence is claimed.

5. Root cause

paneContentForPathname, lines 103–114 passes the raw pathname to matchPath and copies panel.params["*"] straight into PaneContent.subPath. SplitWorkspaceRoute, lines 28–60 independently performs the same parse and stores the same undecoded wildcard.

const panel = matchPath(PLUGIN_PANEL_ROUTE_PATH, pathname);
...
subPath: panel.params["*"] ?? ""

The installed, lockfile-pinned React Router matcher substitutes uppercase escaped slashes but does not generally decode URI components. getPluginPanelRoutePath, lines 182–196 treats subPath as semantic text:

const encoded = subPath
  .split("/")
  .filter((segment) => segment.length > 0)
  .map((segment) => encodeURIComponent(segment))
  .join("/");

Consequently a stored %3A is treated as literal percent text and necessarily rebuilt as %253A. Repeated parsing preserves the increasingly escaped value. The builder is not the defective boundary and should continue to encode once.

Slash semantics: a wildcard is one semantic slash-delimited string. An actual escaped slash canonicalizes to a normal separator, matching the existing uppercase-slash behavior; byte-for-byte preservation of every noncanonical URL is not promised. Literal text %2F, supplied as %252F in a URL, must stay literal and must not receive a second decode. The regression explicitly distinguishes those cases and covers lowercase escaped separators and malformed percent input.

6. Proposed fix and verified candidate

Decode matched plugin parameters with decodeURIComponent once after matching, retaining the original value on malformed escapes. Decode after the match, not before it, so literal escape-looking text is not consumed again by the matcher's slash substitution. Reuse paneContentForPathname for the workspace's plugin routes while retaining its existing root/thread and legacy-compose routing decisions.

The tested candidate changes three files in the existing app-routing subsystem: 109 additions plus 38 deletions, 147 changed text lines. Production routing accounts for 55 lines; tests account for 92. There are no dependencies, lockfile changes, generated files, migrations, data-schema changes, wire changes, permission changes, or new public APIs.

7. Verification

The same agent repeated the reproduction in a second clean temporary checkout, not an independent reviewer. Both checkouts were created directly at 5e1acd765039e874643f34c4d35409e58484e408; neither used an issue script or a pull request branch. In the second checkout, only the self-authored regression test was added; production code was unchanged.

RunCommand / result
First clean checkout, initial regressionpnpm exec turbo run test --filter=@bb/app -- src/views/SplitWorkspaceRoute.test.tsx — expected failure: 10 failed, 6 passed.
Second clean checkout, identical initial regressionSame command and trusted base — expected failure: 10 failed, 6 passed.
Second clean checkout, expanded safety matrix shown aboveSame command — expected failure: 14 failed, 8 passed. Added actual escaped-slash, lowercase-slash, and malformed-percent cases; no change to the root-cause finding.
Fixed checkout, relevant existing suites plus final regression11 files, 160 tests passed, including all 22 workspace-route tests.
Lint and typecheckPassed. Lint reports 246 existing warnings and zero errors.
Build / diff checksTrusted baseline all-package build passed after building the SDK; final app build and whitespace checks are recorded in the appendix.

Scope limit: full live web and macOS split-pane journeys were not run. The production parser and rendered route component are directly covered; the existing SplitThreadArea suite also passes. No claim about the reporter's desktop environment or private plugin is made.

8. Pull requests and related issues

No open pull request linked to #6223 was found in the issue timeline or the repository pull-request search before preparing this fix. No additional issue was needed to establish the verified route-boundary cause.

9. Appendix

Relevant final test command

pnpm exec turbo run test --filter=@bb/app -- src/views/SplitWorkspaceRoute.test.tsx src/views/thread-detail/splitThreadNavigation.test.ts src/lib/route-paths.test.ts src/lib/split-layout src/views/thread-detail/SplitThreadArea.test.tsx src/views/thread-detail/splitPaneCommands.test.ts

Test Files  11 passed (11)
     Tests  160 passed (160)

pnpm exec turbo run build --filter=@bb/app

Tasks: 5 successful, 5 total

pnpm exec turbo run lint typecheck --filter=@bb/app
git diff --check
git diff --numstat origin/main

89  3  apps/app/src/views/SplitWorkspaceRoute.test.tsx
5  31  apps/app/src/views/SplitWorkspaceRoute.tsx
15  4  apps/app/src/views/thread-detail/splitThreadNavigation.ts

All source links above were checked against the recorded trusted base. Raw logs and patches remain outside the public reports repository under its publication policy; the full reproducer and verbatim relevant results are inline here. Issue content was treated only as untrusted claims. Its proposed implementation and external-script references were not executed or adopted as instructions.

> AGENT GENERATED