Skip to content

fix: preserve controller state across refresh retry - #701

Merged
alongubkin merged 2 commits into
mainfrom
alon/alien-951-preserve-refresh-controller-state
Sep 23, 2026
Merged

alongubkin merged 2 commits into
mainfrom
alon/alien-951-preserve-refresh-controller-state

Conversation

@alongubkin

Copy link
Copy Markdown
Member

Summary

  • preserve the current serialized controller when explicitly retrying a refresh failure without a separate failed checkpoint
  • reset polling and error metadata without discarding remote identifiers or outputs
  • fail closed when a refresh-failed resource has no controller state
  • cover the full deployment retry path and prove the next observation resumes the existing controller instead of provisioning again

Why

Refresh failures occur after resource initialization and can retain their durable controller in internalState without populating lastFailedState. Explicit retry previously treated that case like an interrupted pre-initialization resource and reset it to Pending, losing remote identity and re-entering creation.

Validation

  • CARGO_INCREMENTAL=0 CARGO_PROFILE_TEST_DEBUG=0 cargo test -p alien-infra --all-features core::state_utils::tests::test_retry_failed -- --nocapture
  • CARGO_INCREMENTAL=0 CARGO_PROFILE_TEST_DEBUG=0 cargo test -p alien-deployment --test test_platform explicit_retry_after_health_failure_preserves_the_running_resource -- --nocapture
  • cargo fmt --check --package alien-infra --package alien-deployment
  • git diff --check

Linear: https://linear.app/alienplatform/issue/ALIEN-951/preserve-refresh-controller-state-across-explicit-deployment-retry

@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with the post-review test correction accurately strengthening lifecycle-filter coverage.

Summary

This PR preserves serialized controller state when explicitly retrying a refresh failure, allowing subsequent observation to resume the existing resource rather than provisioning it again.

  • Restores status and outputs from the current controller while clearing retry and error metadata.
  • Rejects refresh-failed resources that lack serialized controller state.
  • Adds unit and deployment coverage for preserving durable resource identity across retry.
  • Aligns the lifecycle-filter test assertion with its ProvisionFailed fixture.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Resource enters RefreshFailed] --> B[Explicit retry requested]
    B --> C{Serialized controller exists?}
    C -- No --> D[Return serialization failure]
    C -- Yes --> E[Deserialize current controller]
    E --> F[Reset stay count]
    F --> G[Restore controller status and outputs]
    G --> H[Clear retry attempt and error]
    H --> I[Persist controller]
    I --> J[Next observation resumes existing resource]
Loading

Reviews (2) · Last reviewed commit: "test: align lifecycle retry fixture stat..."

@alongubkin

Copy link
Copy Markdown
Member Author

@greptileai review

@alongubkin
alongubkin merged commit e8b332b into main Sep 23, 2026
22 checks passed
@alongubkin
alongubkin deleted the alon/alien-951-preserve-refresh-controller-state branch September 23, 2026 07:05
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