Repository navigation
Description
Summary
A plugin that calls another plugin's RPC method through bb.sdk.plugins.callRpc gets BbRequestTimeoutError after 75 s. That timeout is a deliberate default, and this issue is not asking to remove it. The gap is on the other side: the server-side handler is not cancelled and has no AbortSignal in its context, so it cannot observe that nobody is waiting. The same applies when the app or the bb CLI calls an RPC method and disconnects: POST /plugins/:id/rpc/:method never reads the request's abort signal.
Code pointers are against main at 7fd6ee9 (bb 0.45.0, plugin SDK 0.6.19). The timing below was observed earlier on bb 0.45.0 with plugin SDK 0.6.15 and has not been re-run against this commit.
Reproduction
Plugin A registers an RPC method whose handler sleeps for 80 s and then writes a row:
bb.rpc.register(
defineRpcContract({ slow: { input: z.null(), output: z.null() } }),
{
async slow() {
await new Promise((resolve) => setTimeout(resolve, 80_000));
bb.storage.database().prepare("INSERT INTO marks(at) VALUES (?)").run(Date.now());
return null;
},
},
);Plugin B calls it:
await bb.sdk.plugins.callRpc({ pluginId: "a", method: "slow", input: null, outputSchema: z.null() });- After 75 s B gets
BbRequestTimeoutError: BB request timed out after 75 seconds.(observed at ~75.07 s in the earlier run). - A's handler continues, writes its row at 80 s, and the result is discarded.
- A has no way to detect the timeout;
bb plugin listshows no error for A.
Where
packages/sdk/src/response.ts:3—DEFAULT_BB_REQUEST_TIMEOUT_MS = 75_000.packages/sdk/src/node.ts:49-61—createNodeTransportapplies that default unless the caller passes its ownfetchortimeoutMs.apps/server/src/services/plugins/plugin-rpc-caller.ts:53-68— the SDK injected into plugins forcallRpcalways wraps fetch increateRequestTimeoutFetch({ timeoutMs: DEFAULT_BB_REQUEST_TIMEOUT_MS }); a plugin cannot change it. The timeout is client-side only.apps/server/src/routes/plugins.ts:902-977— the RPC route never touchescontext.req.raw.signal.apps/server/src/services/plugins/plugin-service.ts:2037-2063—invokeRpcHandlercallshandler.handler(parsedInput, { experimental_caller });ExperimentalPluginRpcHandlerContext(packages/plugin-sdk/src/rpc-contract.ts) has onlyexperimental_caller.apps/server/src/services/plugins/plugin-runtime.ts:823-863—invokeWrappedhas no deadline.
Other plugin surfaces already pass a signal: CLI commands get ctx.signal = context.req.raw.signal (routes/plugins.ts:515-520, backend-contract.ts:930-931), agent tools get signal (backend-contract.ts:1070-1078), host RPC calls take signal and timeoutMs (packages/plugin-sdk/src/host-contract.ts:19-25). Plugin RPC handlers are the odd one out.
Expected
Either the handler is told the request is gone, or the caller can choose to wait as long as the handler needs.
Suggested direction
- Add
experimental_signal: AbortSignalto the RPC handler context, aborted when the HTTP request disconnects. Wirecontext.req.raw.signalthroughinvokeRpcHandler. - Let
callRpccallers choose: honourPluginRpcArgs.signalwithout the implicit 75 s timeout when a signal is given, or accept atimeoutMsoption like host RPC does. TodayPluginRpcArgs.signalexists but the injected 75 s timeout still fires. - Document the 75 s default in the plugin guide so plugin authors build long operations (imports, migrations) as jobs with status polling.
Until then plugins should make long RPC handlers idempotent, because a timed-out call may still have done its work.
Activity
bb-slop-cop commentedon Oct 5, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotplugins,confirmed-repro.Tie each loaded plugin copy's work to that copy across reload, disabl…