Repository navigation
Description
Summary
On a cold desktop start GET /api/v1/sidebar-bootstrap returns 409 no_provider_available while the server is still loading plugins, and the shell shows Failed to load projects. until a manual Cmd+R. The route is the only provider-registry consumer that reads the registry without awaiting providerRegistry.whenRegistrationsSettled(), so a read-only listing of projects fails with a client error that is really a "not ready yet" condition. It only bites projects that have no project_execution_defaults row, i.e. new projects and every project on a fresh install.
This is the server-side cause of the symptom in #2533. Worth filing separately because the retry policy in #2767 covers transport failures plus 408/429/5xx and deliberately does not retry 4xx, so a 409 stays terminal even with that fix in place.
Versions and environment
- bb 0.42.1, desktop app (packaged
/Applications/bb.app,channel: latest), macOS 26.6 (Darwin 25.6.0), arm64 - Local server on the default port (38886), default data dir (
~/.bb), no Connect, no remote host - Not provider specific — this is the app shell before any agent is involved. Registry contains
claude-code,codex,pi,acp-cursor; Claude Code CLI 2.1.263 - Plugins: all bundled ones plus one git-sourced plugin (
floating-terminal0.5.2). Not plugin specific — reproduces with bundled plugins only, see "What you ruled out"
Steps to reproduce
In the app: quit bb (Cmd+Q), relaunch, and look at the sidebar while a project without a project_execution_defaults row exists (fresh install, or any project in which no thread has been created from the UI yet).
Deterministic repro against an isolated server — spare ports, throwaway data dir, does not touch ~/.bb:
// coldstart-probe.mjs — node coldstart-probe.mjs
import { spawn } from "node:child_process";
import { mkdirSync, rmSync } from "node:fs";
const DATA_DIR = "/tmp/bbtest";
const PORT = 39901;
const BASE = `http://127.0.0.1:${PORT}`;
const PATHS = [
"/health",
"/api/v1/sidebar-bootstrap",
"/api/v1/projects?include=threads&includePersonal=true",
];
rmSync(DATA_DIR, { force: true, recursive: true });
mkdirSync(DATA_DIR, { recursive: true });
const child = spawn(
"/Applications/bb.app/Contents/MacOS/bb",
["/Applications/bb.app/Contents/Resources/app.asar.unpacked/dist/bb-app-bridge.mjs"],
{
env: {
...process.env,
ELECTRON_RUN_AS_NODE: "1",
BB_DATA_DIR: DATA_DIR,
BB_SERVER_PORT: String(PORT),
BB_HOST_DAEMON_PORT: "39902",
BB_TELEMETRY: "0",
},
stdio: ["ignore", "pipe", "pipe"],
},
);
const t0 = Date.now();
const results = [];
let firstHealth = null;
async function probe(path) {
const at = Date.now() - t0;
try {
const response = await fetch(BASE + path);
const body = response.ok ? "" : (await response.text()).slice(0, 160);
return { at, path, status: response.status, body };
} catch (error) {
return { at, path, status: 0, body: String(error.cause?.code ?? error.message) };
}
}
const deadline = Date.now() + 25_000;
while (Date.now() < deadline) {
const batch = await Promise.all(PATHS.map(probe));
results.push(...batch);
const health = batch.find((r) => r.path === "/health");
if (firstHealth === null && health?.status === 200) firstHealth = health.at;
if (firstHealth !== null && batch.every((r) => r.status === 200)) break;
await new Promise((r) => setTimeout(r, 100));
}
child.kill("SIGTERM");
console.log(`/health first OK at ${firstHealth}ms`);
for (const path of PATHS.slice(1)) {
const rows = results.filter((r) => r.path === path);
const firstOk = rows.find((r) => r.status === 200);
console.log(`\n${path}`);
console.log(` first 200 at ${firstOk ? firstOk.at + "ms" : "never"}`);
for (const row of rows.filter((r) => r.status !== 200)) {
console.log(` ${row.at}ms -> ${row.status} ${row.body}`);
}
}
process.exit(0);node coldstart-probe.mjs— fresh data dir, so the personal project has no stored execution defaults. The bootstrap 409s.- Seed the row and rerun without wiping the dir (remove the
rmSyncline):Now the same window returns 200 from the first millisecond, which isolates the failing branch.insert or replace into project_execution_defaults (project_id, provider_id, model, service_tier, reasoning_level, permission_mode, updated_at) values ('proj_personal','claude-code','claude-opus-5[1m]','default','high','auto', 1788771405742);
Did not reproduce with: a data dir where every project has a project_execution_defaults row; the git-sourced plugin removed (bundled plugins alone still reproduce, they just make the window shorter).
Expected vs actual
Actual, fresh data dir (no project_execution_defaults row):
/health first OK at 538ms
/api/v1/sidebar-bootstrap
first 200 at 5384ms
539ms -> 409 {"code":"no_provider_available","message":"No agent provider is enabled. Enable an agent provider plugin in Settings → Plugins to start a thread."}
/api/v1/projects?include=threads&includePersonal=true
first 200 at 5384ms
539ms -> 409 {"code":"no_provider_available","message":"No agent provider is enabled. Enable an agent provider plugin in Settings → Plugins to start a thread."}
The 409 lands 1ms after /health first reports OK, which is exactly when the
desktop probe declares the server ready and loads the SPA.
Actual, same data dir with one project_execution_defaults row seeded:
/health first OK at 538ms
/api/v1/sidebar-bootstrap
first 200 at 538ms
In the app the 409 renders as a terminal shell state:
New thread / Extensions / Automations / GitHub / Kanban / Docs / Tasks /
Settings / Remote access / Report a bug
Failed to load projects.
Expected: a read-only listing of projects and threads does not fail because
provider plugins have not registered yet. Either the route waits for the
registry to settle, or a project with no usable provider yields
defaultExecutionOptions: null instead of failing the whole response.
Evidence
Permalinks are against the tag I reproduced on, desktop-v0.42.1 = a4aa07f9. Still present on main at 06aeaa994942ae7527dc49d2268c1f801e8542a0: routes/projects.ts L247 and L357 and thread-default-policy.ts L160-L180 are unchanged, and routes/projects.ts still contains no whenRegistrationsSettled call.
- The listener starts serving before plugins start, and the registry is only marked settled in a
.finally():bb/apps/server/src/start-server.ts
Line 222 in a4aa07f
const server = startHttpListener({ bb/apps/server/src/start-server.ts
Lines 241 to 249 in a4aa07f
void pluginService .start() .catch((error: unknown) => { logger.error({ err: error }, "Plugin startup failed"); }) .finally(() => { providerRegistry.markRegistrationsSettled(); pluginService.startPeriodicUpdateChecks(); });
- The desktop probe treats "listening" as "ready" — only
/healthand/api/v1/system/config— then immediately loads the SPA from the server URL:bb/apps/desktop/src/server-probe.ts
Lines 158 to 167 in a4aa07f
export async function probeBbServer( args: ProbeBbServerArgs, ): Promise<ServerProbeResult> { const fetchImpl = args.fetchImpl ?? globalThis.fetch; const healthResult = await fetchJson({ fetchImpl, schema: healthResponseSchema, timeoutMs: args.timeoutMs, url: endpointUrl(args.serverUrl, "/health"), }); bb/apps/desktop/src/server-probe.ts
Lines 193 to 198 in a4aa07f
const configResult = await fetchJson({ fetchImpl, schema: systemConfigResponseSchema, timeoutMs: args.timeoutMs, url: endpointUrl(args.serverUrl, "/api/v1/system/config"), }); Lines 1486 to 1492 in a4aa07f
async function loadBbApp(serverUrl: string): Promise<void> { bbAppLoaded = true; await loadWindowUrl({ url: serverUrl }); if (shouldOpenDevTools()) { desktopWindowFactory?.openDevTools(); } }
- The route handler is synchronous and reads the registry per project:
bb/apps/server/src/routes/projects.ts
Lines 357 to 359 in a4aa07f
get(routes.sidebarBootstrap, (context) => context.json(buildSidebarBootstrapResponse(deps)), ); bb/apps/server/src/routes/projects.ts
Lines 244 to 253 in a4aa07f
return projects.map((project) => ({ ...project, threads: threadsByProjectId.get(project.id) ?? [], defaultExecutionOptions: resolveCreateThreadExecutionDefaults( deps.providerRegistry, { storedDefaults: defaultsByProjectId.get(project.id) ?? null, }, ).executionDefaults, }));
- With no stored defaults the provider id falls through to
requireDefaultProviderId, and an empty registry throws 409:bb/apps/server/src/services/threads/thread-default-policy.ts
Lines 160 to 180 in a4aa07f
export function resolveCreateThreadExecutionDefaults( registry: ProviderRegistryService, args: ResolveCreateThreadExecutionDefaultsArgs, ): CreateThreadExecutionDefaultsResolved { const providerId = args.requestedProviderId ?? args.storedDefaults?.providerId ?? requireDefaultProviderId(registry); const registration = registry.get(providerId); if (registration !== null && !registration.info.available) { throw new ApiError( 409, "provider_unavailable", `${registration.info.displayName} is unavailable because its provider plugin failed to load.`, ); } const storedDefaults = args.storedDefaults?.providerId === providerId ? args.storedDefaults : null; return { executionDefaults: storedDefaults, providerId }; } bb/apps/server/src/services/threads/thread-default-policy.ts
Lines 26 to 46 in a4aa07f
function requireDefaultProviderId(registry: ProviderRegistryService): string { const listed = registry.list(); const preferred = registry.getUserDefaultProviderId(); const providerId = (preferred !== null ? listed.find( (registration) => registration.info.id === preferred && registration.info.available, ) : undefined )?.info.id ?? listed.find((registration) => registration.info.available)?.info.id; if (providerId === undefined) { throw new ApiError( 409, "no_provider_available", "No agent provider is enabled. Enable an agent provider plugin in Settings → Plugins to start a thread.", ); } return providerId; }
- The synchronisation primitive exists and every other consumer awaits it —
routes/projects.ts(sidebarBootstrapandlist) is the only place that does not:bb/apps/server/src/services/providers/provider-registry.ts
Lines 88 to 92 in a4aa07f
whenRegistrationsSettled(): Promise<void>; markRegistrationsSettled(): void; } const REGISTRATIONS_SETTLED_TIMEOUT_MS = 30_000; bb/apps/server/src/services/providers/provider-registry.ts
Lines 174 to 190 in a4aa07f
async function waitUntilSettledOrTimeout( readiness: Promise<void>, ): Promise<void> { if (settle === null) { return; } let timer: ReturnType<typeof setTimeout> | undefined; await Promise.race([ readiness, settled, new Promise<void>((resolve) => { timer = setTimeout(resolve, REGISTRATIONS_SETTLED_TIMEOUT_MS); timer.unref?.(); }), ]); clearTimeout(timer); } await deps.providerRegistry.whenRegistrationsSettled(); await deps.providerRegistry.whenRegistrationsSettled(); await deps.providerRegistry.whenRegistrationsSettled();
- Which projects are affected: the row is written only on thread creation from the app, with a fresh environment and no
originKind, so CLI-created threads and worktree-reusing threads never write it:bb/apps/server/src/services/threads/project-execution-defaults.ts
Lines 44 to 55 in a4aa07f
function shouldRememberProjectExecutionDefaults(args: { environment: ThreadCreateServiceRequest["environment"]; origin: ThreadCreateServiceRequest["origin"]; originKind?: ThreadCreateServiceRequest["originKind"]; }): boolean { // Reusing an existing worktree is a one-off in a specific environment, not // a fresh default-shaping event. Don't overwrite the project's stored // execution defaults with the picker selections made for that single thread. if (args.environment.type === "reuse") return false; if (args.originKind !== null) return false; return args.origin === "app"; } bb/apps/server/src/services/threads/project-execution-defaults.ts
Lines 110 to 126 in a4aa07f
export function rememberProjectExecutionDefaultsForCreate( deps: Pick<AppDeps, "db">, args: RememberProjectExecutionDefaultsForCreateArgs, ): void { if (!shouldRememberProjectExecutionDefaults(args.request)) { return; } upsertProjectExecutionDefaults(deps.db, { projectId: args.request.projectId, providerId: args.request.providerId, model: args.execution.model, reasoningLevel: args.execution.reasoningLevel, permissionMode: args.execution.permissionMode, serviceTier: args.execution.serviceTier, }); }
ApiErrorresponses are returned without logging, so none of this appears in~/.bb/logs/server.1.log— absence of log lines is not evidence of a healthy startup here:Lines 88 to 90 in a4aa07f
if (error instanceof ApiError) { return error.toResponse(); }
How the numbers were measured: Date.now() deltas inside the probe script above, one batch of parallel requests every 100ms from process spawn. Timings on this machine, from ~/.bb/logs/server.1.log, for the window's width in the real app:
11:55:26.314 Server listening
11:55:26.489 plugin floating-terminal loaded (+0.2s)
11:55:27.645 plugin tasks loaded (last plugin) (+1.3s)
11:55:28.964 [plugin:github] synced 132 item(s) across 1 repo(s) (+2.7s)
Local correlation, project proj_personal and proj_e5nsc6rgq3 in ~/.bb/bb.db: the three restarts that showed the error (11:53:35, 11:54:15, 11:55:26 in server.1.log) all predate the first project_execution_defaults rows (11:56:45 and 12:01:17). After those rows existed the symptom stopped, which matches the seeded-row result above.
What you ruled out
- Not a duplicate of Desktop cold start can leave the shell on a terminal "Failed to load projects." until an unrelated realtime event refetches #2533: that one is the client half — a bootstrap failure left terminal by the retry policy. This is the server returning a deterministic 409 for a read-only listing. Both are needed; Desktop cold start can leave the shell on a terminal "Failed to load projects." until an unrelated realtime event refetches #2533's repro injects
connectionrefusedrather than reproducing the real server error. - Not fixed by Retry sidebar bootstrap until a warming server answers #2767: that retry policy explicitly covers transport plus 408/429/5xx and does not retry 4xx, so this 409 remains terminal with it applied.
- Not the
floating-terminalplugin: reproduces on a fresh data dir where only bundled plugins are installed. Extra plugins only widen the window. - Not the
provider_unavailablebranch of the same function: the provider registers as available; the throw comes fromrequireDefaultProviderIdwith an empty registry. - Not a transport or connection error: the server is already listening and answers with a real 409 JSON body.
- Not the browser origin guard: that returns 403
forbidden_origin, the observed status is 409no_provider_available. - Not a client-side timeout: the renderer sets no request timeouts (no
AbortSignal.timeout/timeoutMsin the app bundles). - Not stale cached assets: packaged builds call
session.defaultSession.clearCache()at startup (main.ts#L2014-L2017). - Not data loss:
curl http://127.0.0.1:38886/api/v1/sidebar-bootstrapreturns everything once plugins have settled, while the window still shows the error.
Suggested priority and effort
Medium — hits every fresh install and every newly added project until a thread is created in it from the UI; workaround is Cmd+R or creating one thread per project; no data lost. Effort Low: await deps.providerRegistry.whenRegistrationsSettled() in the sidebarBootstrap and list handlers, and/or degrade defaultExecutionOptions to null for read-only listings instead of throwing.
Checks
- I reproduced this on the latest release or on
main, or I say above that I could not. - I searched open and closed issues for the same problem.
- If an agent wrote this, the body ends with
> AGENT GENERATEDand links the thread or report.
AGENT GENERATED
Investigation thread (local bb): thr_cgdkn8tatf, project proj_personal. Code was read from the source maps shipped inside app.asar in the 0.42.1 desktop build, then every cited line was verified against a4aa07f9 in this repo.
Activity
bb-slop-cop commentedon Sep 7, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotprovidersconfirmed-reproSawyerHood commentedon Sep 9, 2026
Closing as completed following a review of the merged implementation and current source.
Project/sidebar bootstrap no longer requires provider startup to have finished; persisted defaults remain readable and startup plugin snapshots refresh. Thread creation still validates provider readiness. PR reports cold-start verification and regression tests. On main, not in 0.42.1.
Implementation: #3183.
This closure is based on source review and the merged changes; the original scenario was not freshly reproduced during this backlog audit.