Skip to content

feat(subagents): Let a running child read parent messages - #2139

Merged
dcramer merged 6 commits into
mainfrom
feat/steer-running-child
Oct 15, 2026
Merged

dcramer merged 6 commits into
mainfrom
feat/steer-running-child

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2105. Until now, a parent's messageAgent message to a busy child waited for the child's current work to end. So the parent could not correct a child during a long task.

Now a running child reads a queued parent message as a steering message before its next model call. A running tool is never interrupted. The message's agent invocation ends as completed with the new parentMailboxStatus: "steered". The running agent invocation reports for both, so the parent still gets one result.

  • A message joins only if it has the Actor and credentials of the running Turn. Otherwise it and every later parent message wait, as before.
  • Messages keep defer mailbox delivery. With interrupt, a message could start an attempt while the child is paused between slices. The agent invocation worker drains them with a new deferred: true option on InboxAttempt.drain.
  • A retried drain does not give a message to the Turn twice. It skips messages that the Turn checkpoint already has, with the same withoutSavedSteeringMessages check that Slack uses for repeated mailbox deliveries. It acknowledges messages that were already marked.
  • listAgents does not use steered agent invocations for status or last_result.
  • If the child finishes without another model call, the message runs next, and the earlier work ends as replaced, as before.

Not in this change: messages between siblings, and a root parent that reads a child's message while it is running.

via David Cramer.

--

View Junior Session [Sentry]

… step

A messageAgent call to a busy child used to wait for the child's current
work. The child now reads it as a steering message before its next model
call, and its running agent invocation reports for both. The queued agent
invocation ends as steered. Messages keep defer delivery so they never run
ahead of a paused child, and a message with another Actor or other
credentials still waits.

Refs #2105

Co-Authored-By: David Cramer <[email protected]>
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Oct 15, 2026 12:41am UTC

Request Review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

The integration case ran the agent, which the test architecture check
does not allow in packages/junior/tests. Test the worker drain contract
with a fake runner instead.
…rain

A drain that saved parent messages in the Turn but failed to mark their
agent invocations left them pending, so the next drain read them again.
Skip messages that the Turn checkpoint already has and only mark them.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 65376cc. Configure here.

Fold the Actor check into the drain loop, drop checks that always pass,
and shorten the README and test.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior sentry-junior Bot changed the title feat(subagents): Let a running child read parent messages at its next step feat(subagents): Let a running child read parent messages Oct 14, 2026
The retry check compared raw parent text against saved steering text.
The Turn saves that text wrapped and XML-escaped, so a message with
quotes, & or <> did not match and the child read it twice. Build the
steering Pi message and compare it to the saved message instead.

@dcramer dcramer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice - as mentioned in previous runs - if this shared the same logic vs having to reimplement it form the parent agent as much as possible

The child steering drain had its own check for a steering message
that the Turn already saved. Slack had the same check in two places.
Move the Slack key into withoutSavedSteeringMessages beside
buildSteeringPiMessage, and use it in all three places.
@dcramer
dcramer merged commit 6369669 into main Oct 15, 2026
48 checks passed
@dcramer
dcramer deleted the feat/steer-running-child branch October 15, 2026 00:47

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 17d8c522 Deployed Oct 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant