Repository navigation
fix(agent-invocations): End stranded agent invocations from the heartbeat - #2640
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
…beat #2627 ended a child's open agent invocations from a hook inside the heartbeat's lease-expiry stop. Two other stop paths drop the mailbox without it: recordConversationRetry when an error escapes the worker's last try, and recordAttemptFailure when it dead-letters messages. Their agent invocations stay open, and the parent never gets a result. The hook also failed agent invocations before the stop was written, so a lost lock or a dead heartbeat could fail work that still ran. Replace the hook with a heartbeat phase. It ends an open, appended agent invocation only when its input left the child mailbox and the child has no lease and no work to resume. That state cannot run again, so the phase needs no lock and covers every stop path. task-execution is back to its shape before #2627. Co-Authored-By: David Cramer <23610+dcramer@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 89b3208. Configure here.
…n every open agent invocation A pending agent invocation whose input left the mailbox with no lease can never start, so end it even when the child has new work. Page through every open agent invocation, so long-lived healthy ones cannot hide stranded ones.
Contributor
|
130 screenshot changes — 0 changed · 130 added · 0 removed |
Contributor
Author
|
|
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.

Follow-up to #2627. An independent review of #2627 found that it still left agent invocations open on other stop paths.
Problem
recordConversationRetry, when an error escapes the worker's last try.recordAttemptFailure, when it dead-letters messages.On those paths, the agent invocations stay open and the parent never gets a result.
Change
task-executiongoes back to its shape before fix(agent-invocations): Tell the parent when a child's work stops after its tries run out #2627.recoverStrandedAgentInvocations. It ends an open, appended agent invocation only when all of these are true:failedoridle.Consumed ids stay in
inboundMessageIds, so that input can never be appended again. Because the state cannot run again, the phase needs no lock, and it covers every stop path.Tests
agent-invocation-worker-crash.test.ts:runningafter each try except the last.recordConversationRetrystop) while a follow-up waits in the mailbox. Both agent invocations fail, and the parent gets 2 results. This case fails on main.Checks
tsc,lint,test-architectureandfile-lengthpass.durable-queue4,agent-dispatch-work1).via @dcramer.
--
View Session [Sentry]