Skip to content

feat(agents): Read child agent state without an Agent invocation row - #3226

Merged
dcramer merged 8 commits into
mainfrom
feat/child-state-without-rows
Nov 12, 2026
Merged

dcramer merged 8 commits into
mainfrom
feat/child-state-without-rows

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Step 6a of #3060.

What this is for

When an agent starts a child agent (a Task or a Thread), Junior writes a row to the junior_agent_invocations table. Today that row is the only record of the child's work: whether it is still running, who started it, its permissions, and whether its result went back to the parent. Many parts of the code read that row. If the row is missing, they fail or show wrong data.

#3060 removes these rows so a child agent works like any other Conversation. This PR does not remove them. It only makes every reader work without a row.

What changes now

Nothing you can see. Junior still writes a row for every child, and each reader uses the row when it exists, as on main. The new code runs only for a child that has no row, and this PR creates none.

After this ships, the next PR (6b) can stop writing rows behind a flag. If 6b goes wrong, a rollback to this release is safe, because this release already reads children with and without rows.

How a child without a row is read

  • Work from the parent: the parent's task or message waits in the child's mailbox as a normal message, with the parent's identity and permissions. The child checks that the message comes from its real parent. If not, it drops the message. The child then runs the same Turn code as a normal Conversation.
  • Status: "is the child running, done, failed, or stopped" comes from the child's own Turns and mailbox. This covers searchAgents, waiting_on, and the dashboard.
  • Who sent a reply: each reply or result a child sends now stores its sender as plain fields (Conversation, Turn, and the row id if there is one). Before, readers got the sender from the message id. Now the id is only a key that stops duplicate messages. Messages from before this release have no fields, so one small fallback still reads the sender from the id. The release after this one removes it.
  • Settings and limits: a new nullable column, agent_config_json, will hold the child's settings (agent type, fork, reasoning level). This PR does not write it. Stop, archive, the queue limit, and the dashboard labels read the child's Conversation instead of the row.

Notes

  • The architecture check baseline goes up by 5. Readers that branch between children with and without a row are now counted; before, the id parsing hid them. Step 7 removes them.

Rollback: revert this PR. The new column is nullable and unused while rows are still written.

via @dcramer.

--

View Session [Sentry]

Step 6a of #3060. Rows are still written. Every reader now works when a
child has no Agent invocation row: a parent task runs on the root Turn
code as the parent Turn's Actor with its grants, status comes from the
child's Turns and mailbox, reply ids can name the child Conversation,
and spawn options live on the child Conversation.

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

vercel Bot commented Nov 12, 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 Nov 12, 2026 10:08pm UTC

Request Review

Verify that a parent message names the child's stored parent, and drop
and log it otherwise. Route it to an open Agent invocation first. Label
it as the instruction for Guardian, and accept an ancestor's timer
grant only on a checked parent message.

Count children without a row in open child work, the per-child queue
limit, the stopped check, archive, and dashboard labels.

Rename agent.task to agent.parent_message and spell out Agent
invocation in names.

Refs #3060

Co-Authored-By: David Cramer <[email protected]>
Count only replies from children without a row as open child work, and
report a parent's replaced result only after a completed Turn of a child
without a row. Log a dropped parent message once, where the child drops
it.

Refs #3060

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

dcramer commented Nov 12, 2026

Copy link
Copy Markdown
Member

spawn options would be shared through all kinds right? like agents should have one shared set of typed configuration, and while that might vary by kind, shouldnt need their own special cased columns/etc

Resolve conflicts in list.ts (batched Conversation loop check),
conversation-turn.ts (instruction Actor), and the migration journal.
Regenerate the child column as migration 0105 and name it as a shared
agent config: agent_config_json, typed as AgentConfig for every kind.
@sentry-junior

sentry-junior Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Yes. In 612251c the column is now agent_config_json, one typed AgentConfig (agentType, fork, reasoningLevel) in chat/conversations/agent-config.ts for every kind. A kind sets only the fields that apply to it, and no kind gets its own column. In 6a only spawns without an Agent invocation row write it; roots and Automations can use the same shape later.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automation Skill Editor · Desktop
Automation Skill Editor · Desktop
Changed
Automation Skill Editor · Mobile
Automation Skill Editor · Mobile
Changed
Automations Runs Filters · Desktop
Automations Runs Filters · Desktop
Changed
Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Attachment · Mobile
Conversation Attachment · Mobile
Changed
Show 11 more changed screenshots
Conversation Attachment Modal · Desktop
Conversation Attachment Modal · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
Changed
Conversation Attachment Zoom · Mobile
Conversation Attachment Zoom · Mobile
Changed
Conversation Captured Memories Popover · Desktop
Conversation Captured Memories Popover · Desktop
Changed
Conversation Details Watched Linked Work · Desktop
Conversation Details Watched Linked Work · Desktop
Changed
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Conversation Object Links · Desktop
Conversation Object Links · Desktop
Changed
Memories · Mobile
Memories · Mobile
Changed
Push Notifications Tip · Desktop
Push Notifications Tip · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed
System Cache Tokens · Desktop
System Cache Tokens · Desktop
Changed

Child replies and results store their sender Conversation, Turn, and
Agent invocation in input.metadata.sender. The mailbox keeps those fields
next to each id, so readers no longer parse message ids. The id format is
unchanged and is only an idempotency key. Messages from before this
change go through one id fallback, marked for removal next release.

Co-Authored-By: David Cramer <[email protected]>
@dcramer
dcramer marked this pull request as ready for review November 12, 2026 20:23
@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 12, 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.

@dcramer

dcramer commented Nov 12, 2026

Copy link
Copy Markdown
Member

im going to need to you address the PR description being.. too jargon-y. im not an expert on the underlying code here and you didnt explain what this is truly doing

@sentry-junior

sentry-junior Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Rewrote the description in plain terms: why the agent invocation rows matter, why this PR changes nothing visible yet, and how each reader works for a child with no row.

…out-rows

# Conflicts:
#	packages/junior/migrations/meta/0105_snapshot.json
#	packages/junior/migrations/meta/_journal.json

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

There are 2 total unresolved issues (including 1 from previous review).

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 22c61a9. Configure here.

@dcramer
dcramer merged commit 991d498 into main Nov 12, 2026
45 checks passed
@dcramer
dcramer deleted the feat/child-state-without-rows branch November 12, 2026 22:27
dcramer added a commit that referenced this pull request Nov 14, 2026
…#3312)

Follow-up to #3226, before step 6b of #3060.

A child agent with an Agent invocation row can hold at most 4 open
messages, because each message became its own Agent invocation run. A
child with no row runs parent messages from its mailbox, like any other
input, and the mailbox has no size limit. So this removes the limit for
children with no row instead of counting their messages. Children with a
row keep the limit until step 7 deletes rows. The limit of 8 active
children per parent stays.

The shared `thread-input` test harness can now save a run's input as its
Turn's first checkpoint and pause at a yield, as the agent does, so
tests can see open Turns.

Rollback: revert this PR. Only children with no row change, and nothing
creates them until 6b.

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Abf1b82d8dc5a8d5198d56ec7f551563e -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Abf1b82d8dc5a8d5198d56ec7f551563e)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Abf1b82d8dc5a8d5198d56ec7f551563e/?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]>
sentry-junior Bot added a commit that referenced this pull request Nov 17, 2026
Agents that trip a ratchet check add a baseline entry and the check passes.
Review caught this in #3035 and #3564, and it
merged in #3460, #3226, and #3206.

baseline-growth:check compares each debt baseline to the merge base with
origin/main and fails when a rule's total rises. Totals per rule let a file
move or split without failing.

Co-Authored-By: David Cramer <[email protected]>
BYK pushed a commit that referenced this pull request Nov 21, 2026
…its check (#3612)

## Baselines can only shrink

The ratchet baselines (`type-assertions`, `await-in-loop`,
`test-architecture`, `typecheck-coverage`, `migration-locks`,
`tool-descriptions`, `file-length-exceptions`) already say "do not add
entries". But when a check trips, an agent can still add an entry and
the check passes. Review caught this on #3564 and
#3035, both from @BYK. It merged without review in
#3460, #3226, and #3206.

`pnpm baseline-growth:check` is now part of `pnpm lint`. It compares
each baseline to the merge base with `origin/main` and fails when a
rule's total goes up. The error names the baseline, the rule, and the
entries that caused it. Totals are counted per rule, so a file that
moves or splits still passes. A rule or baseline that is new in the
change is skipped, because that is how a new check gets adopted. The CI
lint job now uses `fetch-depth: 0` so it has a merge base.

`tool-error-classification-baseline.txt` is left out because it is an
allowlist of approved system errors and grows on purpose.

## Use data the system already has before you add plumbing

Agents fix missing information with new hooks, resolvers, and lookups
instead of using data the system already stores, as in
#3610, #3404, and #3457.
No check can tell a needed abstraction from a speculative one, so
`policies/correctness-complexity.md` now names this case.

## Generate deterministic output in code, not prompt text

Agents fix deterministic behavior with prompt or policy text.
#3610 first tried to fix PR links with a GitHub system
prompt change, and @dcramer rejected it: "We know if it's a pull request
or an issue. We should just be generating the right link." The bot name
in prompts (#3404) had to become a check, and
#3438 was told not to add policy text when a rule can
enforce it. `policies/agent-steering.md` now says to generate links,
IDs, and formats in code.

## Rule table

The AGENTS.md rules are now a table that says what enforces each rule. A
correction for a rule marked "Review" shows that the rule is a repeat
and needs a higher-level fix.

## Open decision

- There is no override for baseline growth. If a reviewer approves a
growth, they have to change the check. Should there be an approved
override, such as a PR label?

<!-- junior-request-attribution:start -->
via @dcramer.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A9da30a1e94fc26f2b83022cfd8dd95fc -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A9da30a1e94fc26f2b83022cfd8dd95fc)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A9da30a1e94fc26f2b83022cfd8dd95fc/?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 branch was successfully deployed

1 active deployment
Preview – junior-docs — 22c61a9e Deployed Nov 12, 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