Skip to content

fix: skip child-turn notices for children waiting on CI or that already messaged the parent - #375

Merged
brtkwr merged 1 commit into
mainfrom
fix/child-notice-cost
Nov 20, 2026
Merged

brtkwr merged 1 commit into
mainfrom
fix/child-notice-cost

Conversation

@brtkwr

@brtkwr brtkwr commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Opus 5.5 ✨

Orchestrators were woken for a full turn every time a child finished one, and most of those turns did nothing. This stops the two kinds of notice that were mostly waste:

  • The child is now waiting_on_external (CI running, a reviewer, its own tasks, subagents or a wake-up). The parent can't act yet, and ccs watch already nudges the child when a check fails. A child that asks a question still gets through, because waiting_on_user is decided before waiting_on_external.
  • The child sent the parent a SendMessage at any point in the turn, such as a HANDOVER followed by more work. Before, only a SendMessage as the turn's very last tool call counted. A message queued mid-turn no longer clears what the turn had already sent.

Idle, done and waiting-on-user notices are unchanged, so a child that goes quiet without reporting is still told.

Why: what the notices cost

Measured on 20 Nov from every transcript under ~/.claude/projects modified since 3 Nov, plus every child_turn line in pr-events.jsonl. These are complete counts, not samples. Effective tokens use ccs's own weights (input 1x, 1h cache write 2x, cache read 0.1x, output 5x) priced at $5 per million.

  • The first notice went out on 19 Nov at 21:05 (+0545). 442 were delivered in the 22.5 hours after: 334 to orchestrator, the rest to three sub-orchestrators.
  • The turns those notices started: 380 turns, 32.8M effective tokens, about $164. That is 38% of the four parent sessions' spend, and 20% of all main-transcript spend ($831) in the same window. Nearly all of it is cache reads: a median notice turn is one API call that re-reads about 640k tokens of context.
  • 314 of the 380 turns (83%) took no action: 287 were a one-line acknowledgement with no tool call, and 27 only read or checked something.
  • By the child's state: waiting_on_external 270, idle 142, waiting_on_user 31, done 1.
Change Notices cut Saving (of $164)
Skip waiting_on_external 270 (61%) about $98
Skip when the child messaged the parent in the turn 127 (29%) about $35
Both, overlap removed 330 (75%) about $116 (71%)

The second row is an estimate, because transcripts don't mark where a child's turn began. It counts notices where the child had messaged that parent in the 10 minutes before.

The daily totals don't show the notices causing a jump. Spend rose to 320-380M effective tokens a day on 17-18 Nov, before any notice existed. The notices were about 17% of 20 Nov's spend.

Tests

TestChildTurnSkipsSentEarlierAndWaiting checks four cases:

  • a SendMessage to the parent followed by more tool calls is skipped
  • a SendMessage before a message queued mid-turn is skipped
  • a SendMessage in an earlier turn doesn't stop the current turn being told
  • a child waiting on CI isn't told, but the same child asking a question is

The new tests pass locally under -race -count=2. CI runs the full suite.

🤖 Generated with Claude Code

…dy messaged the parent

An orchestrator woke for a full turn on every child Stop, and most of
those turns were a one-line acknowledgement. Two notices now aren't sent:

- the child is waiting_on_external (CI, a reviewer, its tasks, subagents
  or a wake-up): the parent can do nothing yet, and ccs watch nudges the
  child when a check fails. A question still gets through, since
  waiting_on_user is decided first.
- the child sent the parent a SendMessage at any point in the turn, not
  only as its last tool call. A message queued mid-turn no longer clears
  what the turn already sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brtkwr
brtkwr enabled auto-merge November 20, 2026 14:01
@brtkwr
brtkwr merged commit ed77020 into main Nov 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant