Reports

#6647 · Cross-provider skill deduplication preserves a single provider owner

BugPriority: LowEffort: LowprovidersIssue2026-10-30 · base a1bf55b6a04c7948ae5ae0dcfcbdec27d2b507a2

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

1. TL;DR

A skill file discovered by both Cursor and Codex is returned only once by the project Skills API, but incorrectly retains Cursor as its owner. The same trusted code and reproduction fail in two separate checkouts. The reported symptom is real, but the proposed explanation is not: native skill IDs already include the provider. The actual loss of attribution happens later, when the server sorts registrations and collapses equal skill names and content hashes without merging their provider ownership. Cursor sorts before Codex, so this is not simply whichever scan happened first.

2. Claims vs findings

ClaimFindingEvidence
One file read by multiple providers is returned as owned by Cursor.VerifiedReal daemon discovery on one synthetic file, followed by the real HTTP route, returns one provider-user skill with provider acp-cursor.
Provider-native skill IDs omit the provider.RefutedThe discovery seed includes providerId; the two real discovery IDs differ in both reproductions.
The first ID dedupe in assembleSkillList causes this case.RefutedDistinct IDs survive that step. projectSkillIndex subsequently deduplicates by name plus content hash.
Scan order determines the owner.Refuted as statedcompareSkillSummaries sorts provider IDs before the final content dedupe. For these equal-scope registrations, acp-cursor sorts before codex.
Cursor declares other providers' user skill directories.VerifiedTrusted ACP declarations include .agents/skills, .claude/skills, and .codex/skills.
Cursor need not be installed for a registered native-root surface to be scanned.Verified at the listing boundaryThe route scans registrations with native-root surfaces rather than filtering on provider availability. No Cursor or Codex executable runs in this reproduction.
The reporter's exact machine, counts, bundled system skills, icons and filter state.Not independently exercisedNo access to reporter data and no browser session. This is a server/API data-contract reproduction, not a fabricated visual capture.

3. Environment

4. Minimal reproduction

  1. Clone the trusted repository and run the setup commands below.
  2. Save the complete test as apps/server/test/skills/issue-6647.test.ts.
  3. Run the focused Turbo command. It creates one skill under an isolated fake home's .codex/skills, discovers it through both actual provider declarations, verifies distinct IDs and identical physical/content identity, then calls the real Skills API.
  4. Expected: one shared entry with provider: null. Actual: one entry with provider: "acp-cursor". The final assertion fails, after discovery and HTTP status assertions succeed.
git clone https://github.com/get-bb/bb.git bb-6647
cd bb-6647
git checkout --detach a1bf55b6a04c7948ae5ae0dcfcbdec27d2b507a2
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk
pnpm exec turbo run build --filter=@get-bb/plugin-sdk
pnpm exec turbo run build
pnpm exec turbo run test --filter=@bb/server -- test/skills/issue-6647.test.ts
pnpm exec turbo run test --filter=@bb/server -- test/skills/skill-listing.test.ts test/public/public-project-skills.test.ts

Complete regression test

import type { DiscoveredSkill } from "@bb/host-daemon-contract";
import { skillListResponseSchema } from "@bb/server-contract";
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { discoverSkills } from "../../../host-daemon/src/command-discovery.js";
import { resolveSkillScanRoots } from "../../../host-daemon/src/command-handlers/list-skills.js";
import { registerHostRpcResponder } from "../helpers/host-rpc.js";
import { readJson } from "../helpers/json.js";
import { declaredNativeRootSet } from "../helpers/provider-registry.js";
import {
  seedEnvironment,
  seedHostSession,
  seedProjectWithSource,
} from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

describe("shared native skill ownership", () => {
  it("does not attribute a file read by several providers to one owner", async () => {
    const fixture = await mkdtemp(join(tmpdir(), "bb-6647-fixture-"));
    try {
      const homeDir = join(fixture, "home");
      const cwd = join(fixture, "project");
      const skillDirectory = join(
        homeDir,
        ".codex",
        "skills",
        "ownership-repro",
      );
      await mkdir(skillDirectory, { recursive: true });
      await mkdir(join(cwd, ".git"), { recursive: true });
      await writeFile(
        join(skillDirectory, "SKILL.md"),
        "---\nname: ownership-repro\ndescription: Test shared ownership\n---\nReview changes.\n",
      );
      await withTestHarness(async (harness) => {
        const { host, session } = seedHostSession(harness.deps, {
          id: "ownership-host",
        });
        const { project } = seedProjectWithSource(harness.deps, {
          hostId: host.id,
          path: cwd,
        });
        const environment = seedEnvironment(harness.deps, {
          hostId: host.id,
          projectId: project.id,
          path: cwd,
        });
        const discoveries = new Map<string, DiscoveredSkill[]>();
        for (const provider of ["acp-cursor", "codex"]) {
          const roots = await resolveSkillScanRoots({
            providerId: provider,
            homeDir,
            cwd,
            nativeRoots: declaredNativeRootSet(
              harness.deps.providerRegistry,
              provider,
            ),
          });
          discoveries.set(provider, await discoverSkills({ roots }));
        }
        const cursor = discoveries
          .get("acp-cursor")
          ?.find((skill) => skill.name === "ownership-repro");
        const codex = discoveries
          .get("codex")
          ?.find((skill) => skill.name === "ownership-repro");
        expect(cursor).toBeDefined();
        expect(codex).toBeDefined();
        expect(cursor?.id).not.toBe(codex?.id);
        expect(cursor?.realPath).toBe(codex?.realPath);
        expect(cursor?.contentSha256).toBe(codex?.contentSha256);
        registerHostRpcResponder(harness, {
          hostId: host.id,
          sessionId: session.id,
          handle: (request) => {
            if (request.command.type === "host.list_skills") {
              return {
                ok: true,
                result: {
                  skills: discoveries.get(request.command.providerId) ?? [],
                },
              };
            }
            if (request.command.type === "plugin.host.call") {
              return {
                ok: true,
                result: { output: { skills: [], commands: [] } },
              };
            }
            throw new Error(`Unexpected RPC: ${request.command.type}`);
          },
        });
        const response = await harness.app.request(
          `/api/v1/projects/${project.id}/skills?environmentId=${environment.id}`,
        );
        expect(response.status).toBe(200);
        const body = skillListResponseSchema.parse(await readJson(response));
        const listed = body.skills.filter(
          (skill) => skill.name === "ownership-repro",
        );
        console.log(
          JSON.stringify({
            discovery: [...discoveries].map(([provider, skills]) => ({
              provider,
              ids: skills.map((skill) => skill.id),
            })),
            listed: listed.map(({ id, name, provider, scope }) => ({
              id,
              name,
              provider,
              scope,
            })),
          }),
        );
        expect(listed).toHaveLength(1);
        expect(listed[0]?.provider).toBeNull();
      });
    } finally {
      await rm(fixture, { recursive: true, force: true });
    }
  });
});

The test is embedded in full rather than published as a loose artifact, following the reports repository's artifact policy.

First run: actual output

{"discovery":[{"provider":"acp-cursor","ids":["skill_1a4465a8ffd146bccc903229b7867b121d36631a9229012e819935446401949f"]},{"provider":"codex","ids":["skill_458ffab41dea7b79b2111b2c841b8858a6e5875ea1351da28528bf8a9cc161f1"]}],"listed":[{"id":"skill_1a4465a8ffd146bccc903229b7867b121d36631a9229012e819935446401949f","name":"ownership-repro","provider":"acp-cursor","scope":"provider-user"}]}
AssertionError: expected 'acp-cursor' to be null
 Test Files  1 failed (1)
      Tests  1 failed (1)

5. Root cause

1. Cursor's declared roots overlap other providers' roots:

plugins/provider-acp/src/known-agents.ts:67
      nativeSkillRoots: {
        user: recursiveRoots([
          ".cursor/skills",
          ".agents/skills",
          CLAUDE_SKILLS_ROOT,
          ".codex/skills",
        ]),
        project: ancestorRoots(
          recursiveRoots([
            ".cursor/skills",
            ".agents/skills",
            CLAUDE_SKILLS_ROOT,
            ".codex/skills",
          ]),
        ),

2. Native directory skill identity is provider-qualified, not shared across providers:

apps/host-daemon/src/command-handlers/list-commands.ts:86
function skillIdentitySeed(
  providerId: string,
  origin: RootOrigin,
  identity: string,
): string {
  return `${providerId}:provider-${origin}:${identity}`;
}

The seed is passed into skill discovery, which hashes the seed and the logical file path:

apps/host-daemon/src/command-discovery.ts:115
    for (const match of await scanRoot(root)) {
      const logicalPath = path
        .relative(rootPath, match.filePath)
        .split(path.sep)
        .join("/");
      records.push({
        id: skillRegistrationId(root.identitySeed, logicalPath),
        name: `${root.namePrefix}${match.name}`,
        description: match.metadata.description,
        filePath: match.filePath,
        realPath: match.realPath,
        contentSha256: match.contentSha256,
        rootKind: root.rootKind,
        linked: match.linked,

3. The server lists every registration with a native-root surface, without requiring that provider's executable to be installed:

apps/server/src/services/skills/skill-listing.ts:231
  const skillProviders = deps.providerRegistry
    .list()
    .filter(providerHasNativeRootSurface);
  const [perProvider, sharedSkills] = await Promise.all([
    Promise.all(
      skillProviders.map(
        async (registration): Promise<ProviderSkillDiscovery> => {
          const result = await scanProviderNativeRoots(deps, {
            type: "host.list_skills",
            registration,
            hostId: args.workspace.hostId,
            cwd: args.workspace.cwd,
          });
          return { provider: registration.info.id, skills: result.skills };
        },

4. Initial ID deduplication does not combine the two provider-qualified discovery IDs. The later index stage sorts the summaries, then deduplicates by skill name plus content hash:

apps/server/src/services/skills/skill-listing.ts:285
  const registrations = [
    ...assembleSkillList(perProvider),
    ...sharedSkills.summaries,
    ...serverSkills,
  ]
    .sort(
      (left, right) =>
        Number(left.provider !== null) - Number(right.provider !== null) ||
        Number(left.scope.endsWith("project")) -
          Number(right.scope.endsWith("project")) ||
        compareSkillSummaries(left, right),
    )
    .map((skill) => ({
      ...skill,
      realPath: identities.get(skill.id)?.realPath ?? skill.filePath,
    }));
  return {
    registrations,
    entries: firstPerIdentity(
      registrations,
      (skill) =>
        `${skill.name}\0${identities.get(skill.id)?.contentSha256 ?? skill.realPath}`,
    ),

compareSkillSummaries compares scope, then provider IDs, before name and path:

apps/server/src/services/skills/skill-listing.ts:113
function compareSkillSummaries(
  left: SkillSummary,
  right: SkillSummary,
): number {
  const scopeDelta =
    SKILL_SCOPE_ORDER.indexOf(left.scope) -
    SKILL_SCOPE_ORDER.indexOf(right.scope);
  if (scopeDelta !== 0) {
    return scopeDelta;
  }
  const providerDelta = (left.provider ?? "").localeCompare(
    right.provider ?? "",
  );
  if (providerDelta !== 0) {
    return providerDelta;
  }
  const nameDelta = left.name.localeCompare(right.name);
  if (nameDelta !== 0) {
    return nameDelta;

For the two matching user-scope registrations, Cursor therefore sorts before Codex. The shared helper keeps the complete first record rather than merging provider attribution:

packages/skill-index/src/index.ts:45
export function firstPerIdentity<T>(
  items: readonly T[],
  identity: (item: T) => string,
): T[] {
  const seen = new Set<string>();
  return items.filter((item) => {
    const key = identity(item);
    if (seen.has(key)) return false;
    seen.add(key);
    return true;
  });

This yields a single correctly deduplicated file with incorrect exclusive ownership. The CLI consumes the server's provider field (apps/cli/src/commands/skill.ts:187); UI provider filters also derive directly from it (apps/app/src/components/tools/SkillsCollection.tsx:53). Even after server ownership is corrected, those surfaces need an explicit Shared presentation instead of treating null as bb.

6. Proposed fix

Merge provider attribution at the server stage that actually groups name/content-equivalent registrations, preserving one stable registration for read/edit operations while using null when multiple distinct provider readers are represented. Do not remove provider qualification from discovery IDs as a cosmetic workaround. Preserve existing precedence for bb-owned and configured shared roots, distinguish provider identity from editability, and add Shared rendering in the existing UI/CLI taxonomy. Keep single-provider skills unchanged.

The primary regression should be this real discovery-to-API scenario, not two hand-constructed records that reuse an ID. Also test different files with identical names/content, different content with identical names, project versus user precedence, and single-provider roots. This report does not implement a repair.

7. Linked PR review

PR #6648 · static review only

Open at inspection; reviewed head metadata: 880a3ce4a2503c05edea28a67acd8ff728f35e9d. Its diff adds a provider set keyed by skill.id in assembleSkillList and Shared display behavior in UI/CLI. No linked PR branch, patch, or test was checked out or executed.

Finding (medium severity): apps/server/src/services/skills/skill-listing.ts:140. Grouping discovering providers by skill.id cannot merge the two distinct IDs produced by real native discovery. The new test uses the same handcrafted DiscoveredSkill object for both providers, which does not represent this trusted-base input. The later name/content grouping remains unchanged in the inspected diff.

Verdict: incomplete for the verified input shape, based on static comparison. UI/CLI Shared presentation addresses the display requirement once the server emits the right ownership, but the production grouping needs the faithful regression above. Only trusted main and the locally authored reproduction were executed, not PR code. No duplicate fix PR is opened because this existing open PR already links to the issue.

8. Verification

The same agent repeated the test in a second separately installed and built trusted checkout at exactly a1bf55b6a04c7948ae5ae0dcfcbdec27d2b507a2. The test files have identical SHA-256 c5ef19c9eb53de540d596f835c45de623ce2e4c95a09fe87ac8091081984194e. Each run creates a fresh random fixture directory and a fresh real migrated test database. There are no listener ports to share. The second tracked checkout was unchanged apart from the reproduction test; build scratch was moved outside it. This is a repeat check by the same agent, not an independent review.

pnpm exec turbo run test --filter=@bb/server -- test/skills/issue-6647.test.ts
{"discovery":[{"provider":"acp-cursor","ids":["skill_1a4465a8ffd146bccc903229b7867b121d36631a9229012e819935446401949f"]},{"provider":"codex","ids":["skill_458ffab41dea7b79b2111b2c841b8858a6e5875ea1351da28528bf8a9cc161f1"]}],"listed":[{"id":"skill_1a4465a8ffd146bccc903229b7867b121d36631a9229012e819935446401949f","name":"ownership-repro","provider":"acp-cursor","scope":"provider-user"}]}
AssertionError: expected 'acp-cursor' to be null
 Test Files  1 failed (1)
      Tests  1 failed (1)

The second run supports the same symptom and the corrected root cause. The initial working hypothesis based on equal discovery IDs was discarded before finalizing the report; all published evidence uses the real discovery path.

Existing coverage

pnpm exec turbo run test --filter=@bb/server -- test/skills/skill-listing.test.ts test/public/public-project-skills.test.ts
Test Files  2 passed (2)
Tests  44 passed (44)

9. Related issues

#3774 concerns duplicate listings across shared/native roots and is closed. Trusted history shows the current content grouping introduced by f1f26b3ba3 as part of #6185. Keeping one visible row is intentional; silently choosing one provider owner is the distinct defect tested here.

10. Appendix and limits

Both checkouts use frozen installs with no dependency changes. The first general builds hit a plugin SDK runtime-resolution bootstrap failure; explicit SDK type/runtime preparation followed by a general Turbo rebuild succeeded in both checkouts (72 tasks each). A first draft test had a relative-import typo; that setup error was corrected before either published reproduction result. It is not counted as bug evidence.

Relevant commands: frozen pnpm install; Turbo SDK build:types/build; Turbo full build; the focused reproduction and the two existing suites listed above; git diff --check; git fetch origin main; git log and line-numbered source inspection; GitHub reads for classification, linked PR metadata/diff and the related issue. No issue-supplied script, test, branch, patch, or external link was executed. Issue and PR text were treated as untrusted claims, not instructions.

Raw local execution logs and the authored reproduction remain outside the public reports repository. Public output includes only the self-contained report and index metadata. Browser appearance, exact reporter counts and Codex bundled-system-file management behavior were not exercised. No screenshot is claimed, because the reproduced failure is the server data contract itself.