← reports

#5555 · Skill inspection rejects directory aliases

BugPriority: MediumEffort: Mediumprovidersprovider-piGitHub issue

2026-10-15 · trusted origin/main 05771e3c82404328854468f0fff7f0f8203e2076

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

1. TL;DR

A skill can be found successfully while its detail and file-list operations cannot read it. Discovery follows a linked directory, retains the logical filename and marks the skill linked. The server then uses that logical directory as the host file RPC root, but those RPCs deliberately reject symbolic-link roots. A four-case test reproduces both read failures on current main, while the equivalent ordinary-directory controls pass. The failure is in the shared filesystem path, not a missing skill document or a provider turn.

2. Claims vs findings

ClaimFindingEvidence
A directory-linked imported skill is discoverable.VerifiedReal discoverSkills returns the logical SKILL.md filename with linked=true in both failing cases.
The document exists and can be read.VerifiedBefore invoking the host reader, the test reads the discovered filename directly with fs.readFile and checks its full content.
Document and file-list operations reject the linked root.VerifiedBoth real host handlers throw invalid_path from the root validator. Ordinary-directory controls succeed.
The issue affects CLI responses through the server.Source-supported; no live HTTP runCLI commands call the shared skill SDK endpoints; their server handlers forward the logical root and convert host failures to HTTP 502.
The installed macOS UI displays a failure.Not directly exercisedThis investigation uses Linux filesystem tests, not the reporting desktop, a browser or BB Connect. No screenshot is claimed.
No provider turn is needed.Verified for this mechanismThe complete filesystem reproduction runs without starting a provider, server or daemon.

3. Environment

4. Minimal reproduction

  1. Clone the trusted repository and select the recorded main commit.
git clone --branch main https://github.com/get-bb/bb.git bb-issue-5555
cd bb-issue-5555
git checkout --detach 05771e3c82404328854468f0fff7f0f8203e2076
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build

Create this newly authored test and run it. It uses real discovery and host handlers, not an issue script, linked PR code, mocks, or a new production seam.

cat > apps/host-daemon/src/command-handlers/issue-5555.test.ts <<'TEST'
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { discoverSkills } from "../command-discovery.js";
import { listHostFiles, readHostRelativeFile } from "./host-files.js";

describe("discovered provider skill inspection", () => {
  let scratch: string;
  let catalog: string;
  const document =
    "---\nname: catalog-check\ndescription: Inspection fixture\n---\n# Guide\n";

  beforeEach(async () => {
    scratch = await fs.mkdtemp(path.join(os.tmpdir(), "skill-inspection-"));
    catalog = path.join(scratch, "catalog");
    await fs.mkdir(catalog);
  });

  afterEach(async () => {
    await fs.rm(scratch, { recursive: true, force: true });
  });

  it.each([
    { linked: false, operation: "read" },
    { linked: false, operation: "list" },
    { linked: true, operation: "read" },
    { linked: true, operation: "list" },
  ])(
    "inspects a discovered skill: $operation, linked=$linked",
    async ({ linked, operation }) => {
      const logicalDirectory = path.join(catalog, "catalog-check");
      const physicalDirectory = linked
        ? path.join(scratch, "content")
        : logicalDirectory;
      await fs.mkdir(path.join(physicalDirectory, "references"), {
        recursive: true,
      });
      await fs.writeFile(path.join(physicalDirectory, "SKILL.md"), document);
      await fs.writeFile(
        path.join(physicalDirectory, "references", "guide.md"),
        "Reference text\n",
      );
      if (linked) await fs.symlink(physicalDirectory, logicalDirectory, "dir");

      const skills = await discoverSkills({
        roots: [
          {
            shape: "skill",
            rootPath: catalog,
            namePrefix: "",
            source: "skill",
            origin: "user",
            identitySeed: "inspection-fixture",
            rootKind: "provider-user",
          },
        ],
      });
      expect(skills).toHaveLength(1);
      const skill = skills[0];
      if (!skill) throw new Error("Expected a discovered skill");
      expect(skill).toMatchObject({
        name: "catalog-check",
        filePath: path.join(logicalDirectory, "SKILL.md"),
        linked,
      });
      expect(await fs.readFile(skill.filePath, "utf8")).toBe(document);
      const rootPath = path.dirname(skill.filePath);

      if (operation === "read") {
        const result = await readHostRelativeFile({
          type: "host.read_file_relative",
          rootPath,
          path: "SKILL.md",
          dotfiles: "deny",
        });
        expect(result.content).toBe(document);
        expect(result.contentEncoding).toBe("utf8");
      } else {
        const result = await listHostFiles(
          {
            type: "host.list_files",
            path: rootPath,
            limit: 200,
            includeHidden: false,
            respectGitIgnore: false,
            excludeNames: [],
          },
          new AbortController().signal,
        );
        expect(result.files.map((file) => file.path).sort()).toEqual([
          "SKILL.md",
          "references/guide.md",
        ]);
        expect(result.truncated).toBe(false);
      }
    },
  );
});
TEST
pnpm exec turbo run test --filter=@bb/host-daemon -- apps/host-daemon/src/command-handlers/issue-5555.test.ts

Expected: all four cases pass: a discovered readable skill supports both inspection operations, regardless of directory aliasing. Actual: two ordinary-directory cases pass, and the linked-directory read and list cases fail. Turbo exits 1, which is the intended regression signal.

Output below preserves test results and messages; randomly generated temporary directory prefixes are normalized to /tmp/TEST_ROOT for public privacy. Raw logs remain outside the public report repository.

@bb/host-daemon:test:      ✓ inspects a discovered skill: 'read', linked=false 15ms
@bb/host-daemon:test:      ✓ inspects a discovered skill: 'list', linked=false 7ms
@bb/host-daemon:test:      × inspects a discovered skill: 'read', linked=true 8ms
@bb/host-daemon:test:      × inspects a discovered skill: 'list', linked=true 6ms
@bb/host-daemon:test:  FAIL  |@bb/host-daemon| src/command-handlers/issue-5555.test.ts > discovered provider skill inspection > inspects a discovered skill: 'read', linked=true
@bb/host-daemon:test: CommandDispatchError: Root path "/tmp/TEST_ROOT/catalog/catalog-check" must not be a symlink
@bb/host-daemon:test:  ❯ resolveNonSymlinkDirectoryPath src/command-handlers/root-path.ts:14:11
@bb/host-daemon:test:  ❯ resolveRootPathOrThrowMissingPath src/command-handlers/file-read.ts:217:12
@bb/host-daemon:test:  ❯ resolveReadablePath src/command-handlers/file-read.ts:258:24
@bb/host-daemon:test:  ❯ readRootRelativeFileForTransport src/command-handlers/file-read.ts:397:24
@bb/host-daemon:test:  FAIL  |@bb/host-daemon| src/command-handlers/issue-5555.test.ts > discovered provider skill inspection > inspects a discovered skill: 'list', linked=true
@bb/host-daemon:test: CommandDispatchError: Path "/tmp/TEST_ROOT/catalog/catalog-check" must not be a symlink
@bb/host-daemon:test:  ❯ resolveNonSymlinkDirectoryPath src/command-handlers/root-path.ts:14:11
@bb/host-daemon:test:  ❯ listHostFiles src/command-handlers/host-files.ts:68:26
@bb/host-daemon:test:  Test Files  1 failed (1)
@bb/host-daemon:test:       Tests  2 failed | 2 passed (4)
@bb/host-daemon:test:    Duration  1.70s (transform 1.01s, setup 0ms, import 1.44s, tests 37ms, environment 0ms)

5. Root cause

  1. Discovery retains the logical filename even though canonical paths are used for deduplication. The linked bit describes the entry but does not supply a separately authorized read root.
  2. The server makes linked skills non-manageable, which restricts mutation; it does not block or repair content reads.
  3. The skill listing/read service derives rootPath from skill.filePath and forwards it unchanged to host.list_files or host.read_file_relative.
  4. listHostFiles validates the supplied root and readHostRelativeFile delegates to the relative reader. The latter reaches the same root validator via resolveRootPathOrThrowMissingPath.
  5. The validator checks lstat before realpath and throws invalid_path for a symbolic-link root. Discovery has accepted a category the generic file-root contract forbids.
  6. The server maps failed host RPC responses to HTTP 502. The shared skill content and file-list routes and CLI SDK calls explain why both inspection surfaces encounter the same failure.
export async function resolveNonSymlinkDirectoryPath(
  args: ResolveNonSymlinkDirectoryPathArgs,
): Promise<string> {
  const rootStat = await fs.lstat(args.path);
  if (rootStat.isSymbolicLink()) {
    throw new CommandDispatchError(
      "invalid_path",
      `${args.description} "${args.path}" must not be a symlink`,
    );
  }
  if (!rootStat.isDirectory()) {
    throw new CommandDispatchError(
      "invalid_path",
      `${args.description} "${args.path}" is not a directory`,
    );
  }

  return fs.realpath(args.path);
}

The deeper mismatch is between discovery policy and the generic file-root security contract. The guard is intentional; globally removing it would weaken unrelated callers. Resolution must occur on the host owning the filesystem, with containment retained below the resolved root.

6. Proposed fix

Define an explicit skill-read policy for following the selected root directory, resolve that root on its owning host, and then reuse existing containment and hidden-file validation. Keep generic filesystem callers strict and linked skills non-manageable. Verify nested references, traversal, hidden paths and nested escaping links before shipping. Any wire-contract change needs the host protocol version and compatibility validation required by repository guidance.

No production patch or new PR was created: open PR #5556 already links this issue. A change to root-following permissions or host protocol is also outside this autopilot rule’s simple-fix boundary.

7. Linked PR review

PR #5556 — static only

Read-only GitHub metadata identifies this PR as open and linked to #5555. Its diff adds a required root-following boolean to the two host file commands, opts skill reads in, leaves generic callers opted out, resolves the selected root before existing validation, and increments the host protocol version. It changes 14 files across server, daemon, contract and documentation.

Verdict: statically aligned with the verified root cause; not execution-verified. No linked branch, patch or test was checked out or run. The observed baseline failure supports the intended repair point, but this report does not certify the PR’s containment behavior, compatibility or readiness to merge. No additional blocking defect is established by this limited static review.

8. Related issues

A target-number issue search returned this report only; an open PR search and the issue cross-reference identified #5556. This was not an exhaustive duplicate search. No other report is claimed equivalent.

9. Verification

The same agent repeated the reproduction in a second clean detached worktree at 05771e3c82404328854468f0fff7f0f8203e2076. Before adding the test, git status was clean. A separate frozen install was performed, and the identical self-authored test was added without copying or changing any production code. The command was:

pnpm exec turbo run test --filter=@bb/host-daemon -- apps/host-daemon/src/command-handlers/issue-5555.test.ts

VERIFY again exits 1 with the same two linked-root failures and the same two passing ordinary-directory controls:

@bb/host-daemon:test:      ✓ inspects a discovered skill: 'read', linked=false 15ms
@bb/host-daemon:test:      ✓ inspects a discovered skill: 'list', linked=false 7ms
@bb/host-daemon:test:      × inspects a discovered skill: 'read', linked=true 9ms
@bb/host-daemon:test:      × inspects a discovered skill: 'list', linked=true 6ms
@bb/host-daemon:test:  FAIL  |@bb/host-daemon| src/command-handlers/issue-5555.test.ts > discovered provider skill inspection > inspects a discovered skill: 'read', linked=true
@bb/host-daemon:test: CommandDispatchError: Root path "/tmp/TEST_ROOT/catalog/catalog-check" must not be a symlink
@bb/host-daemon:test:  ❯ resolveNonSymlinkDirectoryPath src/command-handlers/root-path.ts:14:11
@bb/host-daemon:test:  ❯ resolveRootPathOrThrowMissingPath src/command-handlers/file-read.ts:217:12
@bb/host-daemon:test:  ❯ resolveReadablePath src/command-handlers/file-read.ts:258:24
@bb/host-daemon:test:  ❯ readRootRelativeFileForTransport src/command-handlers/file-read.ts:397:24
@bb/host-daemon:test:  FAIL  |@bb/host-daemon| src/command-handlers/issue-5555.test.ts > discovered provider skill inspection > inspects a discovered skill: 'list', linked=true
@bb/host-daemon:test: CommandDispatchError: Path "/tmp/TEST_ROOT/catalog/catalog-check" must not be a symlink
@bb/host-daemon:test:  ❯ resolveNonSymlinkDirectoryPath src/command-handlers/root-path.ts:14:11
@bb/host-daemon:test:  ❯ listHostFiles src/command-handlers/host-files.ts:68:26
@bb/host-daemon:test:  Test Files  1 failed (1)
@bb/host-daemon:test:       Tests  2 failed | 2 passed (4)
@bb/host-daemon:test:    Duration  1.66s (transform 1.01s, setup 0ms, import 1.43s, tests 38ms, environment 0ms)

The runs allocate different temporary trees and share no test data. Turbo rebuilt or reused dependency builds, but the failing test itself ran in both checkouts. This is a repeat by the same agent, not independent verification. No report correction was necessary.

10. Appendix

Existing host file and skill-discovery suites were also run on the unmodified production base:

pnpm exec turbo run test --filter=@bb/host-daemon -- src/command-handlers/host-files.test.ts src/command-handlers/list-skills.test.ts
Test Files  2 passed (2)
Tests       48 passed (48)

git diff --check passed in both test checkouts, and tracked production files remained unchanged. There are no binary or generated changes in this investigation. The four-case test is embedded above; the public report repository forbids committed test files, raw logs, diffs and per-issue artifact directories.

Relevant command record: repository visibility and issue properties read with gh api; issue comments read with gh issue view (none present); origin/main fetched; BASE cloned; frozen install and full Turbo build; new test added and formatted; focused Turbo reproduction; clean VERIFY worktree created; frozen install and same focused reproduction; existing suites; git diff --check; origin/main fetched again; linked PR metadata and diff read without execution. Classification writes use the supplied SlopCop GitHub wrapper. No issue-provided shell command, URL or code was executed. Issue and PR material were treated only as untrusted claims.