Skip to content

Rust #325: activity lease renewal like Server 2.11 - #680

Merged
rmcdaniel merged 1 commit into
rust-325-train-oct22cfrom
rust-325-activity-lease-renewal
Oct 22, 2026
Merged

rmcdaniel merged 1 commit into
rust-325-train-oct22cfrom
rust-325-activity-lease-renewal

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Part of #325. Stacked on #679, the 2.11.1 parity reference; it retargets when that merges.

What

POST /api/worker/activity-tasks/{task}/renew-lease, as published Server 2.11.1 serves it over Workflow 2.10.2's ActivityLeaseRenewal. Current PHP, Python and Rust SDKs renew long activity leases through it when the server advertises server_capabilities.activity_lease_renewal. Native now advertises it.

The behavior was measured on the published 2.11.1 image first, then encoded as the activity-lease-renewal shared fixture:

  • Live renewal. 200 with the attempt status (attemptStatus fields), lease_renewed: true, server_time, task_id and worker_session: null.
    • The lease runs the configured 300 s from the renewal, never less than before.
    • The heartbeat, its deadline and the run's history are unchanged.
    • A 1.19 request and an unruled body field are accepted.
  • Ownership guard, in PHP's order and bodies:
    • unknown task → 404 task_not_found;
    • unknown attempt → 404 attempt_not_found;
    • another task → 409 task_mismatch;
    • another owner → 409 lease_owner_mismatch with the current owner.
  • Validation. Laravel's 422 validation_failed for missing or non-string fields.
  • Closed, cancelled, terminated or expired authority. 409 with the status and lease_renewed: false, without task_id or server_time.
    • Continuation follows Workflow's attemptContinuationState, including run and execution deadlines (run_timeout / execution_timeout).

Also fixed

Closing an attempt now clears its lease, and its task's, as PHP's closeAttempt does. Completed attempts and their tasks used to keep a stale lease_expires_at; /status and renewal showed it where PHP shows null.

Evidence

  • Native tests (rust/tests/execution/activity_lease_renewal.rs, 2 tests): pass on SQLite, PostgreSQL and MySQL. The full SQLite suite passes (406 execution, 230 library).
  • Contract unit tests: 302/302, including 30 mutation cases for this contract.
  • Local parity step against PHP 2.11.1: PHP, embedded (explicitly inapplicable) and native each pass every fixture, including activity-lease-renewal, and the three-way comparison passes.

New modules use a store_methods! macro for the shared backend bounds, the same one #678 adds, so the bound list isn't duplicated again.

POST /api/worker/activity-tasks/{task}/renew-lease keeps a live
attempt's lease for its owner without recording progress, moving a
business deadline or adding history, as published Server 2.11.1 does
over Workflow 2.10's ActivityLeaseRenewal: PHP's ownership guard and
bodies, Laravel's validation, the attempt status with lease_renewed and
server_time, and refusals for closed, cancelled, terminated or expired
authority. Native advertises activity_lease_renewal, so current SDKs use
it.

Closing an attempt now clears its lease and its task's, as PHP's
closeAttempt does; completed attempts and their tasks kept a stale lease.

The activity-lease-renewal fixture records each case against the
published reference.
@rmcdaniel
rmcdaniel changed the base branch from rust-325-reference-2-11-1 to rust-325-train-oct22c October 22, 2026 21:43
@rmcdaniel
rmcdaniel merged commit 1d94aa4 into rust-325-train-oct22c Oct 22, 2026
10 of 19 checks passed
@rmcdaniel
rmcdaniel deleted the rust-325-activity-lease-renewal branch October 22, 2026 22:10
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.

1 participant