Skip to content

fix(coordinator): bind lease mutations to provider - #1343

Merged
steipete merged 3 commits into
mainfrom
steipete/coordinator-mutation-provider-fence
Aug 14, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/coordinator-mutation-provider-fence

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • bind coordinator release, heartbeat/idle/telemetry, Tailscale, and runtime-adapter mutations to the CLI-selected provider
  • enforce expectedProvider atomically inside Worker state transactions while preserving omitted legacy requests
  • prevent identity mismatches from falling through to blind stop/release paths
  • cancel mismatching ordinary creates through the token-bound requested lease/create-attempt contract instead of releasing an untrusted returned ID
  • canonicalize gcp, google, and google-cloud without conflating distinct routes such as Azure VM and Dynamic Sessions

Verification

  • full go test ./internal/cli
  • Worker format, lint, typecheck, 1,355 tests, and dry-run build
  • scripts/check-docs.sh
  • git diff --check
  • source-blind behavior contract covering release, HTTP/WebSocket heartbeat, Tailscale, stop fallback, create cancellation, aliases, and distinct-route rejection
  • focused security review: no high- or medium-confidence vulnerabilities
  • structured P1 autoreview and secret scan: clean

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 14, 2026, 5:15 PM ET / 21:15 UTC.

ClawSweeper review

What this changes

The PR adds provider identity binding to coordinator lease mutations so a CLI-selected provider cannot mutate a lease belonging to a different provider.

Merge readiness

⛔ Blocked until real behavior proof is added - 4 items remain

This PR addresses a real coordinator identity boundary and current main does not yet implement it, but it needs contributor-provided real behavior proof before merge.

Priority: P2
Reviewed head: c59569fc58e84bcfc05fafce90a81ac51fadbb6a

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch has substantial focused coverage, but missing real behavior proof remains a merge gate for this control-plane safety change.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: Automated checks are listed, but the PR body has no redacted after-fix coordinator trace demonstrating a successful matching-provider mutation and a rejected cross-provider mutation. 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) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: Automated checks are listed, but the PR body has no redacted after-fix coordinator trace demonstrating a successful matching-provider mutation and a rejected cross-provider mutation. 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 provider fence: The current control-WebSocket heartbeat payload has no expected-provider field, so main cannot bind this mutation to the selected provider.
Control-state contract: Current Worker tests explicitly serialize fallback control socket messages with coordinator state transitions, establishing the concurrency-sensitive boundary affected by the PR.
Related state path: Run-event broadcasting persists the per-socket subscription cursor before sending events, so provider-fence changes must preserve coordinator ordering and attachment state.
Findings None None.
Security None None.

How this fits together

Crabbox’s CLI sends lease lifecycle and heartbeat mutations to the Cloudflare Worker coordinator, which validates stored lease records before dispatching provider operations. This change carries the selected provider through those requests and rejects a mismatch before changing lease state.

flowchart LR
  CLI[CLI selected provider] --> Request[Lease mutation]
  Request --> Coordinator[Coordinator worker]
  Coordinator --> Check[Stored provider check]
  Check -->|match| Update[Lease update]
  Check -->|mismatch| Reject[Identity rejection]
  Update --> Provider[Provider operation]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: Automated checks are listed, but the PR body has no redacted after-fix coordinator trace demonstrating a successful matching-provider mutation and a rejected cross-provider mutation. 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.
  • Resolve merge risk (P1) - The provider-identity boundary is security- and compatibility-sensitive, but no deployed after-fix trace currently proves that matching mutations succeed while cross-provider mutations stop before state changes.
  • Resolve merge risk (P1) - The local partial clone could not retrieve all PR Worker blobs, leaving some PR-only implementation details dependent on the supplied diff context.
  • Complete next step (P2) - The remaining merge blocker is contributor-owned real behavior proof; no safe automated repair can establish that external coordinator result.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 23 files, +1,374 / -222 lines The change spans CLI request construction, Worker transactions, and regression tests, so the cross-boundary behavior needs direct proof.

Merge-risk options

Maintainer options:

  1. Add deployed coordinator proof (recommended)
    Before merge, attach a redacted CLI-to-coordinator trace that shows a same-provider mutation succeeds and a cross-provider mutation returns the expected rejection without altering the lease.

Technical review

Best possible solution:

Keep omitted expected-provider requests compatible, verify atomic mismatch rejection in a real coordinator setup, and attach a redacted trace covering both accepted and rejected mutation paths.

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

Yes, at source level: current main accepts heartbeat mutations without a selected-provider field, and the PR adds the request and Worker validation path. A real coordinator run has not been supplied to confirm the after-fix result.

Is this the best way to solve the issue?

Yes, conditionally: an optional expected-provider checked inside the Worker transaction is a narrow backward-compatible approach, provided a deployed trace confirms both the accepted and rejected paths.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded but important coordinator safety correction rather than an active availability emergency.
  • merge-risk: 🚨 compatibility: Existing clients and provider aliases must retain their documented legacy and upgrade behavior while expected-provider validation is added.
  • merge-risk: 🚨 session-state: The PR changes coordinator lease and control-socket mutation paths that maintain persisted lease and subscription state.
  • merge-risk: 🚨 security-boundary: The change enforces which selected provider is allowed to mutate a stored lease, an authorization-relevant identity boundary.
  • 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: Automated checks are listed, but the PR body has no redacted after-fix coordinator trace demonstrating a successful matching-provider mutation and a rejected cross-provider mutation. 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 provider fence: The current control-WebSocket heartbeat payload has no expected-provider field, so main cannot bind this mutation to the selected provider. (internal/cli/control_ws.go:207, 77550c511991)
  • Control-state contract: Current Worker tests explicitly serialize fallback control socket messages with coordinator state transitions, establishing the concurrency-sensitive boundary affected by the PR. (worker/test/coordinator-runtime.test.ts:746, 77550c511991)
  • Related state path: Run-event broadcasting persists the per-socket subscription cursor before sending events, so provider-fence changes must preserve coordinator ordering and attachment state. (worker/src/fleet.ts:15958, 77550c511991)
  • Prior review continuity: The latest commit changes only two CLI test files after the previous review; the coordinator Worker paths remain at the prior reviewed head. (worker/src/coordinator-runtime.ts, c59569fc58e8)
  • Proof gap: The PR body lists automated checks and source-level contracts, but contains no redacted after-fix coordinator trace showing both a matching mutation succeeding and a mismatched provider receiving the intended rejection. (c59569fc58e8)
  • Inspection limitation: The local partial clone could not materialize PR Worker blobs because its promisor remote was unreachable; review of PR-only Worker details therefore used the supplied PR diff context. (worker/src/fleet.ts, c59569fc58e8)

Likely related people:

  • steipete: Current-main blame attributes the coordinator runtime’s control-socket serialization boundary to this contributor, who also authored the PR. (role: recent coordinator contributor; confidence: high; commits: 13f20f81edd7; files: worker/src/coordinator-runtime.ts, worker/src/fleet.ts)

Rank-up moves

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

  • Add a redacted CLI-to-coordinator transcript showing both the matching and cross-provider mutation outcomes, then update the PR body for re-review.

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 (2 earlier review cycles)
  • reviewed 2026-08-14T20:21:40.540Z sha 7d1d8ee :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-14T20:51:01.245Z sha c5d9c3e :: needs real behavior proof before merge. :: [P1] Preserve serialization for every control message

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 14, 2026
@steipete
steipete merged commit fda8079 into main Aug 14, 2026
23 checks passed
@steipete
steipete deleted the steipete/coordinator-mutation-provider-fence branch August 14, 2026 21:35
@steipete
steipete restored the steipete/coordinator-mutation-provider-fence branch August 14, 2026 21:35
@vincentkoc
vincentkoc deleted the steipete/coordinator-mutation-provider-fence branch September 25, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 Merging this PR could lose, corrupt, stale, or mis-associate session or agent state. 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