Repository navigation
fix(runner): wake suspended children that were adopted after a daemon restart - #1021
Merged
Merged
Conversation
Adopted sessions (worker outlived a daemon restart) have no child handle or IPC, so pre_suspend never reaches the daemon and a suspend sends no session_ended. The stale child:null entry made the wake's spawnSession throw 'Session already running', swallowed silently by doSpawn — so messages and followUps to idle children never woke them. A wake now replaces an adopted, child-less entry (the relay only wakes sessions it holds as suspended/offline). Non-wake spawns still throw. Spawn failures are now logged.
Owner
Author
|
!pizza - fix the checks |
Owner
Author
|
Fixed in edf50f1: pinned the browser-dependent Unit Tests job to Ubuntu 24.04. ubuntu-latest had selected Ubuntu 26.04.1, unsupported by locked Playwright 1.58.2. All 14 PR checks now pass on that commit: Unit Tests, Android, all five binary builds, runner-image check, both install-flow E2Es, and CodeQL checks. CI run 42083450647 completed successfully. Local verification also passed: frozen install, lint, typecheck, build, full root tests against disposable Redis, workflow structure validation, and git diff --check. Full actionlint reports only existing E2E ShellCheck quote warnings reproduced on the original workflow. |
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.
Problem
Idle child sessions weren't woken by
send_messageinput or session_complete followUps.Runner log (Nov 5): adopted children logged
idle child suspended — exiting workerbut the daemon never loggedsuspending via IPC/exited. Every subsequent wake loggedresuming session…+spawning headless worker…but neverworker spawned, until the relay ended the session.Root cause
Sessions adopted after a daemon restart sit in
runningSessionswithchild: nulland no IPC channel. When one suspends:pre_suspendIPC has nowhere to go, sosuspendingis never set.session_ended, so the stale entry is never removed.spawnSessionhits the entry; the deferred-wake path needsexisting.suspending && existing.child, so it throwsSession already running.doSpawncatches it and emitssession_errorwith no log. The server's wake times out after 15s and the message is never delivered.Children spawned by the current daemon were unaffected.
Fix
session-spawner.ts: a wake (isWake) replaces an adopted, child-less entry. The relay only wakes sessions it holds as suspended/offline, so the old worker is gone. Non-wake spawns still throw.daemon.ts: log spawn failures instead of swallowing them.Verification
bun test packages/cli/src/runner/session-spawner.test.ts: 15/15 pass.