Reports

#5215 · Command discovery skips plugin skill selection

BugPriority: MediumEffort: Mediumuipluginsconfirmed-reproGitHub issue

2026-10-20 · Trusted origin/main: bd93d18896bab97c950c4fa3451b621c1e0569c1

Verdict: REPRODUCED · Root-cause confidence: high

1. TL;DR

Disabling a bundled plugin skill removes it from the server's thread runtime injection list but not from its command-discovery response. A focused test loads the real built-in BB guide plugin, changes its skill-creator setting, resolves a real thread's runtime configuration, and requests the public commands route. Both Codex and Claude Code return the disabled plugin skill in that route, even while their runtime configuration correctly omits it. The route builds the shared skill catalog without the plugin selection map that the runtime supplies. The same agent repeated this result in a second clean checkout; no provider turn, browser, or production instance was used.

2. Claims vs findings

ClaimFindingEvidence
Disabled BB guide skills remain in command discovery.VerifiedThe real route returns the bb-guide skill-creator entry with its setting false in both provider cases.
Runtime selection honors the setting.Verified at server boundaryresolveThreadRuntimeCommandConfig excludes that skill when false, and includes it before and after when true.
The issue is provider-neutral rather than a stale UI cache.Verified for tested providersDirect in-process requests bypass the browser cache. Both provider identifiers reproduce after each awaited settings update.
The command route omits plugin selections.VerifiedTrusted source and both failed route assertions support this mechanism.
The exact original menu inventory and original operating-system environment match.Not retestedThis run uses the current trusted main and isolated fixtures, not the reporter's installation.
An actual provider process cannot resolve the selected slash command.UnverifiedNo real provider process was launched. Only server injection and command-discovery results were tested.

3. Environment

4. Minimal reproduction

  1. Clone the public repository and select the recorded trusted commit:
    git clone https://github.com/get-bb/bb.git bb-5215
    cd bb-5215
    git checkout --detach bd93d18896bab97c950c4fa3451b621c1e0569c1
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
    pnpm exec turbo run build
  2. Save the complete embedded test below at apps/server/test/public/public-project-command-selection.test.ts.
  3. Run the focused regression test:
    pnpm exec turbo run test --filter=@bb/server -- test/public/public-project-command-selection.test.ts

Expected: both provider cases pass; disabling the setting makes both runtimeHasSkill and menuHasSkill false. Actual: exit status 1, with two intended assertion failures. Enabled states before and after are positive controls.

{"providerId":"codex","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}
{"providerId":"codex","enabled":false,"runtimeHasSkill":false,"menuHasSkill":true}
{"providerId":"codex","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}
{"providerId":"claude-code","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}
{"providerId":"claude-code","enabled":false,"runtimeHasSkill":false,"menuHasSkill":true}
{"providerId":"claude-code","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}

AssertionError: codex: enabled=false: expected true to be false
AssertionError: claude-code: enabled=false: expected true to be false
Test Files  1 failed (1)
Tests  2 failed (2)

This is a server catalog behavior reproduction, not a screenshot-based rendering reproduction. No screenshot is claimed. The complete test and observed results are embedded here; raw run logs are retained locally rather than committed, following this public report repository's policy.

Complete reproduction test
import { commandListResponseSchema } from "@bb/server-contract";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { resolveThreadRuntimeCommandConfig } from "../../src/services/threads/thread-runtime-config.js";
import { registerHostRpcResponder } from "../helpers/host-rpc.js";
import { readJson } from "../helpers/json.js";
import {
  seedEnvironment,
  seedHostSession,
  seedPrimaryHost,
  seedProjectWithSource,
  seedThread,
} from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

describe("plugin skill selection in command discovery", () => {
  it.each(["codex", "claude-code"])(
    "keeps %s command discovery consistent with runtime selection",
    async (providerId) => {
      await withTestHarness(async (harness) => {
        const installed = await harness.pluginService.install("builtin:bb-guide", {
          kind: "root",
        });
        expect(installed.status).toBe("running");
        const { host, session } = seedHostSession(harness.deps, {
          id: "host-command-selection",
        });
        seedPrimaryHost(harness.deps, host.id);
        const workspacePath = path.join(harness.config.dataDir, "workspace");
        const { project } = seedProjectWithSource(harness.deps, {
          hostId: host.id,
          path: workspacePath,
        });
        const environment = seedEnvironment(harness.deps, {
          hostId: host.id,
          projectId: project.id,
          path: workspacePath,
        });
        const thread = seedThread(harness.deps, {
          projectId: project.id,
          environmentId: environment.id,
          providerId,
        });
        registerHostRpcResponder(harness, {
          hostId: host.id,
          sessionId: session.id,
          handle: (request) => {
            switch (request.command.type) {
              case "host.read_workspace_agent_context":
                return {
                  ok: true,
                  result: {
                    agentInstructions: null,
                    projectSkills: [],
                    projectSkillsTruncated: false,
                    sharedSkills: [],
                  },
                };
              case "host.list_commands":
              case "provider.list_commands":
                return { ok: true, result: { commands: [] } };
              case "host.list_skills":
                return { ok: true, result: { skills: [] } };
              case "plugin.host.call":
                return {
                  ok: true,
                  result: { output: { skills: [], commands: [] } },
                };
              default:
                throw new Error(`Unexpected host request: ${request.command.type}`);
            }
          },
        });

        for (const enabled of [true, false, true]) {
          await harness.pluginService.updateSettings("bb-guide", {
            skillCreator: enabled,
          });
          const runtime = await resolveThreadRuntimeCommandConfig(harness.deps, {
            thread,
            environment,
            model: "test-model",
          });
          const runtimeHasSkill = runtime.injectedSkillSources.some(
            (source) => source.name === "skill-creator",
          );
          expect(runtimeHasSkill).toBe(enabled);
          const response = await harness.app.request(
            `/api/v1/projects/${project.id}/commands?provider=${providerId}&environmentId=${environment.id}`,
          );
          expect(response.status).toBe(200);
          const body = commandListResponseSchema.parse(await readJson(response));
          const menuHasSkill = body.commands.some(
            (command) =>
              command.pluginId === "bb-guide" && command.name === "skill-creator",
          );
          console.log(
            JSON.stringify({ providerId, enabled, runtimeHasSkill, menuHasSkill }),
          );
          expect.soft(menuHasSkill, `${providerId}: enabled=${enabled}`).toBe(
            enabled,
          );
        }
      });
    },
  );
});

5. Root cause

BB guide's real configure callback selects its manifest skills using the current settings, so changing the skill-creator setting changes that selection immediately.

plugins/bb-guide/server.ts:46

  settings.onChange((next) => {
    current = next;
  });
  bb.agents.contributeInstructions(() =>
    current.introduction ? introduction : null,
  );
  bb.agents.configure(() => ({
    tools: [],
    skills: current.skills
      ? [
          ...(current.bbCli ? ["bb-cli"] : []),
          ...(current.pluginAuthoring ? ["bb-plugin-authoring"] : []),
          ...(current.skillCreator ? ["skill-creator"] : []),
          ...(current.submitPlugin ? ["submit-a-plugin"] : []),
        ]
      : [],
  }));
}

The thread runtime resolves plugin agent configuration with the actual thread, project, environment, host, provider/model, and origin. It passes the resulting selected skill IDs into the shared catalog.

apps/server/src/services/threads/thread-runtime-config.ts:148

  const conditionalConfiguration = await resolvePluginAgentConfiguration({
    context: {
      thread: {
        id: args.thread.id,
        title: args.thread.title,
        parentThreadId: args.thread.parentThreadId,
        sourceThreadId: args.thread.sourceThreadId,
      },
      project: {
        id: project.id,
        kind: project.kind,
        name: project.name,
        gitRemoteUrl: project.gitRemoteUrl,
      },
      environment: {

apps/server/src/services/threads/thread-runtime-config.ts:204

  const injectedSkillSources = resolveSkillCatalog(deps, {
    projectSkillSources: workspaceAgentContext.projectSkillSources,
    sharedSkillSources: workspaceAgentContext.sharedSkills.runtimeSources,
    pluginSkillSelections: conditionalConfiguration.selectedSkillIdsByPlugin,
  }).map((entry) => entry.runtimeSource);
  const dataDirAgentInstructions = readDataDirAgentInstructions(

The commands route instead passes only project and shared workspace skills. It never supplies a selection map.

apps/server/src/routes/projects.ts:816

    const skillCatalog = resolveSkillCatalog(deps, {
      projectSkillSources: workspaceSkills.projectSkillSources,
      sharedSkillSources: workspaceSkills.sharedSkills.runtimeSources,
    });
    return context.json(
      buildCommandListResponse({
        commands: result.commands,
        liveCommands,
        includeBuiltinCompact: deps.providerRegistry.supportsManualCompaction(
          query.provider,
        ),
        skillCatalog,
      }),
    );
  });

In the common catalog resolver, absence of a plugin selection map admits every manifest skill. This is why the endpoint still advertises a disabled skill even when the runtime omits it.

apps/server/src/services/skills/injected-skills.ts:656

  const pluginSourceGroups = (args.pluginSkillRoots ?? []).map(
    ({ pluginId, rootPath }) => ({
      pluginId,
      sources: readSkillsRoot({
        logger,
        skillTreeRegistry,
        skillsRootPath: rootPath,
        sourceType: "data-dir",
      }).filter(
        (source) =>
          !args.pluginSkillSelections?.has(pluginId) ||
          args.pluginSkillSelections.get(pluginId)?.has(source.name) === true,
      ),
    }),
  );

The composer uses that commands endpoint with project, provider, and workspace routing only.

apps/app/src/hooks/queries/project-queries.ts:285

export function projectCommandsQueryOptions(args: UseProjectCommandsArgs) {
  return {
    queryKey: projectCommandsQueryKey(
      args.projectId,
      args.providerId,
      args.environmentId,
      args.hostId,
    ),
    queryFn: ({ signal }: { signal: AbortSignal }) =>
      sdk.projects.commands({
        projectId: requireProjectId(args.projectId, "useProjectCommands"),
        provider: requireProviderId(args.providerId, "useProjectCommands"),
        signal,
        ...(args.environmentId !== null
          ? { environmentId: args.environmentId }
          : args.hostId !== null
            ? { hostId: args.hostId }
            : {}),
      }),
  };
}

The deeper contract mismatch matters for a safe fix: agent configuration requires a real thread identity and model, and the plugin service reads persisted metadata for that thread. The command query accepts no thread or model. Inventing a dummy thread would not reproduce plugin metadata, fork origin, or model-dependent selection.

packages/server-contract/src/api/projects.ts:309

export const projectCommandsQuerySchema = z
  .object({
    ...projectWorkspaceRoutingFields,
    provider: z.string().min(1),
  })
  .partial({ hostId: true, environmentId: true })
  .strict()
  .superRefine(rejectMultipleWorkspaceSelectors);
export type ProjectCommandsQuery = z.infer<typeof projectCommandsQuerySchema>;

packages/plugin-sdk/src/backend-contract.ts:1169

  thread: {
    id: string;
    title: string | null;
    parentThreadId: string | null;
    sourceThreadId: string | null;
  };
  project: {

apps/server/src/services/plugins/plugin-service.ts:2282

      const metadataByPluginId = new Map<string, JsonObject>();
      for (const row of listThreadPluginMetadataRows(
        deps.db,
        context.thread.id,
        configuringPluginIds,
      )) {
        const metadata = parsePersistedPluginMetadata(row.metadataJson);
        if (metadata === undefined) {
          logger.warn(
            `Ignoring corrupt plugin metadata for thread ${context.thread.id}, plugin ${row.pluginId}`,
          );
        }
        metadataByPluginId.set(row.pluginId, metadata ?? {});
      }

      for (const { pluginId, provider } of plugins) {
        const pluginTools = allTools.filter(
          (entry) => entry.pluginId === pluginId,
        );
        if (provider === null) {
          tools.push(
            ...pluginTools.map(({ record }) =>

The skill-listing service also calls the catalog without selection, as inventory listing. That path was inspected but not executed in this reproduction; the report makes no new runtime claim about the CLI.

apps/server/src/services/skills/skill-listing.ts:187

function listBbPluginSkills(deps: AppDeps): SkillSummary[] {
  return resolveSkillCatalog(deps)
    .map(({ provenance, runtimeSource }): SkillSummary | null => {
      if (provenance.kind !== "plugin" || runtimeSource.kind !== "tree") {
        return null;
      }
      const rootPath = deps.skillTreeRegistry.resolve(runtimeSource.treeHash);

6. Proposed fix and simple-fix decision

Use the same selection policy for runtime injection and command discovery, with a defined context for existing threads and for the composer before thread creation. Existing threads need their actual identity, model, origin, and plugin metadata. Pre-thread discovery needs an explicit preview contract rather than fabricated required fields. Keep native commands and non-plugin skills unaffected, and do not hard-code BB guide's setting in a generic route.

No fix PR is safe under the requested simple-fix rules. Resolving the missing context requires a product/public-contract decision; the strict query schema currently cannot express it. No production code was changed, no branch was pushed, and no PR was opened. No linked open PR was found via issue cross-reference metadata or a repository PR search. A future fix should make the embedded regression pass and additionally cover metadata-dependent plugins, existing-thread selection, and pre-thread behavior once that contract is defined.

7. Verification

The same agent created a second clean clone from the trusted repository objects, set its origin to get-bb/bb, detached it at bd93d18896bab97c950c4fa3451b621c1e0569c1, and confirmed an empty tracked/untracked status before adding the self-authored reproduction test. No first-checkout modifications were inherited. It installed the frozen lockfile, built the SDK and repository, and ran the identical test in its own workspace. The test's SHA-256 is bf43bcb0191aea392b5cda4c6af5d0119cde7c623725b6da1c11df0a31d4d865.

pnpm exec turbo run test --filter=@bb/server -- test/public/public-project-command-selection.test.ts
Result in second checkout: exit 1; 2 tests failed at the disabled-selection assertions.
codex: enabled=false; runtimeHasSkill=false; menuHasSkill=true
claude-code: enabled=false; runtimeHasSkill=false; menuHasSkill=true

This is a second clean run by the same agent, not independent verification. No report correction was needed after that run. The test targets observable server responses, uses the migrated database rather than a database mock, loads the real configure callback, adds no production test seam, and catches a mismatch that existing generic catalog tests do not cover.

Relevant existing suites pass without modifying production code:

pnpm exec turbo run test --filter=@bb/server -- test/public/public-project-commands.test.ts test/services/plugins/plugin-agent-contributions.test.ts test/skills/injected-skills.test.ts
Test Files  3 passed (3)
Tests  29 passed (29)

Both repository builds succeeded (67 tasks each). The initial parallel build in the first fresh clone hit a pre-existing missing SDK-dist ordering problem; explicitly building the existing SDK task and repeating the build succeeded. The second clone used that same prerequisite ordering from the start. No dependency or tracked build configuration changed.

git diff --check passed. git diff --numstat origin/main was empty because no tracked production file changed; the only local addition was the untracked reproduction test. There was no fix diff to accept or publish.

8. Related issues and trust boundary

No duplicate or related-issue relationship was established in this run. Existing issue classification was already complete and was preserved: Bug, Medium priority, Medium effort, ui, plugins, confirmed-repro. No additional built-in-plugin label was available for BB guide.

The issue body and prior comments were treated as untrusted claims. No commands, URLs, patches, tests, branches, or instructions from that content were executed or fetched. The reproduction was authored from the trusted current-main route, plugin, runtime, and test harness. No external links from issue data or real user runtime data were used.

9. Appendix

The complete reproduction test and verbatim observation records are embedded above. Raw logs, the runnable test file, and build outputs are kept outside this public repository. No scripts, log files, or data directories are committed.

Second-run verbatim observations
{"providerId":"codex","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}
{"providerId":"codex","enabled":false,"runtimeHasSkill":false,"menuHasSkill":true}
{"providerId":"codex","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}
{"providerId":"claude-code","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}
{"providerId":"claude-code","enabled":false,"runtimeHasSkill":false,"menuHasSkill":true}
{"providerId":"claude-code","enabled":true,"runtimeHasSkill":true,"menuHasSkill":true}
AssertionError: codex: enabled=false: expected true to be false // Object.is equality
AssertionError: claude-code: enabled=false: expected true to be false // Object.is equality
 Test Files  1 failed (1)
      Tests  2 failed (2)
Relevant existing suite results
 ✓ |@bb/server| test/skills/injected-skills.test.ts (11 tests) 69ms
 ✓ |@bb/server| test/services/plugins/plugin-agent-contributions.test.ts (5 tests) 1182ms
 ✓ |@bb/server| test/public/public-project-commands.test.ts (13 tests) 1655ms
 Test Files  3 passed (3)
      Tests  29 passed (29)

Investigation commands: GitHub read-only issue/property/label/PR metadata queries; git clone, git fetch origin main, git rev-parse, git status --porcelain, git log, targeted rg/sed source inspection; the install/build/test commands above; sha256sum; git diff --check; git diff --numstat origin/main. Publication uses the supplied report publisher without comment/label flags; every GitHub write uses the SlopCop wrapper.

AGENT GENERATED · SlopCop new-issue-autopilot · 2026-10-20