← reports

#5345 · Pre-provisioning provider discovery falls back to the primary machine

BugPriority: MediumEffort: Highproviders · workspaces · provider-acpGitHub issueOctober 10, 2026

Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high for the provider-discovery path.

Trusted public repository: get-bb/bb · base 3912f4aaefb7dff55c7e0cb5003b26b5cf1457dc

1. TL;DR

A new machine does not yet have a host ID, but the New Thread composer treats its provider discovery as an ordinary unscoped request. The server consequently asks the primary machine which installed-only agents are available, rather than describing the machine that will be provisioned. When that primary machine lacks an agent, the agent is absent from the returned list; the same agent appears once discovery targets a connected machine that has it. Two clean trusted checkouts reproduce this server response difference. The custom image, actual provisioner, rendered picker, and real agent process were not exercised, so the full reported UI workflow is only partially reproduced.

2. Claims vs findings

ClaimFindingEvidence
The built-in omp agent is visible only when installed.VerifiedTrusted built-in declaration and registration assertion.
A new-machine picker resolves against the primary machine.Verified mechanismComposer returns an empty routing query for a non-existing machine; the real server route returns the same provider roster as the primary-host query.
The agent becomes selectable once the target machine exists and has it.Verified at API boundaryAfter seeding a connected target with a ready health response, host-scoped discovery includes acp-omp.
All provider-based selections use the primary machine.Needs qualificationThe composer has a routing override: existing-machine selections send their host ID. The reported fallback is specifically the new-machine case, not every provider selection.
An explicit provider can bypass normal discovery filtering.Verified in source onlyThe execution-options path appends a registered requested provider. No real CLI turn or custom model was executed.
A custom provisioner ships the executable and works end to end.UnverifiedNo custom image, environment plugin, or real ACP process was supplied or run. Health responses are controlled host-boundary fixtures.
The same defect affects other installed-only agents and the older release.Not separately executedThe filter is shared, but the diagnostic runs target acp-omp at the recorded main commit only.

3. Environment

4. Minimal reproduction

  1. Clone the trusted repository, pin the recorded commit, install its locked dependencies, and build it.
  2. Save the authored diagnostic test at the path shown below.
  3. Run the focused Turbo test. It sets the primary machine as missing the agent and requests the same empty query used by the composer for a new machine. Only afterward does it create a connected target whose health response advertises the agent, providing a positive control.
git clone --branch main --single-branch https://github.com/get-bb/bb.git bb-5345
cd bb-5345
git checkout --detach 3912f4aaefb7dff55c7e0cb5003b26b5cf1457dc
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build
curl -fL https://get-bb.github.io/reports/issues/5345/repro/issue-5345-repro.test.ts -o apps/server/test/system/issue-5345-repro.test.ts
pnpm exec turbo run test --filter=@bb/server -- test/system/issue-5345-repro.test.ts

Expected requested product behavior: the pre-provisioning picker can offer an agent known to exist on the future machine without exposing it on existing machines where it is absent. Today's query has no way to express that knowledge, which is the underlying gap.

Actual response in both runs:

{
  "unscoped": ["codex", "claude-code", "pi", "acp-cursor"],
  "primaryScoped": ["codex", "claude-code", "pi", "acp-cursor"],
  "targetScoped": ["codex", "claude-code", "pi", "acp-cursor", "acp-omp"]
}

Both existing-host controls pass. The last assertion then fails:

AssertionError: expected [ 'codex', 'claude-code', 'pi', …(1) ] to include 'acp-omp'
expect(unscoped).toContain("acp-omp");
Test Files  1 failed (1)
Tests       1 failed (1)
exit status 1

This final assertion is a diagnostic encoding the requested behavior, not a ready-to-land regression test against a supported future-machine API. It deliberately exposes the missing contract; it does not claim that an ordinary unscoped server request should list every globally registered provider.

Complete diagnostic test
import { describe, expect, it } from "vitest";
import { systemProviderInfoSchema } from "@bb/server-contract";
import { registerHostRpcResponder } from "../helpers/host-rpc.js";
import { seedHostSession, seedPrimaryHost } from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

describe("issue 5345: discovery before a target machine exists", () => {
  it("cannot offer an installed-only target agent with the unscoped new-machine query", async () => {
    await withTestHarness({}, async (harness) => {
      const primary = seedHostSession(harness.deps, { id: "repro-primary" });
      seedPrimaryHost(harness.deps, primary.host.id);
      const registration = harness.deps.providerRegistry.get("acp-omp");
      expect(registration?.visibility).toBe("installed");

      const registerHealth = (
        machine: ReturnType<typeof seedHostSession>,
        hasAgent: boolean,
      ) => {
        registerHostRpcResponder(harness, {
          hostId: machine.host.id,
          sessionId: machine.session.id,
          handle: (request) => {
            if (request.command.type !== "provider.health") {
              throw new Error(`Unexpected command ${request.command.type}`);
            }
            const installed =
              hasAgent && request.command.providerId === "acp-omp";
            return {
              ok: true,
              result: {
                supported: true,
                health: {
                  status: installed ? "ready" : "not_installed",
                  statusMessage: null,
                  accountEmail: null,
                  planLabel: null,
                  installedVersion: null,
                  minimumSupportedVersion: null,
                  canInstall: false,
                  canUpdate: false,
                  loginCommand: null,
                },
              },
            };
          },
        });
      };
      registerHealth(primary, false);

      const list = async (query: string) => {
        const response = await harness.app.request(
          `/api/v1/system/providers${query}`,
        );
        expect(response.status).toBe(200);
        return systemProviderInfoSchema
          .array()
          .parse(await response.json())
          .map((provider) => provider.id);
      };
      const unscoped = await list("");
      const primaryScoped = await list("?hostId=repro-primary");
      const target = seedHostSession(harness.deps, { id: "repro-created-target" });
      registerHealth(target, true);
      const targetScoped = await list("?hostId=repro-created-target");
      console.log(
        JSON.stringify({ unscoped, primaryScoped, targetScoped }, null, 2),
      );

      expect(primaryScoped).not.toContain("acp-omp");
      expect(targetScoped).toContain("acp-omp");
      expect(unscoped).toContain("acp-omp");
    });
  });
});

5. Root cause

The primary mechanism is loss of target context before provider discovery. A non-existing machine selection is converted to an empty routing object by the real composer:

apps/app/src/components/promptbox/NewThreadComposer.tsx:817

817:       const providerSelection = resolveProviderSelection(effectiveValue);
818:       if (providerSelection !== null) {
819:         return providerSelection.machine?.type !== "existing"
820:           ? {}
821:           : { hostId: providerSelection.machine.hostId };
822:       }
823:       const parsed = parseEnvironmentValue(effectiveValue);
824:       return parsed?.type === "reuse" && parsed.environmentId !== null
825:         ? { environmentId: parsed.environmentId }
826:         : {};

The empty query reaches a lookup that falls back to the connected primary host:

apps/server/src/services/system/host-lookup.ts:14

14: export function resolveSystemLookupHostId(
15:   deps: WorkSessionDeps,
16:   query: SystemHostLookupQuery,
17: ): string {
18:   if (query.environmentId) {
19:     const environment = requireEnvironment(deps.db, query.environmentId);
20:     assertUsableHostId(deps, { hostId: environment.hostId });
21:     return environment.hostId;
22:   }
23:   if (query.hostId) {
24:     assertUsableHostId(deps, { hostId: query.hostId });
25:     return query.hostId;
26:   }
27:   return requireConnectedPrimaryHostId(deps);
28: }

The agent is installed-only:

plugins/provider-acp/src/known-agents.ts:115

115:     id: "acp-omp",
116:     displayName: "omp",
117:     icon: declaredIcon("omp"),
118:     iconTint: { light: "#9333EA", dark: "#9333EA" },
119:     signInCommand: "omp login",
120:     installUrl: "https://github.com/can1357/omp",
121:     visibility: "installed",

Configured listings include only always-visible registrations. Installed-only registrations require a host-specific health response; not_installed is excluded:

apps/server/src/services/system/execution-options.ts:123

123:   return deps.providerRegistry
124:     .list()
125:     .filter(
126:       (entry) =>
127:         !disabled.has(entry.info.id) &&
128:         entry.visibility === "always" &&
129:         providerMatchesFilter(entry.info, filter),
130:     )
131:     .map((entry) => entry.info);

apps/server/src/services/system/execution-options.ts:181

181:       const cacheKey: ProviderHealthCacheKey = {
182:         hostId,
183:         providerId: registration.info.id,
184:       };
185:       const probe = async (probeBudget: ProviderListingBudget) => {
186:         const result = await callHostRetryableOnlineRpc(deps, {
187:           hostId,
188:           timeoutMs: probeBudget.remainingMs(),
189:           command: {
190:             type: "provider.health",
191:             providerId: registration.info.id,
192:             bridgeLaunch,
193:           },
194:         });
195:         return result.supported && result.health.status !== "not_installed";

The underlying missing contract is broader than a filtering typo: the discovery query accepts existing host/environment selectors only, and the public environment-provider definition exposes no future-agent guarantee. The server cannot infer which executables an arbitrary image will contain.

packages/server-contract/src/api/system.ts:85

85:   hostId: z.string().min(1),
86:   environmentId: z.string().min(1),
87: } as const;
88: 
89: export const systemProvidersQuerySchema = z
90:   .object({
91:     ...systemProviderHostQueryFields,
92:     capability: z.enum(["usage"]),
93:   })
94:   .partial()
95:   .superRefine(rejectMultipleWorkspaceSelectors);
96: export type SystemProvidersQuery = z.infer<typeof systemProvidersQuerySchema>;

Environment-provider public definition. Requested registered providers can be appended separately, explaining a possible bypass without establishing real CLI success:

apps/server/src/services/system/execution-options.ts:134

134: function includeRequestedRegisteredProvider(
135:   deps: Pick<LoggedWorkSessionDeps, "providerRegistry">,
136:   providers: ProviderInfo[],
137:   providerId: string | undefined,
138: ): ProviderInfo[] {
139:   if (
140:     providerId === undefined ||
141:     providers.some((provider) => provider.id === providerId)
142:   ) {
143:     return providers;
144:   }
145:   const registration = deps.providerRegistry.get(providerId);
146:   return registration === null ||
147:     deps.providerRegistry.disabledProviderIds().has(providerId)
148:     ? providers
149:     : [...providers, registration.info];

6. Proposed fix and safe-fix decision

First settle how provisioning-time provider availability is represented and validated, including whether it depends on provider inputs or a specific image. Carry selected new-machine context to discovery and keep predictions separate from observed existing-host health. Once the machine connects, use its actual health and model catalog; do not retain stale primary-host results or weaken disabled-provider filtering.

No automatic product patch is safe under the simple-fix rule. The fix needs a product decision and a public contract across environment/plugin declarations, the discovery API, and the composer. Showing every installed-only provider or changing its visibility would violate the existing-machine negative control and worsen the related over-show problem. No fix branch, dependency, protocol change, or pull request was created.

7. Related issues

The issue cross-reference timeline and the open-PR search for issue 5345 returned no linked open pull request at investigation time. No linked branch or code was executed.

8. Verification

The same agent repeated the experiment, not an independent reviewer. Checkout A and a separate clean checkout B were both pinned to the recorded trusted commit. Checkout B was clean before copying the authored test and performed its own frozen install and full Turbo build. The identical focused command produces the same three rosters, passes both existing-host controls, and fails the same final assertion with exit status 1 in both checkouts.

Artifacts: first run · second clean run. Artifact logs remove checkout paths, terminal colors, and trailing whitespace only. Source permalinks and excerpts were read from the recorded base commit. A correction retained in this report is the composer override: provider-based existing-machine targets are host-scoped, unlike the new-machine case. No live-picker or provisioner claim is upgraded to verified.

9. Appendix

Repeatable commands and all diagnostic source are included above. Preparation consisted of trusted clones, a frozen install and full build per checkout, and the focused test; the initial diagnostic was refined so the positive-control target is created only after the unscoped lookup. GitHub reads checked repository visibility, field choices, comments, related issue metadata, and open PR links. Missing classification values were set to Bug / Medium / High, with providers, workspaces, and provider-acp labels. No existing classification was overwritten. Build logs contain only standard tool warnings and successful task summaries; the exact test output is linked.

Trust note: Issue text was used only as untrusted claims. Its suggested actions, commands, and external links were not executed or fetched. The diagnosis and test come from trusted repository code, and no production runtime, credentials, third-party branch, or dependency was used.

> AGENT GENERATED