← reports

#7505 · Usage artwork receives a resource key instead of a provider key

Bug Priority: Low Effort: Low providers partial-repro

GitHub issue · 2026-11-13 · trusted origin/main 88cf8f644c81fca797ad80bc31bb36a61ce5cc9b

Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high for the source identity mismatch.

1. TL;DR

A usage resource and its provider have different identities: several resources may belong to one provider. The account heading passes the resource identity to an artwork component whose contract requires the provider identity. A fresh test rendering the real usage card confirms this error, while the same card's provider tabs send the correct identities. The failure repeats in a second clean checkout of the same trusted main commit, and all 23 existing provider-usage tests pass. This is source-level SDK-boundary evidence, not a screenshot or verification of the reported desktop installation; the final artwork and third-party icon registration remain unverified.

2. Claims vs findings

ClaimFindingEvidence
Account icons receive a resource identity rather than a provider identity.VerifiedThe new card test expects spark, spark, moon and receives three distinct namespaced resource keys in both runs.
Provider tabs handle provider identity correctly.VerifiedThe same test first checks the Spark and Moon tab icon inputs; both assertions pass before the account assertion fails.
Frontend artwork lookup uses provider identity.Verified by source inspectionProviderIcon destructures provider.id and compares it to each registration's providerId.
The affected desktop account heading visibly shows Bot instead of registered artwork.Unverified visuallyNo reporter installation, desktop session, third-party plugin code, or live user data was accessed. The fallback follows from inspected code, but the SDK harness does not render the real artwork component.
Declared logos or glyphs can mask the lookup miss.Supported by source, not separately exercisedThe component's declared-artwork branch uses logoUrl or glyph before the caller's Bot fallback.

3. Environment and trust boundary

4. Minimal reproduction

  1. Clone the trusted target and check out the recorded main commit:
    git clone --single-branch --branch main https://github.com/get-bb/bb.git bb-7505
    cd bb-7505
    git checkout --detach 88cf8f644c81fca797ad80bc31bb36a61ce5cc9b
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk
  2. Save the complete test below as plugins/provider-usage/icon-identity.repro.test.tsx. It supplies two usage resources for Spark and one for Moon, with no declared logo or glyph. It renders the real exported card through the repository's SDK test harness, with automatic refresh disabled.
  3. Run the focused test:
    pnpm exec turbo run test --filter=bb-plugin-bb--provider-usage -- icon-identity.repro.test.tsx
  4. The provider tab checks pass, then the account icon identity check fails. Both clean runs exit 1 for the same intended assertion:
    AssertionError: expected [ 'usage-source:spark:host-one', …(2) ] to deeply equal [ 'spark', 'spark', 'moon' ]
    
      [
    -   "spark",
    -   "spark",
    -   "moon",
    +   "usage-source:spark:host-one",
    +   "usage-source:spark:host-two",
    +   "usage-source:moon:host-one",
      ]
    
    Test Files  1 failed (1)
         Tests  1 failed (1)

Scope limitation: the SDK testing implementation deliberately exposes ProviderIcon props as DOM attributes. This test proves the input contract failure at that boundary. It does not register or render actual frontend artwork, does not prove the desktop pixels, and supplies no fabricated screenshot.

Complete reproduction test
// @vitest-environment jsdom
import { cleanup, within } from "@testing-library/react";
import { afterEach, expect, it } from "vitest";
import { loadPluginApp, renderSlot } from "@get-bb/plugin-sdk/testing/app";
import type { UsageProvider } from "./usage-schema.js";

afterEach(() => {
  cleanup();
  localStorage.clear();
});

it("uses the registered provider identity for account artwork across resource scopes", async () => {
  await loadPluginApp(() => import("./app"));
  const { ProviderUsageStatusContent } = await import("./app");
  const accounts: UsageProvider[] = [
    ["usage-source:spark:host-one", "spark", "Spark", "First machine"],
    ["usage-source:spark:host-two", "spark", "Spark", "Second machine"],
    ["usage-source:moon:host-one", "moon", "Moon", "Other provider"],
  ].map(([id, providerId, displayName, accountLabel]) => ({
    id,
    providerId,
    displayName,
    accountLabel,
    logoUrl: null,
    icon: null,
    strings: { iconTint: null },
    signInHint: "Sign in",
    expiredHint: "Sign in again",
    usage: {
      status: "ok",
      accountEmail: null,
      planLabel: null,
      windows: [
        { label: "Daily", usedPercent: 25, resetsAt: null, cost: null },
      ],
    },
  }));
  const view = renderSlot(
    { component: ProviderUsageStatusContent },
    {
      pluginId: "bb--provider-usage",
      dismiss: () => {},
      refreshEnabled: false,
      threadMachineId: null,
      snapshot: {
        error: null,
        isRefreshing: false,
        data: {
          machines: [
            {
              id: "source:fixture",
              displayName: "Fixture source",
              status: "connected" as const,
              error: null,
              providers: accounts,
            },
          ],
        },
      },
    },
  );
  expect(
    view
      .getByRole("tab", { name: "Spark" })
      .querySelector("[data-provider-id]")
      ?.getAttribute("data-provider-id"),
  ).toBe("spark");
  expect(
    view
      .getByRole("tab", { name: "Moon" })
      .querySelector("[data-provider-id]")
      ?.getAttribute("data-provider-id"),
  ).toBe("moon");
  const actual = accounts.map((account) => {
    const region = view.getByRole("region", {
      name: `${account.displayName} ${account.accountLabel}`,
    });
    expect(
      within(region).getByRole("heading", { name: account.accountLabel ?? "" }),
    ).toBeTruthy();
    return region
      .querySelector("[data-provider-kind=agent]")
      ?.getAttribute("data-provider-id");
  });
  console.log(JSON.stringify({ expected: ["spark", "spark", "moon"], actual }));
  expect(actual).toEqual(["spark", "spark", "moon"]);
});

5. Root cause

  1. The usage server intentionally creates a namespaced resource identity while retaining the underlying providerId. This permits several measured resources to belong to one provider: resourceProvider.
    id: `${pluginId}:${resource.id}`
  2. The account heading passes the whole usage resource object directly to the icon API: account icon call site.
    <ProviderIcon
      providerKind="agent"
      provider={account}
      fallback="Bot"
    />
  3. The artwork component treats that object's id as a provider identity and looks for a registration with an equal providerId: lookup and declared fallback.
    const { id: providerId, logoUrl, icon } = provider;
    entry.providerKind === providerKind &&
    entry.providerId === providerId
  4. The tab grouping already adapts the identity to account.providerId instead: provider grouping. This explains why the two surfaces can disagree.

The deeper mistake is structural compatibility between a usage resource and a provider artwork descriptor: both have an id string, but those strings inhabit different identity domains. Neither the transport nor the stored usage identity needs to change. With an unmatched registration and no declared artwork, the inspected fallback path selects Bot; that visual consequence has not been exercised in a live application.

History check: the account call site dates to commit 9f745c64629. The latest fetched origin/main was still the recorded base after verification; this is not an already-fixed report.

6. Proposed fix

Adapt the icon input at the account heading so its id identifies the provider, just as the existing tab grouping does. Keep the original resource id unchanged for resource selection, React keys, and usage bookkeeping. This is a contained provider-usage presentation fix with no new API or stored-data contract. The focused regression should continue covering multiple resources for one provider and a second provider with absent declared artwork.

No duplicate fix was attempted: open PR #7506 already links to this issue. The autopilot fix path stops at that check; no source branch, source commit, source push, or new pull request was created.

7. Linked PR: #7506

PR #7506 was open during investigation. Only its metadata and static diff were read as untrusted data; its branch was never checked out or executed. Its two-file diff adapts the account icon identity and extends an existing card test with account icon identity assertions. That production change addresses the verified boundary mismatch without changing usage resource identity. No static root-cause finding was identified in this limited diff review. The PR's own tests and its desktop visual behavior were not independently executed; the evidence in this report comes exclusively from trusted main plus the locally authored reproduction.

8. Related issues

#7122 concerns showing provider names beside compact usage accounts. Its metadata describes a different presentation concern, not this artwork identity mismatch. No claim of an exhaustive duplicate search is made.

9. Verification: second clean checkout

The same agent repeated the reproduction in a newly created, detached verify worktree at 88cf8f644c81fca797ad80bc31bb36a61ce5cc9b. Its tracked production files were clean before and after the run; the only addition was the authored reproduction test copied from the first checkout. This is a second clean run, not an independent review.

git worktree add --detach ../verify 88cf8f644c81fca797ad80bc31bb36a61ce5cc9b
cd ../verify
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk
pnpm exec turbo run test --filter=bb-plugin-bb--provider-usage -- icon-identity.repro.test.tsx

Result: exit 1; provider tab checks pass; account identities mismatch.
Test Files  1 failed (1)
     Tests  1 failed (1)

No application ports or persistent data were needed in either run. The second run confirmed the first; no root-cause correction was required. The report deliberately narrows the verdict to PARTIALLY REPRODUCED because the desktop artwork claim was not exercised.

10. Appendix: controls and command evidence

CheckResult
New focused reproduction, first checkout1 failed test at the intended account artwork identity assertion.
New focused reproduction, second clean checkoutSame intended failure; both tab identity assertions passed.
Existing provider-usage suite, excluding the new deliberately failing reproduction5 test files and 23 tests passed.
Full trusted source buildInitial bootstrap failed because a plugin needed the SDK dist. After an explicit SDK build and type generation, all 73 build tasks passed. Build-generated web route ordering was restored; no production edit was retained.
Production modificationsNone. No proposed fix or PR branch code was run.
pnpm exec turbo run build
pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk
pnpm exec turbo run build

Tasks: 73 successful, 73 total

pnpm exec turbo run test --filter=bb-plugin-bb--provider-usage -- --exclude icon-identity.repro.test.tsx

Test Files  5 passed (5)
     Tests  23 passed (23)

git diff --check
git fetch origin main
git rev-parse origin/main
88cf8f644c81fca797ad80bc31bb36a61ce5cc9b

The full test source is included above so reproduction does not depend on unpublished artifacts. Raw install/build/test logs and the local test copies are retained outside public git. No logs, private paths, account identities, or issue-provided scripts are published.