Repository navigation
feat(agents): Run child Turns without an invocation on the Conversation loop - #3206
Conversation
…on loop Input to a child Conversation with no open Agent invocation now runs on the shared Conversation Turn worker. turnBehavior picks the reply target, the gate, and the failure notice. The shared loop checks the stored stop at each step and passes the child's parent to the run. Rows that are open at deploy, and parent tasks and messages, still finish on the legacy worker. Step 5 of #3060. Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…bundle A child agent's Turn on the Conversation loop can run as the web user who started it, but it cannot wait for that person to sign in. Missing auth blocks it, as on the agent invocation path. Move the child-input check out of result-event-type so the API schema entry no longer pulls server code into the dashboard build.
Keep grandchild results on Agent invocations so a rollback to main leaves no unread result that main counts as open work. Show a child whose work runs on the Conversation loop as running, send a Task's parent a failed result when its worker fails repeatedly, drop replies sent after a stop, and carry the spawn's grants to grandchild input. Count isTopLevelKind as a kind branch and restore reply card selection. Co-Authored-By: David Cramer <[email protected]>
…ersation-turn # Conflicts: # packages/junior/src/chat/agent-invocations/work.ts
Key the reply of a Turn on a child's Conversation loop by its Turn id. Under the parent mailbox lock, a child whose open Turn already has a reply in the parent's inbox is not listed in waiting_on. Co-Authored-By: David Cramer <[email protected]>
|
11 screenshot changes — 11 changed · 0 added · 0 removed Review screenshots in Frameshift |
… loop - Count only gated, non-person child Turns, and queued Watch Events, as work that answers the parent. - Drop a reply from stopped work also after the child gets a new task. - Keep the spawn's grants only for a grandchild result, not a reply. - Select a Conversation loop reply's cards from its own Turn. Co-Authored-By: David Cramer <[email protected]>
|
the PR description isnt very easy to reason about, fix it |
A grandchild result, or input to a stopped or replaced child, starts an agent invocation, so it does not keep the child running. A Turn that replies before its first checkpoint is keyed by its first input. Co-Authored-By: David Cramer <[email protected]>
…ies at stop routeChildInput now decides agent invocation, Conversation loop, or dropped for routing, the stop skips, and the child agent status. A stop drops unread replies from stopped Conversation loop Turns by message id, so a new task cannot bring them back. A Turn that replies before its first checkpoint matches any pending input's Turn id. Co-Authored-By: David Cramer <[email protected]>
…input.ts Co-Authored-By: David Cramer <[email protected]>
…dInput Co-Authored-By: David Cramer <[email protected]>
A Turn sends its reply before it saves. When its worker is then lost, the parent already has the answer, so the Task sends no failure.
… parent lock A reply stamped before a stop can reach the parent's mailbox after the stop dropped the unread ones. The append now checks the sender's stored stop under the parent mailbox lock and drops such a reply. Co-Authored-By: David Cramer <[email protected]>
…rns on a lost worker A loop reply dropped under the parent lock now records its id, so a retry of the stopped Turn is a duplicate. The lost-worker notice matches only the open Turn or pending input, not the input of earlier Turns.
|
did we address the previous cursor feedback? |
|
3 of the 4 Cursor findings are fixed and their threads are resolved:
Still open on purpose: "Mixed grandchild batch skips Conversation loop" (4543990851). If a batch mixes a grandchild |
|
needs rebased |
…ersation-turn # Conflicts: # scripts/test-architecture-baseline.json
|
Merged |
A person's stop of a child agent now also drops its unread Conversation loop replies from its parent's mailbox, as the parent's stop does. Co-Authored-By: David Cramer <[email protected]>
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 9e6e812. Configure here.
…p is stored The drop of a child's own unread loop replies now runs after stopConversation stores the stop, so the parent mailbox lock drops a later reply and a failed stop leaves the replies in place.
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]>
…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]>

Step 5 of #3060.
What changes
A child Conversation (Thread or Task) with no open Agent invocation now runs its Turns on the Conversation loop, the same loop that roots use. This covers Watch Events and replies from the child's own child agents.
These still create Agent invocation rows and finish on the legacy worker until step 6:
messageAgentHow a child Turn on the Conversation loop behaves
turnBehaviordecides this from the Conversation kind, as it does for roots.replygoes to the parent. The mailbox id includes the Turn id, so the parent can see that this Turn already answered. The child then does not show inwaiting_on.failedto a Task's parent. A Thread keeps the failure stored.searchAgentsshows the child as running while such a Turn runs, or while its Watch Event waits in the mailbox. A person's Turn in a Thread does not count.Rollback to
mainGrandchild results stay on Agent invocations. A child Turn on the Conversation loop writes only
agent-reply:mailbox messages and Turn records, andmainreads them the same way. A paused child Turn stays paused until new input comes.via @dcramer.
--
View Session [Sentry]