Skip to content

fix: make fixed lease IDs idempotent - #1261

Merged
steipete merged 2 commits into
mainfrom
steipete/eager-goodall-b52039
Aug 9, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/eager-goodall-b52039

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make crabbox warmup --lease-id cbx_<12 lowercase hex> the fixed operation identity for direct AWS and coordinator-backed creation
  • replay identical intent atomically across client/coordinator process restarts, while returning stable lease_id_conflict before side effects on immutable-intent drift
  • keep slugs as display metadata rather than an idempotency primitive

Direct AWS

  • persist the normalized, versioned, secret-sanitized create intent in the existing durable claim before provider work
  • persist the resolved AWS launch attempt before RunInstances, derive deterministic regional/zonal client tokens, and never resubmit an ambiguous persisted attempt
  • reconcile only the exact acquired CloudID or a uniquely visible resource whose provider facts and non-secret attempt-attestation tags match the durable attempt
  • retain downgrade-safe aws-fixed-v1 terminal tombstones after release or exact missing-resource cleanup so operation IDs cannot be reused
  • fail closed on missing, duplicate, conflicting, stale, or incompletely attested resources

Coordinator

  • add fixed-ID PUT /v1/leases/:id while leaving legacy random-ID POST behavior unchanged
  • atomically reserve the existing durable lease record with owner and versioned normalized intent hash
  • return/join the same provisioning or active lease for identical replay and reject owner/intent drift
  • recover ambiguous responses by repeating the exact PUT before polling with GET

Tests and documentation

  • add commit-then-timeout, fresh-process/storage restart, delayed visibility, concurrency, intent drift, terminal replay, exact reconciliation, callback/re-entry, and exactly-one-create fault coverage
  • document fixed-ID replay, at-most-once AWS ambiguity, attempt attestation, terminal tombstones, compatibility behavior, and the coordinator PUT contract
  • add the repository-style 0.41.1 Unreleased changelog entry without changing package versions

Verification

  • go test -race ./...
  • npm run format:check --prefix worker
  • npm run lint --prefix worker
  • npm run check --prefix worker
  • npm test --prefix worker
  • npm run build --prefix worker
  • Codex autoreview: clean P0/P1 gate with no accepted/actionable findings; a later P2 suggestion to expand the explicitly non-circular AWS attestation protocol was reviewed and rejected as outside the frozen contract

The live OpenClaw timeout-recovery proof is intentionally the downstream phase after this Crabbox change lands. This PR does not touch OpenClaw and no release, publication, coordinator deployment, package-version bump, or live-infrastructure mutation was performed.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 9, 2026
@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 9, 2026, 2:52 AM ET / 06:52 UTC.

ClawSweeper review

What this changes

Adds fixed warmup --lease-id replay semantics for direct AWS and coordinator lease creation, including a coordinator PUT endpoint, durable intent records, and recovery tests.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 6 items remain

Keep open: the fixed-ID behavior is not on current main, but this PR still needs real provider/coordinator recovery proof and removal of its release-owned changelog edit.

Priority: P2
Reviewed head: 139ac076fa5cef5addf9ef6b9ab03db2fe4d3e41
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The branch has substantial implementation and test signal, but an unresolved P2 and missing real behavior proof keep it from merge readiness.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The body reports automated checks and fault tests, but supplies no redacted after-fix run from real AWS or a deployed coordinator showing recovery after an ambiguous response. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The body reports automated checks and fault tests, but supplies no redacted after-fix run from real AWS or a deployed coordinator showing recovery after an ambiguous response. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current main lacks the coordinator fixed-ID route: Current main creates coordinator leases with POST to /v1/leases; it has no fixed-ID PUT branch, so the central capability remains necessary.
Current Worker routing is POST-only: Current main routes POST /v1/leases and capability-aware POST creation, confirming that the PR's PUT contract is not already implemented.
Release-owned entry remains from the prior review: The PR head still adds 0.41.1 - Unreleased; the prior review raised this same P2 and the follow-up commit is a claim-test commit.
Findings 1 actionable finding [P2] Remove the release-owned changelog entry
Security None None.

How this fits together

crabbox warmup turns CLI inputs into a provider lease request. This change routes a caller-selected lease ID either through AWS claim/launch handling or through the coordinator Worker, then returns the resulting lease to the CLI.

flowchart LR
  A[Warmup CLI request] --> B[Fixed lease ID]
  B --> C[Direct AWS adapter]
  C --> D[Durable claim and launch attempt]
  B --> E[Coordinator PUT request]
  E --> F[Durable lease record]
  D --> G[Provisioned lease]
  F --> G
Loading

Decision needed

Question Recommendation
Should Crabbox adopt warmup --lease-id and coordinator PUT /v1/leases/:id as a supported public idempotency contract? Sponsor the fixed-ID contract: Accept the public contract once the release-note edit is removed and real AWS or deployed-coordinator recovery proof is supplied.

Why: The branch adds a new CLI option and durable Worker HTTP contract with intentionally strict replay and tombstone semantics; no maintainer discussion in the supplied PR context confirms that permanent product/API direction.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The body reports automated checks and fault tests, but supplies no redacted after-fix run from real AWS or a deployed coordinator showing recovery after an ambiguous response. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Remove the release-owned changelog entry (P2) - CHANGELOG.md adds an unreleased version section from a normal feature PR. Keep release context in the PR body and remove this release-owned edit; this is the prior P2 finding and it remains at the current head.
  • Resolve merge risk (P1) - The new at-most-once AWS and coordinator recovery paths have no attached redacted after-fix run through a real provider or deployed coordinator; a fault-handling error could leave fixed-ID warmup unavailable or create an unintended resource.
  • Resolve merge risk (P1) - Several PR-head blobs could not be hydrated from the local partial clone because network DNS failed, so detailed functional inspection is limited to the supplied diff evidence and available current-main source.
  • Complete next step (P2) - A maintainer must sponsor the new public contract, and the contributor must provide real recovery proof; neither can be established by an automated repair branch.

Findings

  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:3-8
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 37 files, +3,609 / -111 lines The change crosses CLI, AWS provider, Worker, persisted-state, tests, and docs boundaries, so endpoint-only checks are not sufficient.

Merge-risk options

Maintainer options:

  1. Require recovery-boundary proof (recommended)
    Before merge, attach a redacted after-fix AWS or deployed-coordinator trace that injects an ambiguous create response and shows replay returns one stable lease/resource.
  2. Pause the new contract
    Do not merge until a maintainer sponsors the fixed-ID API direction and real recovery behavior can be demonstrated.

Technical review

Best possible solution:

Keep legacy random-ID creation unchanged, remove the release-owned changelog entry, and land the fixed-ID contract only after a redacted real recovery trace proves identical replay yields one lease/resource.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a conventional bug reproduction: current main lacks the fixed-ID PUT route and the PR introduces a new CLI/API contract rather than demonstrating an existing failing flow.

Is this the best way to solve the issue?

No. The implementation direction may be sound, but release-owned notes must be removed and a real injected-fault recovery run is needed before this large provider/Worker change is the best supported solution.

Full review comments:

  • [P2] Remove the release-owned changelog entry — CHANGELOG.md:3-8
    CHANGELOG.md adds an unreleased version section from a normal feature PR. Keep release context in the PR body and remove this release-owned edit; this is the prior P2 finding and it remains at the current head.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ce9487f55205.

Labels

Label changes:

  • remove merge-risk: 🚨 compatibility: Current PR review merge-risk labels are merge-risk: 🚨 availability.

Label justifications:

  • P2: This is a bounded reliability/API improvement with meaningful but limited impact on lease creation.
  • merge-risk: 🚨 availability: Fixed-ID replay changes provider-create recovery behavior, but no real after-fix recovery trace establishes that the path remains available under an ambiguous response.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The body reports automated checks and fault tests, but supplies no redacted after-fix run from real AWS or a deployed coordinator showing recovery after an ambiguous response. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current main lacks the coordinator fixed-ID route: Current main creates coordinator leases with POST to /v1/leases; it has no fixed-ID PUT branch, so the central capability remains necessary. (internal/cli/coordinator.go:959, ce9487f55205)
  • Current Worker routing is POST-only: Current main routes POST /v1/leases and capability-aware POST creation, confirming that the PR's PUT contract is not already implemented. (worker/src/fleet.ts:1212, ce9487f55205)
  • Release-owned entry remains from the prior review: The PR head still adds 0.41.1 - Unreleased; the prior review raised this same P2 and the follow-up commit is a claim-test commit. (CHANGELOG.md:3, 139ac076fa5c)
  • Repository release guidance: Repository policy distinguishes release preparation and requires synchronized version-carrying metadata; normal PR release context belongs in the PR body rather than a release-owned changelog edit. (AGENTS.md:41, ce9487f55205)
  • Area history: Peter Steinberger has the largest sampled history across the CLI claim, AWS provider, and Worker coordinator files; Vincent Koc is the most recent substantial Worker/release contributor in the sampled history. (internal/providers/aws/backend.go:1, ce9487f55205)
  • Structured helper unavailable: The repository autoreview helper stopped before review because its required TruffleHog binary is unavailable; no helper result is being represented as validation.

Likely related people:

  • Peter Steinberger: Sampled history shows the largest contribution count across the durable-claim, AWS backend, and coordinator surfaces; this PR head also follows prior merged work in those paths. (role: longstanding CLI and provider-area contributor; confidence: high; commits: 11502398edef, 574e917a6e3c, 5b620ea8ee4f; files: internal/cli/claim.go, internal/providers/aws/backend.go, worker/src/fleet.ts)
  • Vincent Koc: Recent history shows substantial Worker provisioning and release-note work adjacent to the new coordinator endpoint and release metadata. (role: recent Worker and release-area contributor; confidence: medium; commits: 9b5dc582942a, f331c615d0bd, 01d5fdd09f63; files: worker/src/fleet.ts, CHANGELOG.md)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Remove the release-owned CHANGELOG.md entry.
  • Attach redacted terminal output, logs, or a recording showing an injected ambiguous create response replaying to exactly one real AWS resource or deployed coordinator lease.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-09T06:02:23.450Z sha 5b620ea :: needs real behavior proof before merge. :: [P2] Remove the unreleased version entry

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. label Aug 9, 2026
@steipete
steipete merged commit df25449 into main Aug 9, 2026
23 checks passed
@steipete
steipete deleted the steipete/eager-goodall-b52039 branch August 9, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant