Repository navigation
refactor: build exact-review lease heartbeats with one typed command - #1796
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. |
|
Codex review: needs maintainer review before merge. What this changesThe review workflow builds lease heartbeats—requests that confirm a worker still owns a review—with one typed command instead of copied shell builders. Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review Keep open: this is a useful, bounded consolidation that current main does not contain. No actionable patch defect was found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGitHub Actions workers send lease heartbeats to ClawSweeper’s review queue before generation, during review, and around status publication. The queue checks ownership and returns whether the worker may continue. flowchart TD
A[Workflow lease fields] --> B[Typed heartbeat command]
C[Review or status phase] --> B
B --> D{Valid request inputs?}
D -->|No| E[Stop before sending]
D -->|Yes| F[Existing curl retry client]
F --> G[Review queue ownership check]
G --> H[Continue or stop worker]
Technical reviewBest possible solution: Keep heartbeat serialization in one typed command while leaving queue authorization and transport retries with their existing owners. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates existing heartbeat construction rather than fixing a reported user-facing failure. Is this the best way to solve the issue? Yes: the command replaces copied builders without adding a competing transport or changing the queue’s ownership contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 75fbe0ae0beb. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 9, 2026, 4:10 AM ET / 08:10 UTC. |
What
A typed exact-review queue request command, and its first lane: every lease heartbeat in
event-review-apply.src/repair/exact-review-queue-request.ts(built todist/repair/exact-review-queue-request.js).heartbeat --phase <review|status|finalizing> [--review-acknowledgement-comment-id <id>] [--generation-start]reads the lease tuple fromEXACT_REVIEW_ITEM_KEY,EXACT_REVIEW_LEASE_ID,EXACT_REVIEW_LEASE_REVISION,EXACT_REVIEW_CLAIM_GENERATION,EXACT_REVIEW_SOURCE_HEAD_SHA,GITHUB_RUN_IDandGITHUB_RUN_ATTEMPT. It validates the tuple with the queue's own rules (positive integers, numeric run id, 40-hex head SHA). It prints the JSON body. The phase options are a discriminated union: an acknowledgement comment id only withstatus,generation_startonly withreview, because the queue accepts them only there. Invalid input prints no body and exits 1.control_plane_curlstays the transport. Response handling in the steps is unchanged.event-review-apply. It had 9 inlinenode -eheartbeat builders (3 validated, 6 not), plus the review step'smark_finalizingNode derivation andverify_startup_authorityjqderivation. All 11 now call the command.prepare_heartbeatbuilds the review, startup and finalizing bodies before generation, so an invalid tuple still stops the step before any request.Copy counts (lease heartbeat body builders in
.github/workflows/sweep.yml):node -ebuildersnode -espread,jq '. + {generation_start: true}')Why
agent://SlopWorkflows/report finding 2: the queue protocol lives in ~30 YAML heredocs, and typed decisions are rebuilt from env strings with ad-hoc checks. The heartbeat body is the most copied of them. Validation had drifted: 3 copies checked the tuple, and 6 sent
Number("")→0and let the queue reject it.Proof
origin/main:sweep.ymland executed as it was; the new body comes from the built command:The two semantic differences add
"phase":"review". The queue already treats a missing phase asreview(dashboard/exact-review-queue.ts:body.phase === undefined ? "review" : …), and it requiresgeneration_startto come with phasereview.scripts/e2e/exact-review-start-authority.mjsruns the real "Review exact event item" shell andcontrol-plane-curl.shagainst an isolated HTTP peer. It needs Linux process groups (the test skips on macOS), so it ran innode:24-bookworm --init. Before (main's lane) and after: all 12 scenarios have the same results (stale, stale-oversized, revoked-during-oversized-setup, inactive, unknown-conflict, service-failure, transport-failure, retry-current, invalid-tuple with 0 requests, current, current-oversized, revoked-after-start).guarded=true, every process group reaped,currentchargesgeneration_startexactly once.test/sweep-workflow.test.tsexecutes the extracted fence and startup scripts. The startup test now runs the realprepare_heartbeatagainst the built command.test/repair/exact-review-queue-request.test.tsruns the CLI entry point for bodies and every rejection.pnpm run check: 6964 pass. The first run had two failures: a test that pinned the oldphase: "finalizing"text (fixed in 9de2b99) and the knowninterrupted native unshallowgit-acquisition flake, which passes alone (13/13). After the fix,test/review-reliability-workflow.test.tspasses.codex review --base origin/main: "No actionable defects found."Saved real reports re-rendered with
render-comments.mjs(prompt-rest, prompt-lean, prompt-dump, async-proof/{base,branch}, retire-proof/166090): 6/6 byte-identical.Codex dispositions
codex review --base origin/main: no findings.Merge Danger
event-review-applylease heartbeats (status fences, the review heartbeat loop, the startup ownership check, finalization). All migrated steps run only aftersetup-pnpmwithbuild:allsucceeded, sodist/repair/exact-review-queue-request.jsis present. If the command failed, the fences would fail closed (no GitHub mutation) and the review would not start. The e2e above shows the lane behaves the same in all 12 scenarios.