Repository navigation
fix(task-execution): Fail the Turn record when the last attempt fails - #2927
Merged
Merged
Conversation
When the last attempt of a web or event Turn failed, the mailbox worker marked the Turn failed in the Conversation but left its Turn record running. A later wake with no new input then picked that Turn up again as the open mailbox Turn and ran it a second time. This is the root cause behind JUNIOR-9M; #2562 only superseded the open Turn when new input arrived. The last failed attempt now fails the Turn record in the same step. The new test runs the agent with a fake model so a real step is saved before Slack rejects the reply. Evals can't inject that failure, so conversation-stale-turn.test.ts gets a test-architecture baseline entry, as #2901 did for durable-queue.test.ts. Part of #2890.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dcramer
approved these changes
Nov 8, 2026
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 df2b24e. Configure here.
Contributor
|
13 screenshot changes — 13 changed · 0 added · 0 removed Review screenshots in Frameshift Show 7 more changed screenshots |
…lock times out A lock timeout in failTurnRecord no longer skips markTurnFailed and the Conversation persist.
23 tasks done
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.

When the last attempt of a web or event Turn failed, the mailbox worker marked the Turn failed in the Conversation, but its Turn record stayed
running. A later wake with no new input then picked up that Turn again as the open mailbox Turn and ran it a second time. This is the root cause behind JUNIOR-9M. #2562 only closed the open Turn when new input arrived.Now the last failed attempt also fails the Turn record, in the same step.
failTurnRecordalready ignores Turns that are finished or have a newer version, so it can't overwrite another worker's result.Test: a new case in
conversation-stale-turn.test.tsruns the agent with a fake model, so a real step is saved before Slack rejects the reply. Then it wakes the Conversation again with no input. Onmain, the Turn record staysrunningand the Turn gets picked up again. With this change, the record isfailedand no work is resolved. Evals can't inject this failure, so the file gets a test-architecture baseline entry, the same as #2901 did fordurable-queue.test.ts.Part of #2890 (Turn and execution core).
via @dcramer.
--
View Session [Sentry]