Repository navigation
Description
Summary
A child thread with --parent-notifications auto reports every completed root turn to its parent. When a later turn finishes without any agent output, the parent still gets a "completed" notice, and its excerpt is the text of an earlier turn. The parent sees the same result again as if it were new.
Versions and environment
- Observed on bb 0.48.0 desktop app (macOS 27.0). The same lookup is present on
mainat 916d684 (a server regression test of the same path fails onmain). - Providers: seen with a Codex child; the lookup is provider-independent.
Steps to reproduce
- Spawn a child with
bb thread spawn --parent-thread <parent> --parent-notifications auto …. - Let the child finish a turn with a final message, e.g. "Done: X".
- Send the child a message it answers with no text (an empty final, or a turn that only ends).
- Repeat step 3.
Expected vs actual
Expected: one notice "completed: Done: X"; the empty turns send nothing, or at least no old text.
Actual: three notices, each "completed:\n\nDone: X".
Evidence
getChildThreadCompletionOutput calls getLastThreadOutput, which selects the latest non-empty agent message of the whole thread, not of the turn that completed:
bb/apps/server/src/services/threads/child-thread-notifications.ts
Lines 241 to 249 in 916d684
| function getChildThreadCompletionOutput( | |
| deps: LoggedPendingInteractionWorkSessionDeps, | |
| args: QueueChildThreadTurnNotificationArgs, | |
| ): string | null { | |
| if (args.turnStatus !== "completed") { | |
| return null; | |
| } | |
| return getLastThreadOutput(deps.db, args.childThread.id); | |
| } |
bb/packages/db/src/data/events.ts
Lines 3554 to 3578 in 916d684
| export function getLatestThreadOutputEventRow( | |
| db: DbConnection, | |
| args: GetLatestThreadOutputEventRowArgs, | |
| ): StoredEventRow | null { | |
| return ( | |
| db | |
| .select(storedEventRowFields) | |
| .from(events) | |
| .where( | |
| sql`${events.threadId} = ${args.threadId} AND ( | |
| ( | |
| ${events.type} = 'system/manager/user_message' | |
| AND COALESCE(json_extract(${events.data}, '$.text'), '') <> '' | |
| ) | |
| OR ( | |
| ${events.type} = 'item/completed' | |
| AND ${events.itemKind} = 'agentMessage' | |
| AND COALESCE(json_extract(${events.data}, '$.item.text'), '') <> '' | |
| ) | |
| )`, | |
| ) | |
| .orderBy(desc(events.sequence)) | |
| .limit(1) | |
| .get() ?? null | |
| ); |
Observed in a real thread: turn A ended with a message; turns B and C ended with an empty agent message; the parent received the turn-A text three times (three separate turn completions, not one notice delivered three times).
What you ruled out
- Not the 2-second batching: the three completions were in separate batches.
- Not push or
thread.idlenotifications: this is the parent system message path. - The same code path is on
mainat 916d684.
Suggested priority and effort
Low effort, small fix. Affects parents of auto children: the parent receives the old result again as an extra notice and context. Whether it also causes extra parent turns was not established. No data is lost.
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 2, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotthreads.confirmed-repro.Scope child completion notices to the completed root turn (get-bb#6821)
Notify the parent from the shared interaction lifecycle (#7729)