Repository navigation
feat(subagents): Add messageAgent and drop spawnAgent name reuse - #2135
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
11 of 35 tasks
spawnAgent now only starts a new child agent. A name that is already used fails with AgentNameInUseError and points to messageAgent. messageAgent sends an agent message to "parent" or to a direct child, by name or conversation_id. - Parent to child: the message starts a new agent invocation on the child, and the child keeps its history. A busy child runs it after its current work, and one result covers both. - Child to parent: the message wakes the parent as a junior/agent.message Event. It uses the same mailbox and Actor path as child results. A stop of the sender keeps a message that it already sent. A stop of the parent drops it. listAgents returns status (pending, running, paused, idle, stopped) and last_result (completed, blocked, failed) instead of the raw agent invocation status. Child listing moves to list.ts and the tree stop SQL moves to stop.ts, so store.ts stays under the file length limit. Refs #2105 Co-Authored-By: David Cramer <[email protected]>
dcramer
approved these changes
Oct 14, 2026
Co-Authored-By: David Cramer <[email protected]>
sentry-junior
Bot
force-pushed
the
feat/message-agent
branch
from
October 14, 2026 19:52
0d62d7e to
375f745
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 375f745. Configure here.
dcramer
added a commit
that referenced
this pull request
Oct 14, 2026
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. <!-- junior-request-attribution:start --> via **David Cramer**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0B595QDZLL%3A1791993640.607069 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AC0B595QDZLL%3A1791993640.607069) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0B595QDZLL%3A1791993640.607069/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
This was referenced Oct 14, 2026
This was referenced Nov 2, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add a
messageAgenttool so an agent can send work or information to an agent that already exists. This is the first part of the agent coordination tools in #2105.spawnAgentonly starts a new child. A name that is already used fails withAgentNameInUseErrorand points the model tomessageAgent. Before this change, name reuse was how a parent gave a child more work.messageAgent(to, text)takes"parent", or the name orconversation_idof a direct child.delivery: "started". A busy child returnsdelivery: "queued"and runs the message after its current work; the earlier work ends asreplaced, so the parent gets one result for both.junior/agent.messageEvent on the same mailbox and Actor path as child results. It is marked as not from a person, so it gives no user approval.listAgentsreturnsstatus(pending | running | paused | idle | stopped) andlast_result(completed | blocked | failed) instead of the raw agent invocation status. The dashboard API does not change.stopAgentdoes not change. A stopped child keeps its name, andmessageAgentcan start new work on it. A stop of a child tree drops messages that were sent into that tree.Limits: at most 4 open agent invocations per child, and message text up to 8,000 characters. The active-child limit per parent now counts children, not agent invocations, so queued messages do not count twice.
Not in this PR (tracked in #2105): mid-turn delivery to a running child, messages to siblings, idle notices, and message previews in the dashboard. The local CLI does not give
messageAgentto child runs, because it does not send child output back to the root.store.tswas over the 1,000-line limit, so child listing moved toagent-invocations/list.tsand the tree-stop SQL moved toagent-invocations/stop.ts.TERMINOLOGY.mdandagent-invocations/README.mddescribe agent messages.via David Cramer.
--
View Junior Session [Sentry]