Repository navigation
refactor: build terminal-finalization requests with the typed queue request command - #1812
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 uses one typed command to build requests that finish command status updates, replacing four copied inline 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 sends final command acknowledgements to ClawSweeper’s review queue. The queue checks ownership and records whether the command finished, needs another attempt, or completed without a status comment. flowchart TD
A[Claimed workflow lease] --> C[Typed request command]
B[Status address and completion] --> C
C --> D{Valid inputs?}
D -->|No| E[Stop before sending]
D -->|Yes| F[Existing HTTP client]
F --> G[Queue ownership checks]
G --> H[Record acknowledgement or skip]
Technical reviewBest possible solution: Keep request serialization in the existing typed command while retaining queue authorization and HTTP transport with their current owners. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR consolidates request construction rather than reporting a user-facing failure; source confirms the four copied builders and their differing validation. Is this the best way to solve the issue? Yes: extending the existing serializer replaces duplicate construction without adding a competing transport or changing the queue’s authorization contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d559d9e498e4. 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, 6:04 AM ET / 10:04 UTC. |
What
Third lane for the typed queue request command (after #1796 and #1802): the
event-review-terminal-finalizationsteps that run after checkout.src/repair/exact-review-queue-request.ts:terminal-finalization <attempt|skip>. It reads the claimed lease tuple through the existingEXACT_REVIEW_*/GITHUB_RUN_*reader, so the lease rules are the same ones the heartbeat uses. The skip reason must belocked_conversation|missing_status_comment.lifecyclesubcommand, because they post to/lifecycle/command-ack/*and use the same lifecycle target:command-ack-failedandcommand-ack-observed.observedchecks the comment ids,completed_atand asuccess|failureoutcome.--status-marker/--status-comment-idaddress the command status comment, and an empty value means no such address. As before, the attempt, skip and observed bodies need at least one address, and failed may have none.sweep.yml,event-review-terminal-finalization, four inline builders replaced:EXACT_REVIEW_ITEM_KEY/EXACT_REVIEW_LEASE_ID/EXACT_REVIEW_LEASE_REVISION/EXACT_REVIEW_CLAIM_GENERATION, like the review steps. They dropRUN_ATTEMPT(it wasgithub.run_attempt, which the runner already exports asGITHUB_RUN_ATTEMPT). TheSTATUS_STATE == "Failed"→failuremapping for the observed receipt is now three shell lines next to the call.setup-pnpmwithbuild:repair, sodist/repair/exact-review-queue-request.jsis present.RUNNER_TEMPhelper when checkout failed. Both are for the bootstrap slice.Copy counts (
event-review-terminal-finalizationinline body builders):node -ebuildersWhy
agent://SlopWorkflows/report finding 2. The four builders repeated the lease tuple and the status-address rules in two shapes. Validation had drifted: the observed builder checked the comment id, but attempt and skip turned a non-numeric comment id into
nulland still sent the request.Proof
origin/main:sweep.ymland run with its own env names. The new command runs with the renamed env and flags for the same values, withDate.nowfrozen in both processes forobserved_at:node:24-bookworm). There was no existing harness that runs these steps, so a proof driver (not committed) serves the realExactReviewQueueDurable Object fromtest/dashboard-worker-harness.tsover HTTP and checks the HMAC on/lifecycle/*. It parks a command the same waytest/parked-command-finalization.test.tsdoes and claims its terminal-finalization driver. It then runs the checked-in step shells with the realcontrol-plane-curl.sh, and evaluates each step'senv:block from its expressions, so the env renames are exercised too. The same scenarios run with thefac77558dworkflow and with this branch's workflow:(The status write is a stubbed
pnpmthat fails, which takes the command-ack/failed path. Lease and attempt ids are random per queue and are masked before comparison.) In the same container, on both commits:test/terminal-finalization-cancellation-workflow.test.ts+test/parked-command-finalization.test.ts57/57 pass, andscripts/e2e/control-plane-checkout-cleanup.mjs(covers the unchanged requeue step) passes.scripts/e2e/manual-review-publication.mjsdoes not run this job, so I did not use it here; its pre-existing batch-lane failure on main is unchanged by this PR.test/repair/exact-review-queue-request.test.tsruns the built command for the new bodies and every rejection.pnpm run check: 6969 pass, 2 fail. Both failures are the knowncommand-proof-consumertimeouts under load; the file passes alone (29/29).codex review --base origin/main: "No actionable defects found." Saved real reports re-rendered withrender-comments.mjs: 6/6 byte-identical.Codex dispositions
codex review --base origin/main: no findings.Merge Danger