Skip to content

Child agent work is attributed to whoever last messaged it #2626

Open

Description

@sentry-junior

When a parent sends a follow-up to an existing child agent with messageAgent, the child's result Turn runs as the Actor of the Turn that sent the message. The parent's later work, including new children it spawns, then runs as that Actor. So a person who only adds a data point to a thread becomes the requester of everything after it, and the person who started the work loses attribution.

Seen on getsentry/sentry#129728 on 2026-11-03:

  • Person A started an investigation in a Slack thread. Junior spawned a changes child.
  • Person B posted a network-tab detail and mentioned Junior. That Turn sent it to the existing changes child with messageAgent (new invocation f865…, Actor = B).
  • The result of that invocation started a parent Turn as B. That Turn spawned the revert-pr child, which also ran as B.
  • The PR says via @<B>.. The runtime assigned it to B, and both commits have only B as Co-Authored-By. A shows up only because the parent's task text told the child to run gh api … assignees by hand.
  • The PR upkeep task also stores B as the requester, so review notifications go to B.

Root cause (high confidence):

  • withAgentInvocationResultActors (packages/junior/src/chat/agent-invocations/result.ts:493) runs each result as invocation.actor. That comment says this is on purpose, so the parent keeps the authority it had at spawn time.
  • The messageAgent invocation stores the sender Turn's Actor. So "the Actor that triggered the child" is the last sender, not the spawner.
  • GitHub attribution, the assignee, and the saved PR requester all come from the single current Actor (resolveGitHubRequester / appendGitHubRequesterAttribution in packages/junior-github/src/tool-support/attribution.ts, and create-pull-request.ts:377). run.actors for the child holds only that one Actor, so commit trailers credit only B.

Related: #2105 lists "results from different Actors" as untested coverage. #2567 states "never from … whoever asked last" for the Actor of a Turn.

Raised by David Cramer.

via @dcramer.

--

View Session [Sentry]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions