fix(aws): cleanup stalls after instances disappear - #1904
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
75c0136 to
c35a325
Compare
|
Codex review: needs real behavior proof before merge. Reviewed September 6, 2026, 9:22 AM ET / 13:22 UTC. ClawSweeper reviewWhat this changesThe PR binds AWS provisioning and cleanup to recorded accounts and Regions, validates instance observations, and preserves SSH-key cleanup obligations across cancellation and regional fallback. Merge readiness⛔ Blocked before merge - 4 items remain This PR remains necessary and has no newly identified blocking production-code defect. Earlier authority-proof and historical-upgrade validation gaps remain unresolved. Priority: P2 Review scores
Verification
How this fits togetherCrabbox’s coordinator turns lease requests into remote machines and later cleans up their resources. Its AWS adapter checks account identity and resource ownership before deleting instances or keys and allowing the coordinator to retire access evidence. flowchart TD
A[Lease request or cleanup alarm] --> B[Coordinator lease record]
B --> C[Recorded account and Region]
C --> D[AWS credential snapshot]
D --> E[Identity and ownership checks]
E --> F[Observe or delete AWS resources]
F --> G[Complete cleanup or retain cleanup debt]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep account-bound cleanup and conservative historical handling, supported by isolated final-effect evidence and explicit fresh-versus-upgrade validation. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main throws a generic error for canonical empty DescribeInstances results that its optional lookup does not recognize as absence. No runtime reproduction was executed. Is this the best way to solve the issue? Yes in direction: validating absence within the AWS adapter and binding cleanup to recorded authority fits the existing lifecycle contract; merge readiness still requires final-effect and historical-upgrade evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8120119d878f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (7 earlier review cycles)
|
62f6d2e to
0ac90de
Compare
|
@clawsweeper re-review Please review exact head The prior findings are addressed:
There is no reviewed isolated pre-merge AWS deployment path with separate credentials in this repository. The PR body therefore records the exact post-deployment final-effect canary instead of presenting mocked transport as live proof. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The exact scanner fixture repair landed on ClawSweeper Please re-review this unchanged Crabbox head: |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7b34f12 to
8686ada
Compare
|
@clawsweeper re-review Please review signed exact head The previous findings are addressed:
Independent exact-head review reports no P1/P2 findings. Fresh-PR AWS run |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please review signed exact head The previous findings are addressed:
Independent exact-head review reports no P1/P2 findings. Fresh-PR AWS run |
|
🦞🧹 I asked ClawSweeper to review this item again. |
69bbdfa to
1733cd3
Compare
1733cd3 to
13b8d79
Compare
What Problem This Solves
AWS cleanup could remain stuck after an instance disappeared from
DescribeInstances. The previous path could not distinguish authoritative absence from a malformed response, a different account, or an interrupted provisioning attempt.Cross-Region fallback also had a lifecycle gap: a failed Region could retain the lease's canonical SSH key after provisioning moved elsewhere.
Canonical Fix
User Impact
Verified absence can now complete cleanup and retire access evidence. Temporary AWS failures remain scheduled for retry. Authority contradictions keep the lease and access evidence visible for operator resolution.
Successful fallback no longer leaks the lease key into abandoned Regions.
Evidence
680af84b34d346720dc6f646b145a5293e78d2de3d739b2f1114d1924d46d70749798953f532a407run_9e9bf46104b6npm run format:check --prefix workernpm run lint --prefix workernpm run check --prefix workernpm run build --prefix workernode scripts/build-docs-site.mjsnode --test scripts/build-docs-site.test.js scripts/check-docs-links.test.jsgit diff --check origin/main...HEADThe exact-head run used a fresh checkout on a real AWS lease. It proves the published commit, build, and full test surface on the production provider path. The destructive edge cases themselves remain isolated contract tests because credential reassignment and ambiguous deletion must not be induced against shared production credentials.
Regression Coverage
Tests now cover:
Scope And Size
The runtime growth represents new authority and lifecycle state that did not previously exist: exact AWS response validation, account-scoped cleanup authority, fixed credential sessions, Region fencing, retry classification, and Region-scoped key cleanup.
Post-Deploy Final-Effect Canary
After the exact merge SHA is deployed:
cleanupStatus: complete, a validcleanupCompletedAt, no cleanup debt, no host, and no retained access evidence.Credential reassignment remains qualification-only and is not tested against shared production credentials.