Skip to content

Control how often a child thread wakes its parent: every N turns or after an idle interval #5831

Description

@cristoslc

The workflow

I run one orchestrating parent thread that spawns child threads for parallel work and reports back a summary when the batch is done. I want the parent to receive periodic progress, not a wake on every child turn, and not silence until the end.

Concretely, I want to choose a cadence per child: report every N finished turns, or report only after the child has been idle for some interval. Failures, interruptions, and blockers should still wake the parent immediately, because those need a decision.

What happens today

main at e1f27dbf30ad9456275d09ee22073766c45ee65f already filters which outcomes notify the parent. parentNotifications is auto | stuck | off, added in #5578:

apps/server/src/services/threads/thread-parent.ts
12: export function isParentNotifiableChildThread<
27:     case "stuck":

So the outcome dimension is covered. What is missing is a cadence dimension. Under auto, every qualifying turn end still wakes the parent. The only dampener is a fixed 2 second coalescing window that batches children completing at nearly the same moment:

apps/server/src/services/threads/child-thread-notifications.ts
78: const CHILD_THREAD_TURN_NOTIFICATION_BATCH_DELAY_MS = 2_000;

Two seconds collapses bursts. It does nothing for a child that runs 50 turns over ten minutes.

Measured on my own database (~/.bb/bb.db, bb 0.46.1, 2026-09-23 through 2026-10-20), counting parent turns whose request carried a child system message:

systemMessageKind        count
child-completed           1323
child-failed                85
child-outcome-batch         25
child-interrupted            7
child-needs-attention        2

1,323 child-completed wakes. Two parent threads account for 421 of them:

thread_id         child-completed notices
thr_eqqq6bmzug    270
thr_tf8zuywpur    151

Each of those is a separate parent turn that re-reads the parent's context to answer a notice that usually needs no reply. #5560 measured the same effect on one orchestrator at 1,779 notices between 9/29 and 10/14 and put the cost at $12.34 for 26 notices, a mean of $0.47 per wake.

None of auto, stuck, or off express "report every 5th turn" or "report after 2 minutes idle." The choice is every qualifying outcome, or none of the successes.

What you would expect

A cadence control alongside the existing outcome filter, so a child can report on a schedule instead of per turn. For example:

bb thread spawn --parent-self --parent-notifications auto \
  --parent-notification-cadence every-5-turns
bb thread update thr_child --parent-notification-cadence idle-2m

Meaning:

  • every-n-turns batches n completed turns into one parent notice, carrying the same footer the current batch notice uses so the parent can tell it is a summary.
  • idle-2m sends one notice once the child has had no turn for the interval, so a burst of short turns produces one wake at the end.
  • immediate stays the default and preserves today's behavior.
  • Failures, interruptions, and blockers (child-failed, child-interrupted, child-needs-attention) always bypass the cadence and wake the parent at once.
  • A pending cadence flush is delivered when the child is archived or stopped, so a burst never ends silently.

Acceptance sketch

  1. Spawn a parent and a child with --parent-notifications auto --parent-notification-cadence every-3-turns, and drive six successful turns in the child.

  2. Observe exactly two child-completed turns in the parent's log, the second one at turn 6 and both marked as batched summaries:

    bb thread log <parent-thread-id>
  3. Repeat with --parent-notification-cadence idle-2m and drive five turns in under a minute, then wait past two minutes. Observe one parent notice, after the idle interval, not five.

  4. In a run governed by every-3-turns, make the child's second turn fail. Observe child-failed in the parent immediately, not at turn 3.

  5. Set --parent-notification-cadence immediate and observe a notice on every completed turn, matching 0.46.1 behavior.

Context and alternatives

What I do today is set --parent-notifications off on chatty children and have the parent poll them with bb thread tell, which moves the token cost into the parent's own polling turns rather than removing it. #5560 describes blocking the wake with a UserPromptSubmit hook, which also pays for the wake before it is blocked.

The shapes I considered and did not pick:

  • A higher coalescing window alone. A fixed window still wakes once per window per parent, and a child that runs a turn every 90 seconds with a 2 minute window still wakes every 90 seconds in the worst case.
  • Percentile or token-budget thresholds. Harder to predict from the outside than a turn count or an idle interval, and the operator cannot state the intent in a flag.
  • Folding cadence into the parentNotifications enum, for example stuck plus batched. It multiplies the enum and conflates two independent choices: which outcomes matter, and how often to hear about them. A separate axis keeps auto | stuck | off intact and lets stuck and a cadence compose.

Issue / reference to issue

Environment

  • bb 0.46.1 installed (desktop app on macOS), /Users/cristos/Library/.../bb-app, CLI at /Users/cristos/.local/bin/bb.
  • Source read at origin/main e1f27dbf30ad9456275d09ee22073766c45ee65f.
  • parentNotifications is absent from the 0.46.1 CLI and from the installed database schema (pragma table_info(threads) has no parent_notifications column), so Let child threads control which outcomes notify their parent #5578 is unreleased at the time of filing.
  • Counts taken from ~/.bb/bb.db, events table filtered on type = 'client/turn/requested' and json_extract(data, '$.systemMessageKind').

What I ruled out

Suggested priority and effort (optional)

Medium priority, medium effort. Token and money cost is measurable and ongoing for anyone running an orchestrator with several children: 1,323 wakes in my database, and $12.34 for 26 wakes in the #5560 measurement. A workaround exists (parent-notifications off plus parent polling) but it trades wakes for polling turns rather than removing cost, and it loses failure reporting unless stuck is used. No data loss. Touches the thread schema, the spawn/update CLI and SDK surfaces, and the server-side notification gate, following the shape #5578 established.

Checks

  • I searched open and closed issues for the same request.
  • If an agent wrote this, the body ends with > AGENT GENERATED.

AGENT GENERATED

Activity

  1. added
    threads
    on Oct 20, 2026
  2. bb-slop-cop commented on Oct 20, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied missing classifications:

    • Type: Feature
    • Priority: Medium
    • Effort: High
    • Labels: threads

    This adds notification scheduling beyond the existing outcome filter. Priority is Medium because workarounds exist; effort is High because persistent cadence settings and scheduling lifecycle behavior require a new design across storage and public interfaces. No existing classifications were replaced; all applied values were verified.

    No reproduction report or pull request: this is a feature request, not a bug.

  3. SawyerHood commented on Oct 20, 2026

    @SawyerHood
    Collaborator

    Backlog comparison: coordinate with #4487 and #5560, but keep this cadence request separate.

    #4487 asks for explicit completion-only reporting while retaining failure/interruption reporting. #5560 asks for parent-origin filtering and distinct script provenance. This issue instead requests every-N-turn or idle-interval batching, urgent-outcome bypass, and a final flush on archive/stop. None is an exact duplicate of the others.

    Also preserve the distinction from merged #5578: auto/stuck/off selects outcomes, not cadence. stuck still reports questions and off suppresses failures, so it does not fully satisfy #4487 either. Reuse the shared notification policy rather than implementing independent delivery loops.

    AGENT GENERATED

  4. bloodcarter commented on Oct 22, 2026

    @bloodcarter

    Adding a multi-level use case for this cadence request, plus one ask about #5578.

    We run a three-level tree: one coordinating thread, several project-lead threads under it, and worker threads under each lead. On bb 0.46.1 (macOS), every worker turn end wakes its lead, and every lead turn end then wakes the coordinator, so routine wakes cascade up the tree. In one hour today, a single lead with five workers was woken 10 times by child-completed notices, and each of those lead turns woke the coordinator in turn. Every wake is a full-context model request. Because the coordinator is a top-level thread with push level all, each one also became a push notification to the user.

    What would solve it for us, per child, set at spawn and changeable with bb thread update:

    1. A desktop release that includes Let child threads control which outcomes notify their parent #5578. --parent-notifications stuck keeps failures, interruptions and question/approval blockers immediate and drops routine completions. That alone removes most of the cascade. 0.46.1 was cut a few hours before Let child threads control which outcomes notify their parent #5578 merged, so we can't use it yet.
    2. The cadence in this issue, as a supervision signal. Long-running children can work for hours inside a turn, or across many quiet turns, without the parent seeing anything. A periodic progress digest (every N turns, or every M minutes while the child is active, skipping idle children) would let a lead catch a child drifting from its brief early, without being woken on every turn.
    3. Nice to have: a way for the child to mark one turn's final message as "report to parent" for milestones, so stuck plus explicit milestones covers the rest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    threads

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions