Skip to content

ateapi: run lifecycle workflows to their end when the caller goes away - #2558

Open
Davanum Srinivas (dims) wants to merge 2 commits into
agent-substrate:mainfrom
dims:workflow-outlives-caller
Open

Davanum Srinivas (dims) wants to merge 2 commits into
agent-substrate:mainfrom
dims:workflow-outlives-caller

Conversation

@dims

@dims Davanum Srinivas (dims) commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

A client cancel or timeout cancelled the lease renewal and the atelet call with it: the actor stayed SUSPENDING, PAUSING or RESUMING with its worker assigned, and a retry could start a second checkpoint on a sandbox that had already saved.

acquireLease now drops the caller's cancellation and bounds the workflow at the server's own RPC deadline, which the dropped context carried.

Verified on a dense kind cluster where pauses outran the client's deadline: none left stranded. go test ./cmd/ateapi/internal/controlapi/....

@dims
Davanum Srinivas (dims) force-pushed the workflow-outlives-caller branch 4 times, most recently from 9f120c5 to 9278fa0 Compare October 18, 2026 21:06
@dims
Davanum Srinivas (dims) force-pushed the workflow-outlives-caller branch 4 times, most recently from 92b1a93 to 4e7680e Compare October 22, 2026 12:42
@dims
Davanum Srinivas (dims) force-pushed the workflow-outlives-caller branch 9 times, most recently from 69c152c to 580b58e Compare October 30, 2026 11:25
@dims
Davanum Srinivas (dims) force-pushed the workflow-outlives-caller branch 3 times, most recently from 2a0286c to 10c292a Compare November 7, 2026 03:28
A client cancel or timeout cancelled the lease renewal and the atelet call
with it: the actor stayed SUSPENDING or RESUMING with its worker assigned,
and a retry could start a second checkpoint on a sandbox that had already
saved. acquireLease now drops the caller's cancellation and bounds the
workflow at the server's own RPC deadline, which the dropped context
carried.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
The functional test for a caller deadline during the restore expected the
old behavior: the deadline stopped the workflow, left the actor RESUMING,
and an immediate retry finished the resume. Now the first resume runs to
its end, so that retry raced the finishing workflow for the lease and
failed with Aborted whenever it lost.

Move the case to its own test: the caller gets DeadlineExceeded, a retry
during the restore gets Aborted, and the actor reaches RUNNING on the same
worker without either of them.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api-machinery area/reliability kind/bug Something isn't working / bugfixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants