Repository navigation
Description
Summary
When a plugin is reloaded, bb runs the new instance's factory before disposing the previous instance. Disposal then calls interruptPluginInteractions(pluginId), which interrupts every pending interaction for that plugin id, including forms the new instance has just raised. A plugin that re-raises its pending forms at startup (for example, approvals that must survive a restart) loses them on every bb plugin reload or plugin update. Its promise resolves { outcome: "cancelled", reason: "plugin-disposed" } milliseconds after the form is created.
Versions and environment
- bb-app 0.43.3 (npm global install;
desktop-v0.43.3, e865697). I checked the same order onmainat 4354b88. - Linux x64, Node 22. Local-path plugin.
Steps to reproduce
- Create a thread and note its id, then
echo <threadId> > /tmp/reload-probe-thread. - Install this local plugin:
// server.ts
import { readFileSync } from "node:fs";
export default function plugin(bb) {
const threadId = readFileSync("/tmp/reload-probe-thread", "utf8").trim();
void bb.ui
.requestInput({ threadId, rendererId: "reload-probe", title: "Reload probe", payload: {} })
.then((result) => bb.log.info(`reload-probe result: ${JSON.stringify(result)}`));
}- Confirm the form is pending on the thread (
bb thread interactions list <threadId>). - Run
bb plugin reload <pluginId>. - List the thread's pending interactions again, and check the plugin log.
Expected vs actual
- Expected: after the reload, the new instance's form stays pending. Only the old instance's form is interrupted.
- Actual:
- there are no pending interactions;
- the form raised by the new instance's factory is
interruptedwithstatus_reason = "plugin-disposed"about 10 ms after creation (observed: created 21:30:53.043, interrupted 21:30:53.056); - the new instance's promise resolves
{"outcome":"cancelled","reason":"plugin-disposed"}.
Evidence (code, desktop-v0.43.3)
apps/server/src/services/plugins/plugin-runtime.ts:loadOnecallsrunFactoryTimeBoxed(...)(L1627) and only afterwardsawait disposePluginInstance(row.id, previous)(L1684).disposePluginInstancecallsdeps.pendingInteractions?.interruptPluginInteractions(id)(L1756).- That lands in
apps/server/src/services/interactions/pending-interactions.tsL729-736, which callsinterruptPendingInteractionsForPlugin(db, { pluginId, statusReason: "plugin-disposed" })(packages/db/src/data/pending-interactions.tsL361). The update matches on plugin id only, with no instance or generation. mainat 4354b88 has the same order (runFactoryTimeBoxedL1863, thendisposePluginInstance(row.id, previous)L1921) and the same plugin-id-wide interrupt.
What I ruled out
- Not a timeout: the default
requestInputtimeout is 10 minutes, and the interrupt happens within milliseconds of the reload. - Not the plugin's own abort signal: no signal was passed.
- Not a duplicate: I found no existing bb issue about reload or
plugin-disposed. - Plugin-side workaround: re-raising on
reason: "plugin-disposed"from the new instance, with a process-wide "newest instance owns it" guard so the old instance doesn't also re-raise, restores the form. That works, but every plugin has to know about the ordering.
Suggested fix
Either scope the interrupt to interactions created by the instance being disposed (store an instance or generation id on the interaction row and filter on it), or dispose the previous instance before running the new factory.
Note: timeout default is undocumented in the guide
The plugin authoring guide's bb.ui.requestInput section (plugins/bb-guide/skills/bb-plugin-authoring/references/backend-cli-agents.md) doesn't say that timeoutMs defaults to 10 minutes (max 1 hour). Only the SDK type comment in backend-contract.ts says so. A form a user doesn't answer within 10 minutes silently ends cancelled/timeout. Together with the reload behaviour above, this makes long-lived approval forms easy to lose. One sentence in the guide would help. I'm happy to split this into a separate docs issue if preferred.
AGENT GENERATED
Activity
SawyerHood commentedon Sep 30, 2026
Verified report: https://get-bb.github.io/reports/issues/4432.html
REPRODUCED through the real plugin reload service and interaction database in two clean checkouts at the same main SHA, repeated by the same agent. After the first ordinary question is submitted, reloading admits the new factory question but old-instance cleanup cancels it with plugin-disposed. The settled-first-form condition matters: leaving the old form pending hits the current same-thread admission guard instead. Browser rendering was not tested.
Tie each loaded plugin copy's work to that copy across reload, disabl…