← reports

#8036 · Usage resources lose registered provider metadata without native usage support

BugPriority: LowEffort: LowprovidersIssue2026-11-23 · base 796cdcc0f4bf8a55e23664035c54e8db6fe9d272

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

1. TL;DR

A usage source can contribute a resource for an agent that has no native usage implementation. The real Provider Usage server entry loads and returns that resource, but asks the registry for metadata only for native usage-capable providers. Consequently its RPC response substitutes the provider ID for the name and returns null for the icon and logo. A focused regression reproduces those exact incorrect values in two clean trusted checkouts. Reading the complete provider registry fixes both global and host-selected requests without creating cards for providers that have no resource.

2. Claims vs findings

ClaimStatusEvidence
Externally supplied resources lose registered name and icon when the agent has no native usage.VerifiedBoth regression cases return displayName external-agent, icon null, and logoUrl null on the trusted base.
Metadata resolution is incorrectly limited to the native usage capability.VerifiedreadUsage filters the provider list before resourceProvider joins by providerId.
The broader metadata list should not create empty provider entries.VerifiedThe fixture includes a second registered provider without a resource. After the repair the snapshot still has exactly one machine and one provider entry.
Enabling native ACP usage to work around display metadata can create a second failing source.Unverified at runtimeThe ACP source statically lists usage-capable ACP providers and fetches system usage; no live custom agent or account was exercised.
The specific reported desktop UI exhibits this presentation.UI not exercisedThe settings code consumes the affected fields, but this report demonstrates the server RPC contract rather than a screenshot or live account session.

3. Environment

4. Minimal reproduction

  1. Check out the pinned public repository commit and build the normal trusted dependencies.
  2. Apply the agent-authored regression patch (not issue-supplied code), then run the focused test:
git clone https://github.com/get-bb/bb.git bb-8036
cd bb-8036
git checkout 796cdcc0f4bf8a55e23664035c54e8db6fe9d272
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk
pnpm exec turbo run build
curl -fsS https://get-bb.github.io/reports/issues/8036/repro/regression.patch -o /tmp/8036-regression.patch
git apply /tmp/8036-regression.patch
pnpm exec turbo run test --filter=bb-plugin-bb--provider-usage -- server.test.ts -t 'resolves resource metadata'

The registry fixture returns a named, icon-bearing external agent only when no native usage filter is requested, matching the server registry contract. The source contributes exactly one host-scoped resource. The table covers a global request and a request selecting that host.

Expected metadata:

displayName: "External Agent"
icon: { glyph: "external/agent" }
logoUrl: "/external-agent.svg"

Actual trusted-base metadata, from both assertion diffs:

displayName: "external-agent"
icon: null
logoUrl: null
Tests  2 failed | 3 skipped (5)

Regression patch · Standalone test source · First baseline failure · Second baseline failure

Complete focused regression test
import { expect, it, vi } from "vitest";
import {
  createFakePluginHost,
  makeHostResponse,
} from "@get-bb/plugin-sdk/testing";
import plugin from "./server.js";
import { usageListMethod, usageFetchMethod } from "./usage-source-contract.js";

it.each([{ machineIds: null }, { machineIds: ["host"] }])(
  "resolves resource metadata without native usage support for $machineIds",
  async ({ machineIds }) => {
    const host = createFakePluginHost({
      pluginId: "provider-usage",
      sdk: {
        system: { config: async () => ({ primaryHostId: null }) },
        hosts: {
          list: async () => [
            makeHostResponse({ id: "host", status: "connected" }),
          ],
        },
        providers: {
          list: async (input) =>
            input?.capability === "usage" ||
            (machineIds !== null && input?.hostId !== "host")
              ? []
              : [
                  {
                    id: "external-agent",
                    displayName: "External Agent",
                    logoUrl: "/external-agent.svg",
                    icon: { glyph: "external/agent" },
                  },
                  {
                    id: "unused-agent",
                    displayName: "Unused Agent",
                    logoUrl: null,
                  },
                ],
        },
        plugins: {
          experimental_discoverRpc: async () => [
            {
              pluginId: "quota",
              displayName: "Quota",
              method: usageListMethod,
            },
          ],
          callRpc: async () => ({
            resources: [
              {
                id: "account",
                providerId: "external-agent",
                scope: { kind: "host", hostId: "host", hostName: "Host" },
              },
            ],
          }),
        },
      },
    });
    plugin(host.bb);
    try {
      const snapshot = await host.harness.behavior.callRpc("getUsage", {
        force: false,
        machineIds,
        providerIds: [],
        maxAgeMs: 0,
      });
      expect(snapshot).toMatchObject({
        machines: [
          {
            providers: [
              {
                providerId: "external-agent",
                displayName: "External Agent",
                logoUrl: "/external-agent.svg",
                icon: { glyph: "external/agent" },
              },
            ],
          },
        ],
      });
    } finally {
      await host.harness.lifecycle.dispose();
    }
  },
);

5. Root cause

The provider registry filter implements the usage capability as provider.maintenance.usage. That is a native maintenance capability, not a requirement for another plugin to supply usage resources.

In readUsage, source discovery and provider metadata are fetched independently, but the metadata request unnecessarily includes that usage filter:

bb.sdk.providers.list(
  hostId === undefined
    ? { capability: "usage" }
    : { capability: "usage", hostId },
)

resourceProvider searches that incomplete array by provider ID. If the match is absent, its fallback uses the ID as displayName and no logo; normalizedProvider also defaults the missing icon to null. The resource is not absent: source inventory remains the driver of visible entries.

The resource assembly loop creates provider entries from source resources, not registry entries. The settings view passes provider.displayName as the heading and feeds the returned provider into ProviderIcon. This statically explains the reported presentation; it is not a claim of browser verification.

The ACP native source has its own usage-capability filter. Removing the aggregator's metadata filter does not alter native source eligibility.

6. Proposed fix and verified result

Fetch all registered providers for display metadata, retaining the existing hostId selection. Leave source discovery and provider-owned native usage checks unchanged. Keep the fallback for resources whose provider really is not registered. This is one existing subsystem, two files, 85 changed text lines (80 additions and 5 deletions), with no dependency, schema, protocol, stored-data, packaging, or public API change.

pnpm exec turbo run test --filter=bb-plugin-bb--provider-usage -- server.test.ts -t 'resolves resource metadata'
# 2 passed; 3 existing cases skipped by the name filter
pnpm exec turbo run test lint typecheck --filter=bb-plugin-bb--provider-usage
# 5 test files, 25 tests passed; lint and typecheck passed

Lint reports one pre-existing React immutability warning in app.tsx; there are zero lint errors. Focused post-fix log · Full subsystem checks · Full trusted-base build summary. No production export or test-only seam was added. Existing tests did not catch the defect because their provider list fixture ignored capability filtering or returned no providers.

7. Verification

The same agent repeated the reproduction in a second clean temporary checkout; this was not independent verification. That checkout was detached at 796cdcc0f4bf8a55e23664035c54e8db6fe9d272, had a separate frozen install, and its only tracked change was the agent-authored regression test. The production server.ts was unchanged. No live process required ports or a data directory.

git worktree add --detach verify 796cdcc0f4bf8a55e23664035c54e8db6fe9d272
cd verify
pnpm install --frozen-lockfile --prefer-offline
# Apply the same saved regression.patch, then:
pnpm exec turbo run test --filter=bb-plugin-bb--provider-usage -- server.test.ts -t 'resolves resource metadata'
# Actual: 2 failed | 3 skipped (5); same metadata assertion mismatch

The second run supports the same root cause, with no report correction needed. During test authoring, the icon fixture was corrected to the repository's glyph-object contract and the assertion was changed to match the RPC's unknown boundary safely. The published artifact and both final baseline logs use that final fixture. The later repair passes the exact same focused test in the first checkout. All code permalinks refer to the pinned trusted base and were checked against that revision.

8. Related issues and pull requests

GitHub issue timeline cross-references and an open-PR search for issue 8036 were checked before implementation: no linked open pull request existed. No linked branch was checked out or executed. No related issue is needed to explain this isolated metadata failure.

9. Appendix and limits

The linked logs contain the executed commands, assertion diffs, test counts, and check summaries; absolute checkout/home paths are sanitized. This is a deterministic server-contract reproduction, not a live desktop screenshot. Real third-party account quota collection and the duplicate-card workaround are not runtime-verified. The broader metadata lookup's existing API error fallback and native-source policies are unchanged.

Trust boundary: issue content, including suggested code, was treated only as untrusted claims. The test and fix were authored from trusted origin/main repository evidence; no issue-provided script, patch, binary, linked branch, or external URL was executed.