Skip to content

add subagent done notifications#212

Open
erikswedberg wants to merge 1 commit into
boldsoftware:mainfrom
erikswedberg:subagent-done-notifications
Open

add subagent done notifications#212
erikswedberg wants to merge 1 commit into
boldsoftware:mainfrom
erikswedberg:subagent-done-notifications

Conversation

@erikswedberg
Copy link
Copy Markdown
Contributor

Subagent done notifications

The problem

Subagents force a bad choice: block or forget. With wait: true (the default), the parent sits there stuck until the subagent finishes — serial execution, no parallelism. With wait: false, the parent keeps working, but it never finds out the subagent finished. The results just sit there until the user manually prompts "check on that subagent." Neither option is good: you either waste time blocking, or you waste time chasing down results.

The infrastructure for async is already there — wait: false exists, QueueUserMessage exists, the loop checks for injected messages between tool calls. But without notifications, async subagents are fire-and-forget. The parent has no way to know when results are ready.

What this changes

When a subagent's agentWorking transitions to false, an onDone callback fires. This looks up the parent conversation, grabs the subagent's last assistant response (truncated to 500 chars), and injects a [Subagent 'slug' finished]\n<summary> user message into the parent's loop. The parent sees it between tool calls and can act on the results, catch errors, or adjust its plan without waiting for its own turn to end and without the user having to prompt it.

Done notifications make wait: false actually usable. The parent keeps working while subagents run, and gets notified with a summary when each one finishes — so it can react, catch errors, and incorporate results within the same turn. No blocking, no forgetting. Subagents go from fire-and-wait to genuinely async and interactive: launch, continue working, react when results arrive.

What it feels like

Before: you either block with wait: true and watch the parent do nothing for minutes, or use wait: false and then spend time prompting "go check on that subagent" and discovering one of them went sideways after the fact.

After: subagent results flow into the parent automatically — the parent reacts to a subagent finishing, checks if the output makes sense, and incorporates it into its work, all within the same turn.

Changes

  • server/convo.go: onDone callback field on ConversationManager, called from SetAgentWorking when transitioning to not-working
  • server/server.go: notifyParentSubagentDone method; onDone wired in getOrCreateSubagentConversationManager
  • AGENTS.md: guideline about preferring wait: false for subagents

What it doesn't change

  • loop.go is untouched — QueueUserMessage and the between-tool-calls check already existed
  • drainPendingMessages is untouched
  • No UI changes, no DB migrations, no new tools

How to test

  1. Ask the agent to spawn subagents with wait: false — e.g. "launch two subagents: one to count the Go files in this repo, one to count the TypeScript files"
  2. Watch the parent keep working after spawning them
  3. When each subagent finishes, a [Subagent 'slug' finished] message appears in the parent's conversation with a summary of the result
  4. The parent reacts to the notification and incorporates the results — no manual "go check on that subagent" prompting needed

Predictable model (no API key needed):

  1. Build and run with --predictable-only
  2. Subagent notifications can be verified by watching logs for Notified parent of subagent completion

When a subagent finishes (agentWorking transitions to false), notify
the parent conversation by injecting a summary message into its loop.
This makes wait:false actually usable: the parent keeps working while
subagents run, and gets notified with results when each one finishes —
no blocking, no manual 'check on that subagent' prompting.

Changes:
- server/convo.go: onDone callback field on ConversationManager,
  called from SetAgentWorking when transitioning to not-working
- server/server.go: notifyParentSubagentDone looks up parent,
  grabs last assistant response (truncated to 500 chars), injects
  [Subagent 'slug' finished] message into parent's loop
- AGENTS.md: guideline to prefer wait:false for subagents

Co-authored-by: Shelley <shelley@exe.dev>
@cla-bot cla-bot Bot added the cla-signed label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant