Skip to content

fix(task-execution): Fail the Turn record when the last attempt fails - #2927

Merged
dcramer merged 2 commits into
mainfrom
ref/turn-record-tagged-type
Nov 8, 2026
Merged

dcramer merged 2 commits into
mainfrom
ref/turn-record-tagged-type

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

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. failTurnRecord already 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.ts runs 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. On main, the Turn record stays running and the Turn gets picked up again. With this change, the record is failed and no work is resolved. Evals can't inject this failure, so the file gets a test-architecture baseline entry, the same as #2901 did for durable-queue.test.ts.

Part of #2890 (Turn and execution core).

via @dcramer.

--

View Session [Sentry]

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

vercel Bot commented Nov 8, 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 8, 2026 6:03pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 8, 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

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 df2b24e. Configure here.

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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

Review screenshots in Frameshift

Conversation Attachment · Desktop
Conversation Attachment · Desktop
Changed
Conversation Attachment · Mobile
Conversation Attachment · Mobile
Changed
Conversation Attachment Modal · Desktop
Conversation Attachment Modal · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
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
Show 7 more changed screenshots
Conversation Details Watched Linked Work · Mobile
Conversation Details Watched Linked Work · Mobile
Changed
Conversation Long Transcript Touch · Mobile
Conversation Long Transcript Touch · Mobile
Changed
Conversation Memory List Jump · Desktop
Conversation Memory List Jump · Desktop
Changed
Conversation Share Details · Desktop
Conversation Share Details · Desktop
Changed
Conversations Sections Collapsed · Desktop
Conversations Sections Collapsed · Desktop
Changed
Settings Mcp · Desktop
Settings Mcp · Desktop
Changed
System Cache Share · Desktop
System Cache Share · Desktop
Changed

…lock times out

A lock timeout in failTurnRecord no longer skips markTurnFailed and the Conversation persist.
@dcramer
dcramer merged commit fc35c74 into main Nov 8, 2026
44 checks passed
@dcramer
dcramer deleted the ref/turn-record-tagged-type branch November 8, 2026 18:17

This branch was successfully deployed

1 active deployment
Preview – junior-docs — d217d085 Deployed Nov 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant