Repository navigation
fix(subagent): wake an idle parent when a background lane settles - #230
Merged
Merged
Conversation
added 3 commits
October 9, 2026 19:22
Lane notifications were sent with { deliverAs: "steer" } only. A steer
reaches the model only while the parent is mid-turn; when the parent is
idle, which is exactly when it waits on background lanes, the message is
appended and no turn starts. A parent told to "wait for the lanes and
report" therefore never saw the results until the user typed again.
Done, failed, interrupted, and needs-input events now pass
triggerTurn: true. Progress and restart notices still only ride along,
so a progress subscription does not wake the parent every 15s per lane.
Passing triggerTurn: false made AgentSession defer background_progress and background_restarted to the end of a running turn instead of steering them in. Leave triggerTurn unset for non-waking events so they steer mid-turn and only append while the parent is idle.
# Conflicts: # packages/coding-agent/src/features/subagent/lane-events.ts
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
Start a few background subagents (
run_in_background: true) and tell the parent to wait and report. The lanes finish, their completion entries show up in the transcript, and then nothing happens: the parent never reports.The session log shows the parent's last turn ending (
stop) right after it started the lanes. Every notification that arrived afterwards was appended to the session without starting a turn, including all fourbackground_doneevents.Lane notifications were sent with
{ deliverAs: "steer" }only. InAgentSession.sendCustomMessage, a steer reaches the model only while the parent is streaming; when the parent is idle andtriggerTurnis unset, the message is just appended. Background lanes almost always settle while the parent sits idle waiting on them, so the model never read the result until the user typed again. Cron already sends{ deliverAs: "steer", triggerTurn: true }and doesn't have this problem.Change
notifyLaneEventnow setstriggerTurnper event:background_done,background_failed,background_interrupted,background_needs_inputbackground_progress,background_restartedProgress stays non-waking on purpose: with
subscribe: "progress", waking would restart the parent every 15s per lane. While the parent is mid-turn, both kinds still steer into that turn as before.Testing
triggerTurn: true. A new test covers which events wake: progress, restarted, needs-input, and failed. Both fail onmain.pnpm run checkpasses.step-5-preview, with two background lanes (sleep 20 / sleep 30) and the parent told to wait and report. The parent woke after the first lane ("A done, waiting for B") and again after the second, then reported both results.Related
Independent of #227 and #229. Not addressed here: progress notifications that pile up while the parent is idle all enter its context on the next turn. Dropping stale ones when a lane settles would be a separate change.