← reports

#5201 · Selected skills lose provider invocation semantics

Bug Priority: Medium Effort: Low providers · provider-codex · GitHub issue

October 8, 2026 · trusted origin/main f135a001e72942cee9118d2693208ec0725e2f18

Verdict: REPRODUCED at the provider conversion boundary · Root-cause confidence: high · reproduction label: confirmed-repro.

1. TL;DR

BB records a selected skill as text plus structured mention metadata. Selecting it through the slash menu retains a slash in the text, while selecting it through the dollar menu retains a dollar sign. The Codex input converter discards the metadata and forwards that text unchanged. A newly written regression test reproduces this difference on unchanged trusted main in two separate clean checkouts. This report verifies the outgoing input defect, not a fresh live model response or native skill-content injection.

2. Claims vs findings

ClaimStatusEvidence
Selected slash skills reach Codex as slash text rather than skill invocation input.VerifiedThe selected-slash regression fails with slash text in both clean runs; the bridge uses that converter for start and steer.
Selected dollar skills take a different outgoing-text path.Verified at conversion boundaryThe dollar control passes and retains dollar text. No native skill item is emitted for either selection.
The composer stores the selected trigger and skill identity.Verified staticallyComposer serialization and the resource constructor retain trigger, name, source, origin, and mention range.
A live provider attaches skill content only for the dollar selection.Unverified in this investigationNo live provider session, private runtime, or reporter rollout was accessed. The test confirms the precise upstream payload difference.
Trusted main already translates the selected slash range.RefutedUnchanged production code still returns chunk.text; both fresh test executions receive slash text.

3. Environment

4. Minimal reproduction

  1. Clone the trusted repository and detach at the recorded main commit:
    git clone https://github.com/get-bb/bb.git bb-5201-first
    cd bb-5201-first
    git checkout --detach f135a001e72942cee9118d2693208ec0725e2f18
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build
  2. Save the following complete test as plugins/provider-codex/src/repro-5201.test.ts. This test was designed from the repository's prompt contract and converter, not copied from the issue or linked PR.
    import { describe, expect, it } from "vitest";
    import type { PromptInput } from "@get-bb/plugin-sdk/provider-bridge";
    import { toCodexUserInput } from "./session-params.js";
    
    describe("selected skill provider input", () => {
      it.each([
        { trigger: "/", expected: "$fixture-helper continue" },
        { trigger: "$", expected: "$fixture-helper continue" },
      ] as const)("encodes a selected $trigger skill for Codex", ({ trigger, expected }) => {
        const input: PromptInput[] = [{
          type: "text",
          text: `${trigger}fixture-helper continue`,
          mentions: [{
            start: 0,
            end: 15,
            resource: {
              kind: "command",
              trigger,
              name: "fixture-helper",
              source: "skill",
              origin: "project",
              label: "fixture-helper",
              argumentHint: null,
            },
          }],
        }];
        expect(toCodexUserInput(input)).toEqual([
          { type: "text", text: expected, text_elements: [] },
        ]);
      });
    
      it("preserves unselected slash text", () => {
        expect(toCodexUserInput([{
          type: "text", text: "/fixture-helper continue", mentions: [],
        }])).toEqual([
          { type: "text", text: "/fixture-helper continue", text_elements: [] },
        ]);
      });
    
      it("preserves a selected ordinary slash command", () => {
        expect(toCodexUserInput([{
          type: "text",
          text: "/fixture-command continue",
          mentions: [{
            start: 0,
            end: 16,
            resource: {
              kind: "command", trigger: "/", name: "fixture-command",
              source: "command", origin: "builtin", label: "fixture-command",
              argumentHint: null,
            },
          }],
        }])).toEqual([
          { type: "text", text: "/fixture-command continue", text_elements: [] },
        ]);
      });
    });
  3. Run the focused test through Turbo:
    pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/repro-5201.test.ts
    Expected: all four cases pass, with selected slash and dollar skills both encoded as dollar invocation text. Actual: exit 1, only the selected slash case fails. The exact assertion difference in each run is:
    - Expected
    + Received
    
      [
        {
    -     "text": "$fixture-helper continue",
    +     "text": "/fixture-helper continue",
          "text_elements": [],
          "type": "text",
        },
      ]
    
    Tests  1 failed | 3 passed (4)

The fixture needs no skill files: this is an input-encoding test, not a native skill-discovery test. Existing coverage maps text, images, and local attachments but supplies empty mentions, so it cannot detect selected-skill semantics being discarded. The new test uses the real exported converter, adds no production seam or mock, and its controls distinguish selected skills from ordinary slash text.

5. Root cause

The composer inserts the active trigger into serialized text while its resource constructor preserves skill metadata. The command resource contract records identity and source but has no native skill path.

At the provider boundary, the converter does not inspect mentions at all:

case "text":
  return { type: "text", text: chunk.text, text_elements: [] };

Consequently a selected slash skill is indistinguishable from literal slash text in the emitted Codex input. The turn/start request and turn/steer request both consume the same converter result. This directly explains the outgoing payload defect. The reported native skill-block behavior remains a downstream claim, not freshly executed evidence.

6. Proposed fix

Within the existing Codex converter, translate only exact, valid ranges whose resource is a slash-triggered skill into dollar invocation text. Preserve the displayed BB input, dollar selections, ordinary commands, unselected text, and unrelated input variants. Reject stale, overlapping, or out-of-bounds ranges instead of rewriting arbitrary text. A native skill item would additionally require a skill path that the current mention contract does not carry; the contained text translation avoids a discovery or public-contract change.

No fix branch or duplicate pull request was created: an open ready PR already explicitly closes this issue.

7. Existing PR: #5202

PR #5202 was OPEN and non-draft, and GitHub closing-issue metadata linked it to #5201. Its diff was read only after designing and running the trusted-base regression. No PR code was checked out or executed.

The static diff updates the existing converter to sort mention ranges, select slash skill resources, require an exact text match, reject out-of-bounds or previously consumed ranges, and reconstruct only the provider text. Its tests cover selected skills, plain text, repeated names and stale ranges. Static verdict: the proposed approach targets the reproduced root cause; no blocking finding in the inspected diff. This is not a runtime approval of the PR: only the unchanged main converter and the independently authored report test were executed.

8. Related issues

#2318 is a separately reported skill-chip spacing issue for another provider; it is not treated as proof or a duplicate of this converter defect.

9. Verification

The same agent repeated the test in a second initially clean detached checkout at the full recorded SHA, after another frozen install and provider-filtered build. Only the newly authored test was added; production source remained unchanged in both checkouts. To ensure the second result was executed rather than replayed from Turbo cache, it used:

pnpm exec turbo run test --force --filter=bb-plugin-provider-codex -- src/repro-5201.test.ts

RunUTC startResultMeaning
First checkout2026-10-08 12:13:441 failed, 3 passed; exit 1Selected slash received as slash text.
Second clean checkout2026-10-08 12:14:101 failed, 3 passed; exit 1Same assertion difference, with forced execution.

No report correction was required after the second run. This was repeat verification by the same agent, not independent-agent verification. The unchanged existing converter suite also passed all 31 tests with pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/session-params.test.ts. No screenshot is supplied because the reproduced defect is nonvisual data conversion.

10. Appendix and trust boundary

Commands used for preparation and evidence: trusted main fetch and SHA verification; clean detached worktree creation; frozen installs; full first build; provider-filtered second build; the two focused Turbo test runs; the existing converter test suite; and read-only GitHub issue/PR metadata and diff queries. Git diff checks confirmed production code was unchanged. Raw local logs and the formatted test remain outside the public report repository; the complete reproduction and actual assertion result are embedded here.

All issue text, comments, links, suggested code, and the PR diff were treated as untrusted claims. No issue-supplied command, script, patch, branch, test, or URL was executed or fetched. No workflow, subagent, production instance, private rollout, or credentials were used. Only trusted main and the newly authored local test were executed. Public code links above were constructed from paths inspected in trusted main.