Refuse to cancel an enrollment once Cloud may have sent its join #3315
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #3315"
general
weight: 0.35
nick-potts
Fixes #3280. Cancel (the dashboard button and
POST /api/cli/enrollments/:id/cancel) now refuses once Cloud may have sent the Server's join. Before, the attempt readcancelledwhile the Server stayed in the mesh, holding the Sealing Key.The issue offered two fixes: refuse after Register, or remove the Server and rotate the key. This takes the first.
How
Cloud saves a join's assignment (
enrollment_allocation) holding the enroll token's row lock, commits, and only then sends Register. The token is the point where cancel and join meet.The two possible orders:
requireUnspentClaimsees it expired and returns Unauthorized before any assignment is saved.Expiring the token at cancel, not when the run later ends the attempt, closes the case where an attempt bound to a run stays open after Cancel was accepted.
Scoping.
prepareJoinandreleaseUnsentJoinSlotalready scope them. A Machine keeps its ID across a forgotten pairing.Reject (
reject.server.ts, unchanged) already spares attempts whose join the host reported as committed. It now also spares the ones the new check finds, since it goes through the same function.Bets touched (core/DESIGN.md).
Stable promise. Additive. No schema, migration or wire change.
cancelServerEnrollmentsnow returns the attempts it spared. Its other two callers ignore the result.Evidence
{ cancelling: true }and left the token live. On an accepted Cancel of an attempt bound to a run, main left the token live.enroll.server.postgres.test.ts):- a saved assignment makes Cancel refuse and Reject spare the attempt;
- an accepted Cancel of a bound attempt expires the token at once;
- an assignment saved under a forgotten pairing doesn't block Cancel;
- an earlier assignment doesn't block a later attempt that hasn't claimed its token.
server rm machine-2there never got past "Waiting for approval in Ployz Cloud", so I tore the run down. The interleavings above are proven at the database level only.- Round 1.
codex/gpt-6.1-solandclaudeAgent/claude-opus-5-5reviewed an earlier design that marked the attempt's stagejoiningbefore Register. They found a P1: Cancel on an attempt bound to a run didn't stop a later Register. They also found a P2: the host reportsstorageafter Register, so its heartbeats would repeat that report and could exhaust the run's event budget. Both were fixed by replacing the design with the token gate above.- Round 2. Codex found one P2: assignments from a forgotten pairing counted. Fixed by scoping to the current pairing. Claude raised a P2: one saved assignment would block every later attempt of that Machine. Dismissed, because a queued attempt hasn't claimed its token, and a test pins it. Codex confirmed in round 3 that the dismissal holds for a fresh queued attempt.
- Round 3. Codex found nothing new.
Known limits
cancelOpenServerEnrollments) and the stale sweep still end attempts without checking for a sent join, as before.Merge Danger
Door: two-way. Blast Radius: Cloud's Cancel and Reject of enrollment attempts, and the order of two token checks in
enrollMachine.