fix: successful runs fail after lease cleanup - #1291
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 12, 2026, 10:13 AM ET / 14:13 UTC. ClawSweeper reviewWhat this changesThe PR adds provider-selected workspace-owner cleanup plans so lease teardown cannot turn a successful Crabbox run into a late exit-code-7 failure. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain This PR remains necessary: current main and v0.41.5 still expose the teardown race. The patch has strong earlier-head proof, but the current head changed afterward and needs refreshed exact-head real-workload evidence before merge. Priority: P1 Review scores
Verification
How this fits togetherCrabbox executes workloads on leased remote workspaces and maintains a remote owner marker while a run is active. Cleanup releases the provider lease and then removes or preserves the owner marker according to whether the target remains reachable. flowchart LR
A[Completed workload] --> B[Workspace owner marker]
B --> C[Provider cleanup plan]
C --> D{Release mode}
D --> E[Release reachable owner]
D --> F[Retained short fence]
D --> G[Destructive grace fence]
E --> H[Lease cleanup result]
F --> H
G --> H
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cleanup selection provider-neutral in core, derive each mode from the adapter’s actual release action, and merge after a redacted real workload proves current-head teardown succeeds beyond the renewal interval. Do we have a high-confidence way to reproduce the issue? Yes—current source provides a high-confidence path: provider cleanup completes before the deferred owner close, and an in-flight renewal error is then returned as a run failure. The supplied Azure reproduction matches that path. Is this the best way to solve the issue? Yes—the provider-selected cleanup-plan boundary is the narrow maintainable solution because each adapter knows whether its release leaves the workspace reachable. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f120203ec83b. LabelsLabel changes:
Label 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 (12 earlier review cycles; latest 8 shown)
|
ad7fbcb to
e23bde5
Compare
|
Addressed the ordering finding at e23bde5: renewal now quiesces before provider release begins, so a pre-release failure remains fatal and teardown cannot manufacture a late renewal failure. Focused race coverage is green. I am adding the requested live production-boundary proof before asking for re-review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e23bde562b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Live after-fix proof on exact head
The revised implementation no longer suppresses errors. It prevents the teardown race by quiescing renewal before provider release and preserves any error observed on the live lease. @clawsweeper re-review |
|
Addressed the retry-window P1 at |
|
Final exact-head live proof on |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cfcee8d036
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cfcee8d to
05e658f
Compare
|
Resolved the persistent-target P1 on exact head |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05e658f688
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Exact head |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Maintainer-ready exact-head update: Codex reviewed |
|
Additional exact-head lifecycle proof is now in the PR body: the optimized-but-complete Bookeper canonical gate ran 9m03 outer / 8m30 command on the exact |
Summary: - opt Apple-container and Azure into a pre-release workspace-owner grace fence before destructive cleanup - preserve the legacy remote owner close for every unclassified or retained provider - remove the superseded static-target reachability abstraction and add focused lifecycle and provider capability coverage Rationale: - successful destructive releases can kill an in-flight renewal and manufacture exit code 7 after the command and lease cleanup succeed - a default long fence regresses retained providers by blocking reuse, so the new behavior must remain an explicit destructive-provider opt-in Tests: - go test ./... - go test -race ./internal/cli (focused workspace-owner cases) - focused SSH, Apple-container, Azure, and Namespace provider tests Co-authored-by: Codex <codex@openai.com>
7e3ad05 to
0165ca2
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
What Problem This Solves
Fixes an issue where a successful
crabbox runcould return exit code 7 when lease teardown killed an in-flight workspace-owner renewal after the command and lease cleanup had already succeeded.Why This Change Was Made
Provider teardown and the renewal loop previously raced. Cleanup now uses an explicit provider-neutral release lifecycle:
delete=true) for every coordinator-supported provider;keepreleases retain the historical post-release remote owner cleanup;RELEASE; retained and destructive providers preserve their installed fence on either success or an ambiguous release failure;If pre-release renewal fails, cleanup is skipped and the run fails closed. Unknown providers default to the destructive fence. GitHub Codespaces preflights the effective delete disposition once: dirty/unpushed work is retained behind the short fence, while a clean or uncertain delete becomes delete-or-fail so a later state change cannot silently turn a ten-minute delete fence into a successful retained stop.
User Impact
Apple-container and Azure one-shot runs no longer report a teardown-manufactured false failure after completing successfully. Genuine pre-release renewal failures remain fatal, destructive cleanup retains exclusive workspace ownership, and other providers retain their prior release behavior.
Evidence
0, timing statussucceeded,leaseStopped=true, provider inventory empty, followed byremote workspace owner renewal failed closed: signal: killedand outer exit7.delete=true, and proves the grace fence survives destructive release; provider-spec coverage proves static SSH and Namespace are coordinator-disabled.keepowner-release regressions.7e3ad05d82c33bd9ae164c4b36ad8d9a66c81310found no actionable P0/P1/P2 issues; the prior adversarial pass explicitly verified the original six lifecycle finding classes, and the final focused pass verified Coder/Firecracker release-authority parity.7e3ad05d82c33bd9ae164c4b36ad8d9a66c81310across core, GitHub Codespaces, Hostinger, NVIDIA Brev, Vast, Coder, and Firecracker.go test ./...passed on the same exact head.7e3ad05d82c33bd9ae164c4b36ad8d9a66c81310: the built binary ran Bookeper's full cold Apple-container gate for 14m54.446s, returned command and outer launcher exit0, reportedrunStatus=succeeded,totalMs=907451,endToEndMs=919790, andleaseStopped=truefor leasecbx_5e9bf67f8b0c.ed1d2ceff2616a7d773911aaf493ecae14975ec2: command510.534s, Crabbox total523.151s, end-to-end535.503s, outer launcher543s, exit0,runStatus=succeeded, andleaseStopped=truefor leasecbx_a9f9def2ca62. The run exceeded the normal renewal interval, retrieved and hash-verified the complete 8.56 MB replay-failed backend phase log before teardown, and left no lease/container/VM residue.