Repository navigation
Report provider-bridge, plugin-RPC and orphaned tool-call failures to the plugin - #8080
Merged
ymichael merged 6 commits intoNov 24, 2026
Conversation
ymichael
force-pushed
the
bb/plugin-failures-reach-the-plugin-provider-bridge-thr_y8v7eqi52e
branch
3 times, most recently
from
November 24, 2026 06:05
03fd66e to
2de666d
Compare
… the plugin
Provider bridges: an unexpected bridge exit now carries the code
provider_process_exited from the daemon (HOST_DAEMON_PROTOCOL_VERSION
280). The server writes it to the provider plugin's own log and status
detail, from the host-RPC response for every bridge command and from the
mid-session system/error event. A failed health check shows its reason
instead of a bare catch.
Plugin RPC route: unknown plugin, not running, bad caller token and
non-JSON body return { code, message } (plugin_not_found,
plugin_not_running, invalid_caller, unsupported_media_type), and
PluginRpcErrorCode names them. BrowserRequestProblem carries its own code.
bb-account, connect and the mobile push client read the code instead of
the status or message.
Detached tool calls: when a plugin is disposed while its tool call waits
on requestInput, the agent is told at once that the call failed, waking an
idle thread, instead of the result being dropped.
Plugin SDK 0.6.191.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A graceful server stop disposes every plugin, so a tool call waiting on requestInput was settled with the "plugin stopped" failure. That delivery was fire-and-forget: nothing waited for it, and it tried to start a turn while the plugin the agent would call again was being torn down. Shutdown now switches the tool call registry to queue these notices without dispatching them and waits until they are written. The periodic idle-thread queue sweep sends them once bb is back. The failure text now also names a bb restart. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/plugin-failures-reach-the-plugin-provider-bridge-thr_y8v7eqi52e
branch
from
November 24, 2026 19:16
f4f2ec4 to
e2c8b5d
Compare
…sing Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/plugin-failures-reach-the-plugin-provider-bridge-thr_y8v7eqi52e
branch
November 24, 2026 19:36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Three plugin failures still never reached the plugin. This is the residue of plugin API audit findings c-backend F2, F3 and F15, which #7875 left as "Not done".
experimental_providerBridgeexport, reached only the server log through the model catalog, the health check and the session path. The health check inprovider-states.tswas a barecatch {}that said "Provider readiness could not be checked." with no reason. The plugin still showed plain "running". The daemon reported the crash as a genericcommand_failed, so the server had no way to tell a bridge crash apart from any other command failure.POST /plugins/:id/rpc/:methodreturned bare strings for four failures: unknown plugin, plugin not running, a bad caller token, and a local-auth failure. Throughbb.sdk, anexperimental_BbHttpErrortherefore hadcode: null, and only the HTTP status told them apart. bb-account, connect and the mobile push client branched on 404/503 or on the message text. Connect's check also showed "the bb account plugin is off" for any gateway 503.requestInput,PluginToolCallRegistrydropped the result with an info log. The agent had been told "A successful result will arrive separately", so it waited forever.What changed
Provider bridges (F2). Wire change:
HOST_DAEMON_PROTOCOL_VERSION280 → 281.ProviderProcessExitedError(agent-runtime) carriescode: "provider_process_exited"for an unexpected exit, the same code the mid-sessionsystem/errorevent already uses. The daemon'sgetErrorCodepasses it through as the host-RPCerrorCode(it wascommand_failed). An expected shutdown keeps no code.ProviderRegistration.reportBridgeFailure({ hostId, operation, message })is server-internal. The plugin runtime implements it with Send plugin failures to the plugin's own log #7875'spluginLog.warnand the same running-status detailinvokeWrappedsets. It is a no-op after the registration is disposed.callHostOnlineRpcWithRetry, when a response fails withprovider_process_exitedand the command carries abridgeLaunch. This coversprovider.health,provider.list_models,list_commands, usage, installation,thread.start,turn.submitand the other bridge commands.system/error provider_process_exitedevent branch ininternal/events.ts, for a bridge that dies mid-session.Provider readiness could not be checked: <first line of the error>.Plugin RPC route (F3)
{ ok: false, error: { code, message } }with these codes:plugin_not_found404,plugin_not_running503,invalid_caller403, andforbidden_origin403 /unsupported_media_type415 for local auth. Statuses and messages are unchanged.BrowserRequestProblemnow carries its owncode(forbidden_host,forbidden_originorunsupported_media_type).server.ts,files.tsanddesktop-browsers.tsuse it instead of each re-deriving the code from the status.PluginRpcErrorCodeunion gains those five codes, so the app'sexperimental_PluginRpcCallError.codenames them instead of mapping them tounknown_error.code:plugins/bb-account/src/client.tsplugins/connect/app.tsx(isUnavailableError)apps/mobile/.../push-subscriptions-api.ts, which keeps its message match as a fallback for older servers.Orphaned tool calls (F15)
PluginToolCallRegistrysettles an abandoned call immediately instead of waiting for the plugin's handler to return.Tool "<name>" failed: the "<plugin>" plugin stopped before the call finished (it was reloaded, updated or disabled, or bb restarted), so its result will not arrive. Call the tool again if you still need it.It is delivered through the existingtool-result-deliveredsystem message withwakeIdleThread: true, so an idle agent wakes.deferDeliveriesToRestart()before stopping plugins, so these notices are queued without starting a turn (the plugin the agent would call again is being torn down), thensettleDeliveries()waits until they are written. The periodic idle-thread queue sweep sends them once bb is back.Docs.
docs/api_to_audit.md: theexperimental_BbHttpErrorandexperimental_PluginRpcCallErrorentries.surfaces.ts.backend-events.md(now exactly 500 lines),backend-sdk.mdandbackend-cli-agents.md.PluginAgentToolContext.signalJSDoc.Community callers (not edited, 504-repo corpus). Statuses and messages are unchanged, so the status checks and message regexes keep working. That covers:
source-contract.ts:791; its code regex also matchesplugin_not_found)cursor-sidebar/src/change-requests.ts:270bb-port.ts:73and tavernburn.ts:16One repo changes behaviour: pascal-de-ladurantaye/bb-autoresearch
src/bench-provider/client.ts:58requirescode === nullbefore it treats a failure as a missing provider. Withplugin_not_foundit will now report a generic provider error.Not done
httpand WebSocket routes still return bare string errors. They are not part of this finding, and changing their body shape could break external clients.Found, not fixed
pending_interactionsrows don't record the tool call, so recovering after a crash needs a schema change.apps/server/test/app/install-machine-script.test.tsis flaky on main. It fails 2–3 different tests per run on a clean origin/main worktree too ("bb host daemon exited before it connected"). It is unrelated to this change.How you verified
Tests that fail on main and pass here. Checked by swapping the non-test sources back to origin/main.
plugin-failure-log.test.ts, two new rows:bridge-exit-healthasserts the plugin log line, the status detail and the healthstatusMessage.bridge-exit-sessioncovers a daemonsystem/errorevent.plugin-wire.test.ts: a four-row table that checks each RPC route failure has a structured{ code, message }.internal-tool-call-regressions.test.ts: an idle thread whose waiting tool's plugin is disposed gets atool-result-deliveredturn carrying the failure.plugin-tool-calls.test.ts: plugin disposal delivers a waking failure at once, and the handler's late result is ignored.internal-tool-call-regressions.test.tsandplugin-tool-calls.test.ts(shutdown): afterdeferDeliveriesToRestart(), the failure is queued without a turn,settleDeliveries()resolves only once it is written, and an idle-recovery dispatch then sends it. Each test fails if shutdown dispatches immediately or does not wait.runtime.process-lifecycle.test.ts: a crashed bridge rejects withcode: "provider_process_exited".plugin-sdk-hooks.test.ts(app): the route codes reachexperimental_PluginRpcCallError.code.push-subscriptions-api.test.ts(mobile): the structured unavailable codes map to the settings status.Commands
pnpm exec turbo run typecheck lintandpnpm exec turbo run test --continuefor@bb/server,@bb/agent-runtime,@bb/host-daemon,@bb/host-daemon-contract,@get-bb/plugin-sdk,@bb/mobile,@bb/app,@bb/domain, bb-account, connect, plugin-api-docs and bb-guide. Everything is green exceptinstall-machine-script.test.ts(see "Found, not fixed").oxfmt --checkon the changed files.Live,
pnpm start:worktree, same script on main and on this branchbridgeqaregisters a provider whose host artifact has no bridge export.Provider readiness could not be checked.,bb plugin logs bridgeqahad only "loaded", andbb plugin listshowed plainrunning.Provider readiness could not be checked: Provider "bridgeqa" exited unexpectedly (code 1). The plugin log hasprovider.health,provider.list_modelsandthread.startlines, each with the bridge's stderr.bb plugin listshowsrunning (provider "bridgeqa" thread.start failed: Provider "bridgeqa" exited unexpectedly (code 1)). The logs of provider-acp, codex, claude-code and pi got no lines.rpcqacallsbb.sdk.plugins.callRpcand prints the error.code: nullwith status 404, and not running gavecode: nullwith status 503. A bad caller token andtext/plaingot bare-string bodies.plugin_not_found,plugin_not_running,invalid_callerandunsupported_media_type, each with its message. With bb-account disabled,bb connect --code …still says "the bb account plugin isn't running", now through the code.bb plugin reload ask-user-questionran.interrupted, the server logged "Dropped a detached plugin tool result…", and the thread stayed idle.tool-result-deliveredturn, replied "I'll retry the question.", and asked again on the reloaded plugin.tool-result-deliverednotice ("…or bb restarted…") and the thread's turn-request count was unchanged, so no turn started during shutdown.🤖 Generated with Claude Code