Skip to content

test: cover a runner whose execution claim is lost - #1157

Merged
alongubkin merged 2 commits into
mainfrom
alon/alien-1700-stop-on-lost-claim
Oct 20, 2026
Merged

alongubkin merged 2 commits into
mainfrom
alon/alien-1700-stop-on-lost-claim

Conversation

@alongubkin

Copy link
Copy Markdown
Member

Linear: ALIEN-1700. Follows #1154.

Why

Once the execution claim a runner holds is gone, the manager refuses every checkpoint and lease renewal under it with DEPLOYMENT_UPDATE_CLAIM_LOST. The claim cannot come back: an attempt never becomes live again, and an expired or reassigned lease is not renewed for the old session.

The runner already handles a final refusal correctly. The checkpoint loops and the lease wrapper retry only retryable errors (since #179). So how long a lost claim holds a deployment depends only on the flag the manager sends:

  • Retryable (what a hosted control plane sent until now): the step's checkpoint is retried with backoff up to 30 s, and the renewals at 60, 120 and 180 s fail inside LEASE_RENEW_FAILURE_DEADLINE (3 min 30 s). The renewal at 240 s cancels the loop with DEPLOYMENT_LEASE_LOST, so the deployment is held for 4 minutes. This matches the loop that fix: checkpoint a recovered credential retry once per claim #1154 removed one cause of (11:56:33 to 12:00:33).
  • Final: the first refused checkpoint returns DEPLOYMENT_CHECKPOINT_FAILED (not retryable), and the manager then releases the claim.

The control plane is changing the refusal to final. This PR adds no runtime change. It adds tests for the runner behavior that change depends on. Until now, the lease wrapper's branch that cancels on a final renewal refusal had no test.

Tests

Both tests use paused Tokio time and a transport that refuses every checkpoint and renewal with a 409 DEPLOYMENT_UPDATE_CLAIM_LOST. Each runs once with the refusal retryable and once with it final.

  • lost_claim_holds_the_deployment_only_while_the_refusal_is_retryable: a Running heartbeat through run_running_refresh_step_loop.
    • Retryable: stops with DEPLOYMENT_LEASE_LOST after exactly 240 s, with 4 renewals and more than one checkpoint attempt.
    • Final: stops with DEPLOYMENT_CHECKPOINT_FAILED before the first renewal, with 1 checkpoint attempt and 0 renewals.
  • lease_wrapper_cancels_at_the_first_final_renewal_refusal: run_with_lease_renewal around an operation that would outlive the lease.
    • Retryable: cancelled at 240 s, after 4 renewals.
    • Final: cancelled at the first renewal (60 s), after 1 renewal.

The other runner tests are unchanged. They run in CI; nothing was built locally.

🤖 Generated with Claude Code

A manager refuses every checkpoint and lease renewal once the claim a
runner holds is gone. The runner retries a refusal only while it is
retryable, so a retryable refusal holds the deployment until the lease
deadline (4 minutes) and a final one stops it at the first refusal.

The lease wrapper's non-retryable renewal branch had no test. Both
tests run each case under paused time and assert how long the
deployment is held, how many checkpoints are attempted and how many
renewals are sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@enclave-ai

enclave-ai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Enclave skipped this draft pull request. It will run automatically when you mark the PR as Ready for review.

@alongubkin
alongubkin marked this pull request as ready for review October 20, 2026 12:54
@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the heartbeat test now checks the intended path.

Summary

Adds tests for runners whose execution claims are lost. There are no runtime changes.

  • Running heartbeat tests show how the runner responds to a lost claim.
  • Lease renewal tests show when a lost claim cancels an operation.

The previous finding is fully addressed. No new actionable issues were found. Tests were not run during this review.

Reviews (2) · Last reviewed commit: "test: drive the lost-claim heartbeat thr..." · Reviewed by Greptile

Comment thread crates/alien-deployment/src/runner.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alongubkin

Copy link
Copy Markdown
Member Author

@greptileai review

@alongubkin
alongubkin merged commit 925d933 into main Oct 20, 2026
24 checks passed
@alongubkin
alongubkin deleted the alon/alien-1700-stop-on-lost-claim branch October 20, 2026 13:21
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