Repository navigation
Description
Summary
While building a third-party provider for a local llama.cpp deployment, we found and worked around three real bugs in the provider registration/bridge path, plus confirmed one platform gap that's likely intentional but undocumented. Everything below is backed by reproducible evidence (real logs, real screenshots, real code) from a live BB 0.43.1 instance — not speculation.
We ended up with two working integrations for the same backend (a local llama.cpp server), built for different reasons:
acp-llamacpp— a custom ACP agent registered viaprovider-acp'scustomAgentssetting, using the official@agentclientprotocol/sdk.llamacpp— a native BB provider, registered viabb.providers.register+ abb.hostbridge implementingexperimental_defineProviderBridge, following the same architecture asprovider-pi/provider-claude-code/provider-codex.
Both work end-to-end today (chat, model selection, reasoning levels for ACP; chat, model list, and a native "Estimated context → Show details" breakdown for the native one). Getting there surfaced the bugs below.
Bug 1: thread/delta silently drops the entire batch if any one delta in it fails validation
Repro: a bb.host bridge sends one thread/delta notification containing multiple deltas, e.g.:
{"jsonrpc":"2.0","method":"thread/delta","params":{"threadId":"...","deltas":[
{"kind":"item.open", ...},
{"kind":"item.close", ...},
{"kind":"contextWindow", ...},
{"kind":"turn.boundary","status":"completed"}
]}}Observed: the thread stays active forever. No error, no warning, nothing in any log file (server-stdio.log, host-daemon-stdio.log, host-daemon.1.log, host-daemon.2.log) — confirmed by grepping all of them after the fact. bb thread log --json --all shows the timeline stopping right after turn/input/accepted, with nothing after it until a manual bb thread stop.
Root cause (found by bisection, not by reading a stack trace — there wasn't one): splitting the same four deltas into four separate thread/delta notifications (one delta each) fixes it immediately and reproducibly. Something in the batch — we didn't isolate exactly which delta — fails Zod validation, and the whole array is dropped instead of dropping only the offending delta, with zero logging on either the daemon or server side.
Workaround (what we ship today): send every delta kind in its own thread/delta notification. Verified with fresh runs, not a one-off: three independent test threads all reached idle after this change, none did before it.
Ask: either validate/report each delta in a batch independently (partial application + a logged reason for the ones dropped), or at minimum log something when a thread/delta notification fails validation server-side. Silent drops with a thread stuck active forever are very hard to debug — we found this only by writing our own file-based debug logging (appendFileSync) inside the bridge process, because console.error/stderr aren't visibly surfaced to the plugin author for a long-lived host worker unless the process exits unexpectedly.
Bug 2: initialize response schema requires a top-level protocolVersion field distinct from the nested capabilities object, and this isn't obvious from docs/provider-plugin-api.md
The doc's "Handshake" example shows a flat object:
{
grammarVersions: [min, max],
sessionRestore: boolean,
...
}The actual initializeResultSchema (found by reading bundled-types/bb-plugin-sdk-provider-bridge.d.ts directly) is:
{
protocolVersion: number, // not shown in the doc's example at all
capabilities: { grammarVersions, sessionRestore, ... } // the doc's fields, nested
}Sending the doc's flat shape produces, with no other error to go on:
Provider bridge "llamacpp" answered initialize with a malformed result
(protocolVersion: Invalid input: expected number, received undefined).
Ask: update the doc's handshake example to match the real wire shape (top-level protocolVersion + nested capabilities), or link directly to the exported initializeResultSchema/InitializeResult type.
Bug 3: model/list result requires selectedOnlyModels: [], undocumented
docs/provider-plugin-api.md doesn't mention this field. We only found it by reading the Zod schema in the compiled server bundle after getting:
[{"expected":"array","code":"invalid_type","path":["selectedOnlyModels"],
"message":"Invalid input: expected array, received undefined"}]
Ask: document { models: AvailableModel[], selectedOnlyModels: AvailableModel[] } as the model/list result shape (an empty array is a valid default for a bridge that doesn't support --selected-model).
Platform gap (not a bug, but a real trap): bb.host alone registers nothing
Before finding bb.providers.register, we spent a long time on the (reasonable, doc-adjacent) assumption that declaring "host": "./host.ts" in package.json plus exporting experimental_defineProviderBridge(...) from it would make a provider show up in bb provider list. It doesn't — silently. bb plugin build . happily compiles dist/host.js (confirmed: correct size, correct artifact digest, matches provider-pi's scale), bb plugin install . succeeds, the plugin shows running — and the provider is simply absent from bb provider list, with nothing logged.
The actual missing piece, findable only in docs/provider-plugin-api.md §1 (easy to miss on a skim) and not referenced anywhere else we could find (not in the bb-plugin-sdk-app.d.ts types, not in the acp-provider skill, not in any error message): the plugin's server code must call bb.providers.register({...}), and the export from host.ts must be a named export experimental_providerBridge, not export default. Also silent either way if you get either one wrong.
Ask: have bb plugin install/bb plugin build warn when a plugin declares bb.host with a ProviderBridgeEntry-shaped export but never calls bb.providers.register for a matching id (or vice versa) — this seems detectable at load time.
Operational finding: provider bridge worker processes are not reaped across bb plugin build/reload cycles
During iteration (many bb plugin build && bb plugin install cycles on the same plugin id, in a container with a tight process/thread limit), we ended up with 7 separate bb-provider-bridge-worker.mjs processes for the same plugin id (provider-llamacpp), each pointing at a different (older) artifactDigest from a previous build, none of them terminated. Alongside a similar pattern for provider-acp's spawned agent children (multiple orphaned agent.ts child processes tied to threads that had already been stopped or replaced), this exhausted the container's process/thread limits badly enough that tsc, ps, and even a plain echo inside our own dev shell started failing with fork: Resource temporarily unavailable / native Node worker-thread creation aborts. We cleaned up manually (kill on the stale PIDs, identified by cross-referencing artifactDigest in dist/host.meta.json against the running processes' command lines).
Ask: worth confirming this isn't a known trade-off already accepted for the plugin dev-reload loop — for us it was severe enough to block all other work on the host until manually cleaned up.
What already works well (for contrast)
The provider-acp customAgents path (bb plugin config provider-acp set customAgents '[...]') worked close to first-try once we found it, and its per-model reasoning-effort variant grouping (splitVariant/EFFORT_TOKENS in the compiled bundle, keying on a -low/-medium/-high id suffix) is a genuinely clever design once you know the convention — it's just not documented anywhere we could find (not in the acp-provider skill, not in any public type).
Environment
- BB 0.43.1,
@get-bb/[email protected] - Reproduced on a single-host Docker deployment talking to a local llama.cpp server
- Full source for both integrations (ACP agent + native provider scaffold) available on request — happy to share as a minimal repro if useful
Activity
bb-slop-cop commentedon Sep 17, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotClassified as Bug · High priority · Medium effort; added
providers,plugins, andprovider-acp(no existing classifications were replaced).Reproduction and root-cause report: PARTIALLY REPRODUCED, high confidence in the validation findings; reproduction label:
partial-repro.Whole-notification validation silently returns no events when any delta is invalid, discarding a valid completion alongside it. The handshake and model-list examples also omit required response fields. The reproduction test confirmed these findings in two clean checkouts of
261fb87479; each run passed 333 relevant tests. Current main has passing worker-retirement tests; the reported Docker/ACP process leak remains unverified.No PR: a complete fix spans multiple subsystems, and the worker failure lacks a reproduced regression, so it does not meet this rule's simple-fix criteria.