Repository navigation
fix: finish a confirmed deletion when the lease release is refused as unauthenticated - #987
Merged
Merged
Conversation
… unauthenticated Once the manager confirms a deployment's deletion it removes the record, its lease and the deployment credential. The lease release that follows can then be refused as unauthenticated (401) as well as missing (404). Treat both as a completed deletion instead of failing destroy after every resource is gone. Other releases keep failing on 401. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
@greptileai review |
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
alien-deploy destroycan exit 1 withFailed to release sync lock>UNAUTHORIZEDafter a deletion has finished. By then every resource and the deployment record are gone.Root cause
When the manager confirms
Deleted, it removes the deployment record. The lease and the deployment credential the CLI authenticates with go with it. The CLI then releases its lease with that credential. A manager that validates bearer tokens upstream, with a short cache, can only answer that release from its cache. Once the cache entry has expired, the token no longer exists, so the release gets 401 instead of the 404 thatrelease_deploymenttolerates. The failure is timing dependent. It's common when teardown reconciles are slow (for example a registry-grant revoke on every reconcile, ~30 s each), because requests to one manager instance end up more than the cache TTL apart.Fix
After the manager has confirmed the deletion, treat a release refused as 401 or 404 as completed:
finalize_step_loopchecks for a persisted terminalDeletedcheckpoint.final_reconcilechecks that theDeletedreconcile was accepted (or the record was already missing).In both cases nothing remains to release. Every other release still fails on 401, including a release after a refused
Deletedcheckpoint.Alternatives considered:
release_deploymentfor every caller would hide real credential failures.Deletedrelies on every manager dropping the lease along with the record.Proof
a_confirmed_deletion_completes_when_the_release_is_refused_as_unauthenticated: on main it fails with the exact error seen in the field (Failed to release sync lock>UNAUTHORIZED: Platform API authentication failed with status 401). It passes with the fix, through bothfinalize_step_loopandfinal_reconcile.an_unauthenticated_release_still_fails_without_a_confirmed_deletion: a 401 release on a running deployment, and a 401 release after a refused deleted checkpoint, still fail.cargo test -p alien-deployment --lib: 179/179 pass.Rollout
CLI-side only, and it ships with the next CLI and setup binary. It doesn't change server behaviour.
ALIEN-1395
🤖 Generated with Claude Code