Repository navigation
fix(cli): wait for hosted setup handoff - #542
alongubkin wants to merge 1 commit into
Conversation
|
Closing pending a first-principles correction: live staging shows the post-setup handoff can remain in provisioning with neither desired nor current release, so polling would only turn the API error into a timeout. The fix must preserve/restore release authority across setup reconciliation. |
Greptile SummaryThis PR adds bounded polling after hosted setup reconciliation so compute updates wait for release authority, while preserving immediate retries where authority already exists.
Confidence Score: 4/5The PR should be fixed before merging because a failed handoff response that already contains release authority can be rejected before the corrective compute update runs. The polling loop prioritizes the failed-status return over the release-authority success condition, allowing a valid corrective-update state to terminate as an error and leave hosted compute unapplied. Files Needing Attention: crates/alien-deploy-cli/src/commands/up.rs
|
| Filename | Overview |
|---|---|
| crates/alien-deploy-cli/src/commands/up.rs | Adds hosted handoff polling and lifecycle helpers, but failure status is evaluated before newly established release authority, which can suppress the corrective compute retry. |
Sequence Diagram
sequenceDiagram
participant CLI
participant Manager
participant Platform
CLI->>Manager: Final setup reconciliation
Manager-->>CLI: Deployment without release authority
loop Up to 150 attempts
CLI->>Manager: Refresh deployment
Manager-->>CLI: Status and release IDs
alt Release authority established
CLI->>Platform: Submit corrective compute update
else Terminal lifecycle state
CLI-->>CLI: Return handoff error
else Still handing off
CLI-->>CLI: Wait two seconds
end
end
Prompt To Fix All With AI
### Issue 1
crates/alien-deploy-cli/src/commands/up.rs:1554-1567
**Authority Check Follows Failure**
When a handoff poll returns a failed deployment with a newly populated release ID, the loop returns before checking that authority, preventing the corrective compute update and potentially leaving hosted capacity stale.
```suggestion
if deployment_has_release_authority(
current_deployment.desired_release_id.as_deref(),
current_deployment.current_release_id.as_deref(),
) {
break;
}
if deployment_handoff_failed(¤t_deployment.status) {
return Err(AlienError::new(ErrorData::ConfigurationError {
message: format!(
"Setup reconciliation handed off, but the hosted deployment entered '{}' before release authority was established",
current_deployment.status
),
}));
}
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(cli): wait for hosted setup handoff" | Re-trigger Greptile
| if deployment_handoff_failed(¤t_deployment.status) { | ||
| return Err(AlienError::new(ErrorData::ConfigurationError { | ||
| message: format!( | ||
| "Setup reconciliation handed off, but the hosted deployment entered '{}' before release authority was established", | ||
| current_deployment.status | ||
| ), | ||
| })); | ||
| } | ||
| if deployment_has_release_authority( | ||
| current_deployment.desired_release_id.as_deref(), | ||
| current_deployment.current_release_id.as_deref(), | ||
| ) { | ||
| break; | ||
| } |
There was a problem hiding this comment.
Authority Check Follows Failure
When a handoff poll returns a failed deployment with a newly populated release ID, the loop returns before checking that authority, preventing the corrective compute update and potentially leaving hosted capacity stale.
| if deployment_handoff_failed(¤t_deployment.status) { | |
| return Err(AlienError::new(ErrorData::ConfigurationError { | |
| message: format!( | |
| "Setup reconciliation handed off, but the hosted deployment entered '{}' before release authority was established", | |
| current_deployment.status | |
| ), | |
| })); | |
| } | |
| if deployment_has_release_authority( | |
| current_deployment.desired_release_id.as_deref(), | |
| current_deployment.current_release_id.as_deref(), | |
| ) { | |
| break; | |
| } | |
| if deployment_has_release_authority( | |
| current_deployment.desired_release_id.as_deref(), | |
| current_deployment.current_release_id.as_deref(), | |
| ) { | |
| break; | |
| } | |
| if deployment_handoff_failed(¤t_deployment.status) { | |
| return Err(AlienError::new(ErrorData::ConfigurationError { | |
| message: format!( | |
| "Setup reconciliation handed off, but the hosted deployment entered '{}' before release authority was established", | |
| current_deployment.status | |
| ), | |
| })); | |
| } |
Knowledge Base Used: Retry hosted compute updates after failed apply
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/alien-deploy-cli/src/commands/up.rs
Line: 1554-1567
Comment:
**Authority Check Follows Failure**
When a handoff poll returns a failed deployment with a newly populated release ID, the loop returns before checking that authority, preventing the corrective compute update and potentially leaving hosted capacity stale.
```suggestion
if deployment_has_release_authority(
current_deployment.desired_release_id.as_deref(),
current_deployment.current_release_id.as_deref(),
) {
break;
}
if deployment_handoff_failed(¤t_deployment.status) {
return Err(AlienError::new(ErrorData::ConfigurationError {
message: format!(
"Setup reconciliation handed off, but the hosted deployment entered '{}' before release authority was established",
current_deployment.status
),
}));
}
```
**Knowledge Base Used:** [Retry hosted compute updates after failed apply](https://app.greptile.com/alien/-/custom-context/knowledge-base/alienplatform/alien/-/reverts/incident-mitigation_531-20260830-hosted-compute-retry-edf7b32.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Test
cargo test -p alien-deploy-cli commands::up::tests -- --nocapture