You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto-restart thread after "host daemon restarted" #1592
I use bb against an external server I run and I frequently run into "host daemon restarted". I'm not sure why it would be restarting, I'm not touching it at all, any guidance on how to debug that would be appreciated!
But one thing which would be nice is if the daemon picked up the thread agains automatically after it had restarted. I run a lot of work over night and it's a bit annoying to see it didn't get all the way there. :)
I hit the same thing against an external server and pulled the forensics out of the bb event log. Sharing in case it helps debug the restarts themselves, and because it changed what I think the fix should be.
Observed (two incidents, both confirmed event-side):
Threads thr_mijjduc4gj (killed 08-21 02:00:17) and thr_5esghkmr5x (interrupted 08-22 02:47:51).
Both kills coincide millisecond-exact with a bb server restart: Server listening banner 08-21 02:00:17.271 / 08-22 02:47:50, and the new daemon session hses_qtgdus2jp3 was created 02:00:17.984 — the same millisecond as the synthetic turn/completed + system/error + system/thread/interrupted (reason host-daemon-restarted). The daemon never logged a socket close; the server declared it disconnected during its own teardown while it was coming back up.
In thr_mijjduc4gj the turn/completed was synthetic: the item started at 01:58:12 never completed. Server-side lifecycle warnings cluster at the same instant ("no transition for run.started from status active").
Recovery is actually fine: same providerThreadId across the resets and ~28 clean turns after reconnect, no duplicated or lost work. The damage is one interrupted turn plus the misleading "Please retry the thread to continue." prompt — the provider session survived and would have re-attached on the next dispatch. The code that fires here is the replacement-instance branch in session-owner-side-effects.ts failing every active thread via thread-lifecycle.ts before reconciliation runs (tested at base fff3ae8 in apps/server/test/internal/background-task-reconciliation.test.ts).
Ruled out: not the provider — on a true stdio disconnect the ACP agent cancels and exits on its own; here nothing was wrong with the provider session, bb synthesized the failure. Not a one-off: both observed incidents line up on the restart boundary to the millisecond.
I've opened #2296 with the narrow half of your ask: when a restarted daemon re-registers, threads whose provider session survived settle like a stop (no synthetic error, thread lands idle and resumable) instead of being failed, so the next turn continues on the same provider session and queued work picks back up without a manual retry. The full "resume the interrupted turn's input automatically" half is a product call (it duplicates the user message in the transcript) — happy to follow up if maintainers want that behavior. The mystery of why your daemon restarts is still worth its own investigation; from these two incidents the restarts were server-side, not anything the daemon decided to do.
Activity
bradhallett commentedon Aug 22, 2026
I hit the same thing against an external server and pulled the forensics out of the bb event log. Sharing in case it helps debug the restarts themselves, and because it changed what I think the fix should be.
Observed (two incidents, both confirmed event-side):
thr_mijjduc4gj(killed 08-21 02:00:17) andthr_5esghkmr5x(interrupted 08-22 02:47:51).Server listeningbanner 08-21 02:00:17.271 / 08-22 02:47:50, and the new daemon sessionhses_qtgdus2jp3was created 02:00:17.984 — the same millisecond as the syntheticturn/completed+system/error+system/thread/interrupted(reasonhost-daemon-restarted). The daemon never logged a socket close; the server declared it disconnected during its own teardown while it was coming back up.thr_mijjduc4gjtheturn/completedwas synthetic: the item started at 01:58:12 never completed. Server-side lifecycle warnings cluster at the same instant ("no transition for run.started from status active").session-owner-side-effects.tsfailing every active thread viathread-lifecycle.tsbefore reconciliation runs (tested at base fff3ae8 inapps/server/test/internal/background-task-reconciliation.test.ts).Ruled out: not the provider — on a true stdio disconnect the ACP agent cancels and exits on its own; here nothing was wrong with the provider session, bb synthesized the failure. Not a one-off: both observed incidents line up on the restart boundary to the millisecond.
I've opened #2296 with the narrow half of your ask: when a restarted daemon re-registers, threads whose provider session survived settle like a stop (no synthetic error, thread lands idle and resumable) instead of being failed, so the next turn continues on the same provider session and queued work picks back up without a manual retry. The full "resume the interrupted turn's input automatically" half is a product call (it duplicates the user message in the transcript) — happy to follow up if maintainers want that behavior. The mystery of why your daemon restarts is still worth its own investigation; from these two incidents the restarts were server-side, not anything the daemon decided to do.
Resume daemon-restarted threads with persisted provider sessions (get…