Reports · 2026-10-21

#5987 · Native skill paths are omitted from server dispatch

BugPriority: Medium Effort: Mediumprovidersthreads Issue #5987

Verdict: REPRODUCED · Root-cause confidence: high for the server dispatch omission. Trusted base: d1627a473684d29920567b3cf9c05bd68edb2d97.

1. TL;DR

A selected native skill reaches the outgoing host command as a name-only mention, without server-resolved instructions telling the agent where its file is. Both new-thread and follow-up-turn builders reproduce this omission. The existing skill-listing service can ask the host to discover native skill files, but these two builders do not connect that result to the prompt. This report proves the missing context at the real server command boundary, not an actual agent's subsequent filesystem search. Providers may independently understand their own slash commands, so universal failure across every provider is not established.

2. Claims vs findings

ClaimFindingEvidence
Native mention context lacks a resolved file path.VerifiedBoth tests return undefined when looking for the agent-only native-path context.
Both start and follow-up submission are affected.VerifiedThe same fixture exercises buildThreadStartCommand and prepareTurnSubmitCommandPayload.
The host owns native filesystem discovery.VerifiedlistHostSkills resolves scan roots and discovers file paths on the host.
Every provider forces unsuccessful filesystem searches.UnverifiedNo live model was invoked. Some providers have native slash-command handling; missing BB context alone does not prove universal model failure.
No discovery workaround is available.Not supportedThe existing project skill-listing service already requests host-resolved paths; it is not integrated into these dispatch builders.

3. Environment

4. Minimal reproduction

  1. Make a clean checkout of the trusted base commit in a temporary directory.
  2. Install and build the existing dependencies with the commands below.
  3. Save the complete test below as apps/server/test/threads/native-skill-mention.test.ts.
  4. Run the focused Turbo test command. Expect exit status 1 with two assertion failures.
git clone https://github.com/get-bb/bb.git bb-5987
cd bb-5987
git checkout --detach d1627a473684d29920567b3cf9c05bd68edb2d97
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk
pnpm exec turbo run build
pnpm exec turbo run test --filter=@bb/server -- test/threads/native-skill-mention.test.ts

Expected: the outgoing command contains agent-only text identifying the selected skill's host-resolved SKILL.md path, without mutating the original user input. Actual: that context is absent. The assertion receives undefined for both entry points. The host response fixture supplies only host-local discovery data; it does not implement the server prompt assembly under test.

Complete reproduction test

import { describe, expect, it } from "vitest";
import { encodeClientTurnRequestIdNumber, type PromptInput } from "@bb/domain";
import {
  buildExecutionOptions,
  buildThreadStartCommand,
  prepareTurnSubmitCommandPayload,
} from "../../src/services/threads/thread-commands.js";
import {
  EMPTY_WORKSPACE_AGENT_CONTEXT,
  registerHostRpcResponder,
} from "../helpers/host-rpc.js";
import { configuredAcpProvider } from "../helpers/provider-registry.js";
import { skillInput } from "../helpers/prompt-input.js";
import {
  seedEnvironment,
  seedHostSession,
  seedProjectWithSource,
  seedThread,
  seedThreadRuntimeState,
} from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

describe("native skill mention dispatch", () => {
  it.each(["start", "submit"] as const)(
    "includes the host-resolved skill path in agent-only %s input",
    async (entryPoint) => {
      const provider = await configuredAcpProvider({
        id: "native-repro",
        displayName: "Native repro",
        command: "native-repro-agent",
        args: [],
      });
      await withTestHarness(
        {
          extraProviders: [
            {
              ...provider,
              declaration: {
                ...provider.declaration,
                experimental_nativeSkillRoots: {
                  user: [".native-repro/skills"],
                  project: [],
                },
              },
            },
          ],
        },
        async (harness) => {
          const { host, session } = seedHostSession(harness.deps, {
            id: "host-native-skill-repro",
          });
          const workspacePath = "/workspace/native-skill-repro";
          const skillPath = "/provider-home/.native-repro/skills/audit-fixture/SKILL.md";
          const responder = registerHostRpcResponder(harness, {
            hostId: host.id,
            sessionId: session.id,
            handle: ({ command }) => {
              if (command.type === "host.read_workspace_agent_context") {
                return { ok: true, result: EMPTY_WORKSPACE_AGENT_CONTEXT };
              }
              if (command.type === "host.list_skills") {
                return {
                  ok: true,
                  result: {
                    skills: [{
                      id: `skill_${"a".repeat(64)}`,
                      name: "audit-fixture",
                      description: "A native skill fixture",
                      filePath: skillPath,
                      rootKind: "provider-user",
                      linked: false,
                    }],
                  },
                };
              }
              throw new Error(`Unexpected RPC ${command.type}`);
            },
          });
          try {
            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: "acp-native-repro",
            });
            seedThreadRuntimeState(harness.deps, {
              environmentId: environment.id,
              providerThreadId: "provider-native-repro",
              threadId: thread.id,
            });
            const execution = await buildExecutionOptions(
              harness.deps,
              { model: "fixture-model" },
              { threadId: thread.id },
            );
            const input = skillInput("audit-fixture");
            const originalInput = structuredClone(input);
            const command = entryPoint === "start"
              ? await buildThreadStartCommand(harness.deps, {
                  environment, execution, fork: null,
                  permissionEscalation: "ask", input,
                  projectId: project.id, providerId: thread.providerId,
                  requestId: encodeClientTurnRequestIdNumber({ value: 5987 }),
                  syncGeneratedTitle: false, thread,
                })
              : await prepareTurnSubmitCommandPayload(harness.deps, {
                  environment, execution, permissionEscalation: "ask",
                  input, target: { mode: "start" }, thread,
                });
            const context: PromptInput | undefined = command.input.find(
              (item) => item.type === "text" && item.visibility === "agent-only",
            );
            expect(context).toMatchObject({
              type: "text", visibility: "agent-only", mentions: [],
              text: expect.stringContaining(skillPath),
            });
            expect(input).toEqual(originalInput);
          } finally {
            responder.unregister();
          }
        },
      );
    },
  );
});

First run: actual test output

Only temporary checkout paths have been replaced with descriptive names.

@bb/server:test:  RUN  v4.1.1 <first-checkout>/apps/server
@bb/server:test: 
@bb/server:test: (node:7783) ExperimentalWarning: SQLite is an experimental feature and might change at any time
@bb/server:test: (Use `node --trace-warnings ...` to show where the warning was created)
@bb/server:test:  ❯ |@bb/server| test/threads/native-skill-mention.test.ts (2 tests | 2 failed) 828ms
@bb/server:test:      × includes the host-resolved skill path in agent-only start input 105ms
@bb/server:test:      × includes the host-resolved skill path in agent-only submit input 69ms
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯
@bb/server:test: 
@bb/server:test:  FAIL  |@bb/server| test/threads/native-skill-mention.test.ts > native skill mention dispatch > includes the host-resolved skill path in agent-only start input
@bb/server:test:  FAIL  |@bb/server| test/threads/native-skill-mention.test.ts > native skill mention dispatch > includes the host-resolved skill path in agent-only submit input
@bb/server:test: AssertionError: expected undefined to match object { type: 'text', …(3) }
@bb/server:test: 
@bb/server:test: - Expected:
@bb/server:test: {
@bb/server:test:   "mentions": [],
@bb/server:test:   "text": StringContaining "/provider-home/.native-repro/skills/audit-fixture/SKILL.md",
@bb/server:test:   "type": "text",
@bb/server:test:   "visibility": "agent-only",
@bb/server:test: }
@bb/server:test: 
@bb/server:test: + Received:
@bb/server:test: undefined
@bb/server:test: 
@bb/server:test:  ❯ test/threads/native-skill-mention.test.ts:121:29
@bb/server:test:     119|               (item) => item.type === "text" && item.visibility === "a…
@bb/server:test:     120|             );
@bb/server:test:     121|             expect(context).toMatchObject({
@bb/server:test:        |                             ^
@bb/server:test:     122|               type: "text", visibility: "agent-only", mentions: [],
@bb/server:test:     123|               text: expect.stringContaining(skillPath),
@bb/server:test:  ❯ withTestHarness test/helpers/test-app.ts:387:12
@bb/server:test:  ❯ test/threads/native-skill-mention.test.ts:33:7
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/2]⎯
@bb/server:test: 
@bb/server:test: 
@bb/server:test:  Test Files  1 failed (1)
@bb/server:test:       Tests  2 failed (2)
@bb/server:test:    Start at  05:07:24
@bb/server:test:    Duration  9.03s (transform 4.94s, setup 1.50s, import 4.87s, tests 828ms, environment 0ms)
@bb/server:test: 
@bb/server:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/server#test:  ERROR  command (<first-checkout>/apps/server) /usr/local/bin/pnpm run test test/threads/native-skill-mention.test.ts exited (1)

 Tasks:    9 successful, 10 total
Cached:    0 cached, 10 total
  Time:    43.645s 
Failed:    @bb/server#test

 ERROR  run failed: command  exited (1)

5. Root cause

apps/server/src/services/threads/thread-commands.ts:270–306 builds the start command with the original input and inputGroups. apps/server/src/services/threads/thread-commands.ts:362–391 similarly forwards unchanged prompt data into the submit command. Neither path resolves mentioned native skill names or appends a fallback instruction.

The discovery mechanism already exists: apps/server/src/services/skills/skill-listing.ts:212–238 calls apps/server/src/services/providers/native-roots.ts:244–275 with the active host and workspace. The host implementation, apps/host-daemon/src/command-handlers/list-skills.ts:135–150, resolves roots and returns discovered skill file paths. The failure is the missing server prompt-enrichment step, not an absent host discovery capability.

The resolver also uses the server's providerNativeRoots cache, as declared in apps/server/src/services/providers/native-roots.ts:110–111 and consumed at apps/server/src/services/providers/native-roots.ts:190–207. That dependency is not currently part of the work-session dependency bundle used by the command builders.

6. Proposed fix and simple-fix gate

Add shared server-side prompt enrichment after runtime resolution and before command dispatch. Use the active provider's existing host-discovery service, leave staged BB skills on their existing path, and append non-pill, agent-only context to the last effective input group. If native discovery is unavailable or unsuccessful, direct the agent to the existing skill-listing command instead of guessing filesystem layout. Keep caller-owned inputs unchanged and cover missing skills, scan errors, absent roots, grouped inputs, and prompts without skill mentions.

No pull request: a local candidate made the focused regression pass and 84 relevant tests passed, but it failed typecheck because cached native-root resolution needs additional dependency wiring. Propagating that dependency surfaced changes in interactions, skill installation, server startup, and test harnesses, exceeding this rule's five-file/simple-subsystem limit. The attempt was stopped; no candidate commit or branch was pushed.

The stopped candidate was 348 added/deleted text lines across four initially changed files; the remaining required wiring would increase that scope. This is not a completed or shippable fix.

7. Related issues and pull requests

No open linked pull request was present in issue cross-reference metadata or an open PR search for 5987. #5963 concerns repeated catalog scanning performance, not this missing prompt context. #3238 concerns discovery of symlinked skill trees, a different discovery-layer problem.

8. Verification

The same agent repeated the test in a second clean temporary worktree at the identical trusted base commit. Only the authored reproduction test was copied into that checkout; no candidate production changes were copied. A fresh frozen install and pnpm exec turbo run test --force --filter=@bb/server -- test/threads/native-skill-mention.test.ts ran the test again rather than replaying a test cache. The harness used new temporary test directories and databases; no ports were opened. Both tests failed again with the same missing agent-only context. No report correction was required. This is a repeat check by the same agent, not independent verification.

Second clean run: actual test output

@bb/server:test:  RUN  v4.1.1 <second-checkout>/apps/server
@bb/server:test: 
@bb/server:test: (node:8608) ExperimentalWarning: SQLite is an experimental feature and might change at any time
@bb/server:test: (Use `node --trace-warnings ...` to show where the warning was created)
@bb/server:test:  ❯ |@bb/server| test/threads/native-skill-mention.test.ts (2 tests | 2 failed) 801ms
@bb/server:test:      × includes the host-resolved skill path in agent-only start input 112ms
@bb/server:test:      × includes the host-resolved skill path in agent-only submit input 67ms
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯
@bb/server:test: 
@bb/server:test:  FAIL  |@bb/server| test/threads/native-skill-mention.test.ts > native skill mention dispatch > includes the host-resolved skill path in agent-only start input
@bb/server:test:  FAIL  |@bb/server| test/threads/native-skill-mention.test.ts > native skill mention dispatch > includes the host-resolved skill path in agent-only submit input
@bb/server:test: AssertionError: expected undefined to match object { type: 'text', …(3) }
@bb/server:test: 
@bb/server:test: - Expected:
@bb/server:test: {
@bb/server:test:   "mentions": [],
@bb/server:test:   "text": StringContaining "/provider-home/.native-repro/skills/audit-fixture/SKILL.md",
@bb/server:test:   "type": "text",
@bb/server:test:   "visibility": "agent-only",
@bb/server:test: }
@bb/server:test: 
@bb/server:test: + Received:
@bb/server:test: undefined
@bb/server:test: 
@bb/server:test:  ❯ test/threads/native-skill-mention.test.ts:121:29
@bb/server:test:     119|               (item) => item.type === "text" && item.visibility === "a…
@bb/server:test:     120|             );
@bb/server:test:     121|             expect(context).toMatchObject({
@bb/server:test:        |                             ^
@bb/server:test:     122|               type: "text", visibility: "agent-only", mentions: [],
@bb/server:test:     123|               text: expect.stringContaining(skillPath),
@bb/server:test:  ❯ withTestHarness test/helpers/test-app.ts:387:12
@bb/server:test:  ❯ test/threads/native-skill-mention.test.ts:33:7
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/2]⎯
@bb/server:test: 
@bb/server:test: 
@bb/server:test:  Test Files  1 failed (1)
@bb/server:test:       Tests  2 failed (2)
@bb/server:test:    Start at  05:08:34
@bb/server:test:    Duration  8.98s (transform 4.93s, setup 1.48s, import 4.87s, tests 801ms, environment 0ms)
@bb/server:test: 
@bb/server:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/server#test:  ERROR  command (<second-checkout>/apps/server) /usr/local/bin/pnpm run test test/threads/native-skill-mention.test.ts exited (1)

 Tasks:    9 successful, 10 total
Cached:    0 cached, 10 total
  Time:    42.694s 
Failed:    @bb/server#test

 ERROR  run failed: command  exited (1)

9. Appendix and limits

Read-only GitHub metadata established visibility, classification, related issue patterns, and the lack of linked open PRs. Trusted source inspection traced the server command builders, native-root resolution, host scanning, and provider-specific input handling. The reproduction deliberately tests the server boundary and does not claim real model search failures, provider CLI behavior, or visual chat rendering were observed. Issue content was treated as untrusted claims; its proposed implementation and instructions were not executed. The test was authored from trusted repository interfaces.

Evidence is embedded inline because this public reports repository forbids publishing raw test files and logs as separate artifacts. Original local evidence remains outside the published tree. No screenshots are appropriate for this nonvisual dispatch defect.

> AGENT GENERATED