Skip to content

Commit 02acc4f

Browse files
authored
fix(deployment): make reconciliation leases durable (#205)
## Summary - persist delayed reconciliation wakeups instead of repeatedly reacquiring work that is not ready - keep eligible controller work under one bounded lease and run independent ready resources concurrently - renew ownership through a dedicated endpoint without rewriting deployment state - cancel promptly when ownership is lost and clear scheduled delays for explicit user actions ## Why A fresh multi-resource deployment exposed two framework failures: short controller waits were repeatedly yielded through the shared scheduler, and manager replicas could remain occupied retrying work after lease loss. This preserves durable checkpoints while avoiding unnecessary distributed scheduling between adjacent controller steps. ## Validation - `cargo check -p alien-infra -p alien-deployment -p alien-manager --all-features` - 851 tests across `alien-infra`, `alien-deployment`, and `alien-manager` passed (1 skipped) - generated OpenAPI artifacts were produced through the repository generators ## Dependency Stacked on #179. Linear: https://linear.app/alienplatform/issue/ALIEN-324/make-deployment-leases-cancellable-and-keep-short-controller
1 parent 1f12e36 commit 02acc4f

31 files changed

Lines changed: 734 additions & 149 deletions

File tree

‎client-sdks/manager/openapi.json‎

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client-sdks/manager/rust/openapi-3.0.json‎

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client-sdks/platform/openapi.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client-sdks/platform/rust/openapi-3.0.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎client-sdks/platform/rust/openapi.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎crates/alien-cli/src/commands/deploy.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ pub async fn deploy_task(args: DeployArgs, ctx: ExecutionMode) -> Result<()> {
14641464
} else {
14651465
LoopOperation::Deploy
14661466
},
1467-
delay_threshold: None,
1467+
delay_strategy: alien_deployment::runner::DelayStrategy::Inline,
14681468
};
14691469

14701470
let runner_result = alien_deployment::runner::run_step_loop(

‎crates/alien-cli/src/commands/destroy.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ pub async fn destroy_task(args: DestroyArgs, ctx: ExecutionMode) -> Result<()> {
281281
let policy = RunnerPolicy {
282282
max_steps: 400,
283283
operation: LoopOperation::Delete,
284-
delay_threshold: None,
284+
delay_strategy: alien_deployment::runner::DelayStrategy::Inline,
285285
};
286286

287287
let runner_result = match alien_deployment::runner::run_step_loop(

‎crates/alien-deploy-cli/src/commands/up.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ pub async fn push_initial_setup(
35763576
// The CLI drives Pending → InitialSetup → Provisioning, then stops.
35773577
// The manager picks up from Provisioning and drives to Running.
35783578
operation: LoopOperation::InitialSetup,
3579-
delay_threshold: None,
3579+
delay_strategy: alien_deployment::runner::DelayStrategy::Inline,
35803580
};
35813581

35823582
let runner_result = shared_run_step_loop(
@@ -3840,7 +3840,7 @@ async fn run_runtime_deletion(
38403840
let policy = RunnerPolicy {
38413841
max_steps: 400,
38423842
operation: LoopOperation::Delete,
3843-
delay_threshold: None,
3843+
delay_strategy: alien_deployment::runner::DelayStrategy::Inline,
38443844
};
38453845

38463846
let runner_result = shared_run_step_loop(
@@ -3938,7 +3938,7 @@ async fn run_setup_deletion(
39383938
let policy = RunnerPolicy {
39393939
max_steps: 400,
39403940
operation: LoopOperation::Delete,
3941-
delay_threshold: None,
3941+
delay_strategy: alien_deployment::runner::DelayStrategy::Inline,
39423942
};
39433943

39443944
let runner_result = alien_deployment::setup_teardown::run_setup_teardown_after_handoff(

‎crates/alien-deployment/src/loop_contract.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub enum LoopStopReason {
2222
Handoff,
2323
/// No work was available (no target release, no config, etc.).
2424
NoWork,
25+
/// The next useful reconciliation is scheduled for later.
26+
Delayed,
2527
/// Step budget exhausted without reaching a terminal state.
2628
BudgetExceeded,
2729
/// Loop was cancelled by an external signal.

‎crates/alien-deployment/src/manager_api_transport.rs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ impl ManagerApiTransport {
3838

3939
#[async_trait]
4040
impl DeploymentLoopTransport for ManagerApiTransport {
41+
async fn renew_lease(&self, deployment_id: &str) -> Result<(), AlienError> {
42+
self.client
43+
.renew()
44+
.body(alien_manager_api::types::RenewRequest {
45+
deployment_id: deployment_id.to_string(),
46+
session: self.session.clone(),
47+
})
48+
.send()
49+
.await
50+
.into_sdk_error()
51+
.context(alien_error::GenericError {
52+
message: "Failed to renew deployment lease via manager API".to_string(),
53+
})?;
54+
Ok(())
55+
}
56+
4157
async fn reconcile_step(
4258
&self,
4359
deployment_id: &str,

0 commit comments

Comments
 (0)