Skip to content

atenet: never cancel an in-flight resume at the park budget - #991

Open
Omer Yahud (omeryahud) wants to merge 1 commit into
agent-substrate:mainfrom
omeryahud:parking-grpc-cancellation-fix
Open

atenet: never cancel an in-flight resume at the park budget#991
Omer Yahud (omeryahud) wants to merge 1 commit into
agent-substrate:mainfrom
omeryahud:parking-grpc-cancellation-fix

Conversation

@omeryahud

Copy link
Copy Markdown
Contributor

The park budget doubled as the ResumeActor RPC deadline, so a resume that outlived it was cancelled mid-restore. ateapi claims the worker and persists RESUMING before the restore begins, rolls back neither on cancellation, and nothing reclaims a RESUMING actor on a live worker - a budget cancel therefore discarded the restore and stranded the worker, which is the TestRequestParking/ParkThenServed flake (#675).

The budget now bounds the retry loop only: an attempt still in flight when it elapses runs to completion on a non-cancellable context (bounded by ateapi's own server-side RPC deadline, with Envoy's ext_proc timeout unchanged as the client-side ceiling), and its real result is classified - an overshooting restore is served late instead of failed, and a late retryable error still surfaces as the capacity
503.

The e2e window widens to admit a served-late overshoot, and the test now pins the invariants the flake exposed: actor B reaches RUNNING and a follow-up request is served warm.

Fixes #675

  • Tests pass
  • Appropriate changes to documentation are included in the PR

The park budget doubled as the ResumeActor RPC deadline, so a resume
that outlived it was cancelled mid-restore. ateapi claims the worker
and persists RESUMING before the restore begins, rolls back neither on
cancellation, and nothing reclaims a RESUMING actor on a live worker -
a budget cancel therefore discarded the restore and stranded the
worker, which is the TestRequestParking/ParkThenServed flake (agent-substrate#675).

The budget now bounds the retry loop only: an attempt still in flight
when it elapses runs to completion on a non-cancellable context
(bounded by ateapi's own server-side RPC deadline, with Envoy's
ext_proc timeout unchanged as the client-side ceiling), and its real
result is classified - an overshooting restore is served late instead
of failed, and a late retryable error still surfaces as the capacity
503. This also closes a mapping hole where budget expiry with zero
completed attempts escaped as a raw DeadlineExceeded and surfaced as a
504 (what actually failed BudgetExhaustion in run 30476804701): the
loop can no longer exit before its first attempt has completed.

The e2e window widens to admit a served-late overshoot, and the test
now pins the invariants the flake exposed: actor B reaches RUNNING and
a follow-up request is served warm.

Fixes agent-substrate#675
@omeryahud
Omer Yahud (omeryahud) marked this pull request as ready for review August 18, 2026 07:35
@omeryahud

Copy link
Copy Markdown
Contributor Author

Zoe Zhao (@zoez7) yufan-su Hi guys, would appreciate your review here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E2E test flaky: TestRequestParking

1 participant