Skip to content

Stop top-level parent agents from re-asking child thread questions in chat - #5248

Open
brsbl wants to merge 3 commits into
mainfrom
bb/stop-parents-re-asking-child-questions-thr_zmqsceykw5
Open

brsbl wants to merge 3 commits into
mainfrom
bb/stop-parents-re-asking-child-questions-thr_zmqsceykw5

Conversation

@brsbl

@brsbl brsbl commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

When a child thread waits on a pending interaction, the server wakes its parent agent with the "child thread needs attention" system message. Its last instruction was "Otherwise, ask the user for the missing decision." So a top-level parent that couldn't answer from context asked the user again, sometimes with its own blocking question card under the child's, duplicating the question the user already sees and answers from the parent's child threads prompt.

What changed

  • packages/templates/src/templates/system-message-child-thread-needs-attention.md: the parent still replies to the child with guidance when it can resolve the blocker from context. Otherwise, the closing instruction depends on a new optional parentIsChildThread template variable:
    • Top-level parent (no parent of its own): it must not ask the user or restate the question in chat, and ends its turn with at most one short line.
    • Parent that is itself a child thread: keeps main's instruction, "Otherwise, ask the user for the missing decision." Its question then raises its own needs-attention notification, so the blocker still bubbles up to the thread above it.
  • apps/server/src/internal/interactive-requests.ts: when it queues the notification, the server loads the parent thread and sets the flag when that parent is a parent-notifiable child (isParentNotifiableChildThread, the same predicate that decides whether its own questions reach its parent). child-thread-notifications.ts passes it to the template. The server makes this choice; the agent doesn't have to work out where it sits.
  • Tests: templates.test.ts renders both variants exactly. A new route test in internal-interactive-requests.test.ts registers a pending interaction on a leaf in a top → middle → leaf chain and asserts the middle parent gets the "ask the user" variant. The existing top-level route test still asserts the quiet variant, and the remaining call sites pass the new argument.

Server-owned prompt text and server-side variant selection only. The notification is still sent, and the "needs attention" timeline row is unchanged. No API, SDK, CLI, DB, or daemon protocol changes.

How you verified

CI runs remotely. I checked it live on this branch's dev app (pnpm dev, isolated data dir) with Claude Code Sonnet 5.5 threads. Each leaf or child was told "Use AskUserQuestion to ask me which color to use, Red or Blue."

Case Before (merge base 9a47d42c78) After (PR head)
2-level: top-level parent has no answer in context Opened its own AskUserQuestion "Which color should be used?", a second blocking card under the child's Wrote one line, "Leaving this for the user: nothing in my context says which color to use.", and went idle
2-level: parent was told earlier "the color is Blue" bb thread tell <child> 'Use Blue. The user has already decided the color is Blue.' bb thread tell <child> 'Use Blue.'
3-level: top → middle → leaf; neither parent knows Middle asked the user (AskUserQuestion), which reached the top; the top then opened a third AskUserQuestion restating it Middle got the "ask the user" variant and asked, which reached the top. The top got the quiet variant and wrote one line: "The user will answer this in the child threads banner, and I have no context to resolve it."

2-level, before: the parent re-asks the child's question

Before: parent timeline with a duplicate question card

2-level, after: the parent leaves the question to the user and writes one line

After: parent timeline with one short line and only the child's question

3-level, before (top thread): the middle's question arrives and the top asks it a third time

Before: top thread with the middle's question plus the top's own restated question

3-level, after (top thread): the middle's question still reaches the top; the top adds one line and no extra question

After: top thread with the middle's question and one short line

QA checklist

Do Expect
In a top-level thread with no relevant context, spawn a child that runs AskUserQuestion (Red or Blue) The parent gets the needs-attention message, writes at most one short line, doesn't ask the question in chat or with its own question tool, and goes idle
Tell a top-level parent "the color is Blue", then spawn the same child The parent runs bb thread tell <child> with guidance ("Use Blue.")
Build top → middle → leaf, where the leaf runs the same AskUserQuestion and neither parent knows the answer The middle asks the user for the decision; its question shows in the top thread with "From "; the top writes at most one short line and doesn't add its own question

BB-Thread: Stop parents re-asking child questions

🤖 Generated with Claude Code

AGENT GENERATED

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T07:38:51.539695Z a2b2d79 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

brsbl and others added 2 commits October 9, 2026 09:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brsbl brsbl changed the title Stop parent agents from re-asking child thread questions in chat Stop top-level parent agents from re-asking child thread questions in chat Oct 9, 2026

This branch has not been deployed

No deployments
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