Skip to content

fix(subagents): Run child watch events as agent invocations - #2134

Merged
dcramer merged 2 commits into
mainfrom
fix/child-agent-watches
Oct 14, 2026
Merged

dcramer merged 2 commits into
mainfrom
fix/child-agent-watches

Conversation

@sentry-junior

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

Copy link
Copy Markdown
Contributor

A child agent's watches failed. A timer that a child set went to the root turn worker, which needs a Destination, and a child has none. The event dead-lettered after five retries (Sentry issue 7792281477).

Child watch events now take the same path as child results and messages from #2135: each batch starts an agent invocation on the child, and its result goes to the parent. It follows the root rules for an Event Turn: the same burst window, the event system actor, and a timer's own grants.

  • A child's watch turns count toward its automated-turn limit. A spawnAgent task or messageAgent message from the parent resets the count.
  • The child_agent prompt, reportBlocked, and messageAgent depend on parentConversationId, not on the input source, so a child woken by a watch keeps them.
  • listAgents does not show a watch event as the child's task.

Session stop. A new junior_conversations.stopped_at column (migration 0053) records a stop the same way for roots and children. A stop ends the watches of the conversation and everything under it, then records stopped_at. The worker drops watch events, agent results, and agent messages received at or before it, so an event already queued for an idle child no longer runs. stopAgent and the Slack stop keyword both use it; the stop button still only interrupts the current turn. A stopped idle child now shows stopped in listAgents, and messageAgent starts it again.

Tool audit: handoff, interactive-auth, and nesting past maxAgentDepth stay off for children. Automation tools, slackPublicSearch, and addReaction already need a Slack source. Slack write tools such as sendFiles stay on, so a child can post in the root thread, as a root event run can.

Follow-up: a limit for parent → child → parent loops (#881).

Tests: a child timer runs as the event actor, reports to the parent, counts toward the turn limit, is dropped after a stop, and works again after messageAgent. A root timer is dropped after a session stop, and a watch set later still fires.

via David Cramer.

--

View Junior Session [Sentry]

@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 14, 2026 9:36pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Oct 14, 2026

@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.

@sentry-junior sentry-junior Bot changed the title fix(subagents): Route all child conversation input through the child worker fix(subagents): Route all child agent work through the child worker Oct 14, 2026

@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 03de0c1. Configure here.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

4 screenshot changes — 4 changed · 0 added · 0 removed

Review screenshots in Frameshift

Conversation Stop Active · Desktop
Conversation Stop Active · Desktop
Changed
Conversation Stop Active · Mobile
Conversation Stop Active · Mobile
Changed
Person Profile · Desktop
Person Profile · Desktop
Changed
Person Profile · Mobile
Person Profile · Mobile
Changed

sentry-junior Bot and others added 2 commits October 14, 2026 21:35
A child agent's timer or watch event reached the root turn worker, which
needs a Destination, so it failed and dead-lettered. Child mailbox input now
goes through one path: results, messages, and watch events each start an
agent invocation on the child that reports to its parent.

Watch events follow the root Event Turn rules: same burst window, event
system Actor, and timer credential subject. They count toward the child's
automated-turn limit; a task or message from the parent resets it. Stopping
a child ends the watches of its whole tree. Child prompt mode, reportBlocked,
and messageAgent now key off parentConversationId instead of the Source.

Co-Authored-By: David Cramer <[email protected]>
A stop now records junior_conversations.stopped_at for every Conversation
it stops, after their watches end. The worker drops watch events, agent
results, and agent messages received at or before that time, so an idle
child no longer runs an event that reached it before the stop.

Roots and children use the same session stop: the Slack stop keyword calls
stopConversationSession, which ends the root's watches, records the stop,
and stops its child agents. stopAgent records it the same way. listAgents
shows a child as stopped until a later agent invocation starts on it, and
stopAgent reports stopped: true for an idle child.

Co-Authored-By: David Cramer <[email protected]>
@sentry-junior
sentry-junior Bot force-pushed the fix/child-agent-watches branch from cea834a to 27b40af Compare October 14, 2026 21:35
@sentry-junior sentry-junior Bot changed the title fix(subagents): Route all child agent work through the child worker fix(subagents): Run child watch events as agent invocations Oct 14, 2026
@dcramer
dcramer merged commit db12720 into main Oct 14, 2026
48 checks passed
@dcramer
dcramer deleted the fix/child-agent-watches branch October 14, 2026 23:18

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 27b40af9 Deployed Oct 14, 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