Repository navigation
Description
Summary
When the ACP provider bridge worker is stopped by SIGTERM or SIGINT, it exits without stopping its ACP agent processes. On macOS we find cursor-agent acp processes re-parented to PID 1 that keep running indefinitely. Expected: the bridge stops all its agent processes before it exits, as it already does on onClose.
Versions and environment
- bb 0.45.0-based build (desktop app + host daemon), macOS 26, two Macs
- acp-cursor provider,
cursor-agent2026.10.01 - Code path unchanged on
mainat 4b12265 and in 0.46.0 (4c87fdec7)
Steps to reproduce
- Use an ACP provider thread (we used acp-cursor) on a macOS host so the bridge has a live
cursor-agent acpchild. - Terminate the bridge worker with SIGTERM (for example by restarting the host daemon LaunchAgent).
ps -o pid,ppid,lstart,command -ax | grep 'cursor-agent acp'
We have not isolated which daemon shutdown path sends the signal live; the code path below is the part we are sure about.
Expected vs actual
Expected: no cursor-agent acp processes left after the bridge exits.
Actual (2026-10-11, before cleanup):
kregenrek: cursor-agent acp, PPID 1, PID 47981, started Sun Oct 11 19:28:47 2026
kregenrek: cursor-agent acp, PPID 1, PID 82824, started Sat Oct 10 23:11:11 2026
devbook: cursor-agent acp, PPID 1, PID 75708, started Sat Oct 10 17:24:05 2026
Evidence
In packages/provider-bridge-acp/src/bridge/bridge.ts on main:
stopAllSessions()only runs fromonClose. The bridge does not setonSigterm/onSigint, althoughbridge-worker-entry.tssupports both. On SIGTERM the worker dies with Node's default handler and its agent children survive.stopAllSessions()only reaches connections registered insessionsByBbThreadId. Connections that are not sessions, for example the model discovery connection, are not stopped.- Nothing prevents a new connection from being spawned while shutdown is in progress.
Fix we run in our fork (4 files, +305/−12):
- Track every
AcpAgentConnectionin a set, removed in itsonExit. - Refuse new connections once shutdown has started.
- One
shutdownBridge()foronClose,onSigtermandonSigint: release all sessions and kill all tracked connections viaPromise.allSettled, log failures to stderr, then exit. - Regression test in
packages/agent-runtime/src/runtime.acp-topology.test.tsusing the fake ACP agent (signal cleanup).
Happy to open this as a PR.
What you ruled out
- Not thread/resume inherits the 30s JSON-RPC default and fails large pi sessions #5080/Use construction deadline when restoring provider sessions #5082: that is the
thread/resumetimeout; we carry the same fix, and it does not stop these processes. - Not Third-party provider bridge: silent delta-batch drops, undocumented required fields, and worker process leak #3820: that is a worker process leak in third-party bridges, not agent children of the ACP bridge.
- Not bb host process grew to 77GB RSS and froze the machine; orphaned dev processes in deleted managed worktrees compound the leak #1660: those are dev processes in deleted worktrees.
Suggested priority and effort (optional)
Medium. Orphans accumulate per restart and keep their memory until killed by hand. Workaround: find and kill cursor-agent acp with PPID 1. Effort low, the fix is ready.
AGENT GENERATED. Written from a private BB thread, so there is no public link.
Activity
bb-slop-cop commentedon Oct 12, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotproviders,host,provider-acp,confirmed-repro.fix(acp): clean up agents before worker exit (get-bb#5374)