Repository navigation
fix(agents): List a child whose last Turn failed as failed - #4057
Merged
Merged
Conversation
A child Turn that ends with a model error finishes normally, so the Conversation execution goes back to idle. The child listing read only executionStatus and showed the child as completed, and listAgents showed it as idle with no last_result. Read the last Turn failure from the Turn lifecycle Events with conversationTurnFailedSql, as Conversation status does, and set lastResult to failed.
isDroppedChildInput read the child row twice for each parent message: once to check the stored parent and once for the stop. The child listing calls it for each running child, so each one cost two statements. Read the stop in the stored-parent query.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Found 1 test failure on Blacksmith runners: Failure
|
dcramer
marked this pull request as ready for review
November 22, 2026 23:21
dcramer
approved these changes
Nov 22, 2026
22 tasks done
dcramer
added a commit
that referenced
this pull request
Nov 26, 2026
…#4173) `listAgents` lost `last_result` `done` and `blocked` when the legacy Agent invocation rows went away (#4043). Only `failed` came back, in #4057. It now uses main's `readTurnUpdate` mapping. `turn-update.ts` exports `TURN_OUTCOME_STATUSES`, which both `readTurnUpdate` and `listChildAgents` use. So `last_result` uses the same words as `<agent-result status>`: `done`, `blocked`, or `failed` (it was `completed` before). The listing reads the child's own Turn lifecycle Events: the newest `turn_completed` or `turn_failed` that is not a stop. `turn_failed` gives `failed`. A cancelled Turn is skipped, so a stop or a retry keeps the result from before it. `conversationTurnFailedSql` still decides the child's `failed` status. A person's Turn in a Thread counts like any other Turn. The read is a subquery in the existing listing query, so it adds no statement. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A1147859c7bef54b3d23b1df19a540b2d --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A1147859c7bef54b3d23b1df19a540b2d) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A1147859c7bef54b3d23b1df19a540b2d/?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
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.
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-v2-3x.png)
A child Turn that ends with a model error finishes normally, so the child's Conversation execution goes back to
idle.listChildAgentsread onlyexecutionStatus, so such a child showed ascompletedin the dashboard and API, andlistAgentsshowed it asidlewith nolast_result. The listing now reads the last Turn failure from the Turn lifecycle Events withconversationTurnFailedSql, the same rule that Conversation status uses, and setslastResult: "failed". A Thread sends its parent no failure notice, so for a Thread this listing is how the parent learns that it failed.isDroppedChildInputread the child row twice for each parent message: once to check the stored parent, once for the stop. The child listing calls it for each running child with a waiting task.readChildOfStoredParentnow reads the stop in the stored-parent query, so each child costs one statement instead of two. The child agents API budget goes from 10 statements and 6 rounds to 8 and 5.Turns do not store a blocked result or the error text, so the listing still sets no
blockedresult and noerror.Part of #3060.
via @dcramer.
--
View Session [Sentry]