Skip to content

refactor: sign workflow control-plane requests in one helper - #1794

Merged
obviyus merged 3 commits into
mainfrom
control-plane-signed-post
Oct 9, 2026
Merged

obviyus merged 3 commits into
mainfrom
control-plane-signed-post

Conversation

@obviyus

@obviyus obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

One owner for signing control-plane requests in workflow shell steps.

  • scripts/control-plane-curl.sh gets control_plane_signed_post <url> <body> [curl options...]. It computes x-clawsweeper-exact-review-signature: sha256=<hex HMAC-SHA256 of the exact body, keyed by CLAWSWEEPER_WEBHOOK_SECRET>, sets content-type: application/json, sends the body with --data-binary, and goes through control_plane_curl, so the retry policy is unchanged. The URL stays the last curl argument.
  • Every copied signature="$(PAYLOAD=... node -e 'createHmac(...)')" + 5-line curl block in .github/workflows now calls the helper.
  • The helper is already available in all three bootstrap modes (repo checkout, RUNNER_TEMP raw download, fallback), so pre-checkout jobs need no new download.
  • Tests and the drift e2e stub follow the helper (--data-binary instead of --data). docs/scheduler.md documents the helper.

Copy counts (HMAC one-liners in .github/workflows):

before after
sweep.yml 13 (one used "sha256="+… instead of a template literal) 0
exact-review-reconcile-run.yml 1 0
scripts/control-plane-curl.sh 0 1

Not changed: the scheduled sweep job in exact-review-reconcile.yml is a Node program that signs inside its own fetch client. It is audit finding 8(b) and moves with the queue-client slices. docs/proof/** stays frozen.

Why

agent://SlopWorkflows/report finding 3: the signing line was copied verbatim about 11 times (actually 14) with drift already present (sweep.yml "Record deferred close-proof" used string concatenation). A signing-format change was a 14-site edit. Finding 2 asks for this to ship before the typed queue client.

Proof

  1. Signature and body byte identity, old one-liners vs helper, fixed inputs (secret with $, backtick, quote, backslash, unicode; payloads with quotes, backslash, $HOME, emoji, and {}), curl replaced by an argv recorder:
body-identical  old=sha256=26c3c61d112e37f0930e3512564cb8b00d319dd33bea625935e98160df7c7c44 new=sha256=26c3c61d112e37f0930e3512564cb8b00d319dd33bea625935e98160df7c7c44 url=http://queue.invalid/internal/exact-review/enqueue
body-identical  old=sha256=a12f05a9b791494f3d74fa603b1de9476c716b4c3a388a76921cec4923e174bf new=sha256=a12f05a9b791494f3d74fa603b1de9476c716b4c3a388a76921cec4923e174bf url=http://queue.invalid/internal/exact-review/enqueue
body-identical  old=sha256=bc838e26d59ff4c25ed498f77ffdad23e786a14cbb5e4b6409968143d5d86d8f new=sha256=bc838e26d59ff4c25ed498f77ffdad23e786a14cbb5e4b6409968143d5d86d8f url=http://queue.invalid/internal/exact-review/enqueue
signatures byte-identical for 3 fixed payloads

Both old variants (template literal and "sha256="+…) produce the same value.

  1. Real curl against a real HTTP server: the old sweep.yml form (--data "$payload") and the helper send identical requests on the wire (method, URL, content type, signature, body hex):
{"sig":"sha256=030535ece480d24c82e0bd74e2829bdd9fd2f307c827a6503c9f541dab67dba4","type":"application/json","method":"POST","url":"/internal/exact-review/lifecycle/router-receipt","body":"7b2263616e…227d"}
{"sig":"sha256=030535ece480d24c82e0bd74e2829bdd9fd2f307c827a6503c9f541dab67dba4","type":"application/json","method":"POST","url":"/internal/exact-review/lifecycle/router-receipt","body":"7b2263616e…227d"}
old and new requests are byte-identical on the wire
  1. Lane through its e2e harness: scripts/e2e/apply-drift-refresh.ts (via test/apply-drift-refresh.test.ts) runs the real legacy-event-queue-intake shell with the real control-plane-curl.sh; its curl stub verifies the HMAC of the received --data-binary body before it enqueues into the dashboard harness. Green. test/repair/exact-review-reconcile-workflow.test.ts runs exact-review-reconcile-run.yml against an HTTP server that rejects a bad signature with 401. Green.

  2. pnpm run check: 6964 pass, 0 fail, 37 skipped. The run exits 1 only on the known coverage file is empty flake after all tests pass. codex review --base origin/main: "No actionable defects found."

  3. 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 (no src change).

Codex dispositions

  • codex review --base origin/main: no findings.

Merge Danger

  • Door: two-way. Revert restores the inline one-liners; there is no stored data and no protocol change.
  • Blast radius: every signed shell call in sweep.yml (legacy intake enqueue, direct lifecycle receipts, publication enqueue, publisher lifecycle receipts, drift requeue, command-ack failed/observed) and the event reconcile. A broken helper would turn these calls into 401s/failures. The proofs above show identical bytes on the wire, and pre-checkout jobs load the helper from the same pinned file that they already source.

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@obviyus
obviyus requested a review from a team as a code owner October 9, 2026 07:56
@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The workflows use one shared helper to sign requests to the control plane, the service that coordinates review jobs, while preserving request and retry behavior.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused consolidation with real transport equivalence evidence and no actionable correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The supplied terminal trace exercises the production shell helper with real curl against HTTP and shows matching method, route, headers, signature, and body before and after consolidation. Reported reconciliation coverage also executes the production workflow shell against a signature-checking HTTP server; hosted Actions execution is outside this proof’s scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The refactor gives an existing signing operation one owner and removes more production code than it adds. Its maintenance value is clear, and it preserves designed behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a narrow, useful refactor that current main does not contain. No actionable patch defect was found.

Priority: P3
Reviewed head: 5898029ddb78e6be706471949fb0db2e7b591aa8

Before merge

None.

Findings

None.

Agent review details

How this fits together

GitHub Actions sends signed requests to ClawSweeper’s control plane to enqueue reviews, record publication receipts, and reconcile completed runs. The shared shell helper sends those requests through the existing bounded retry client.

flowchart TD
  A[GitHub Actions workflow] --> B[Request URL and JSON body]
  B --> C[Shared signing helper]
  D[Existing webhook secret] --> C
  C --> E[Existing retry client]
  E --> F[Control plane]
  F --> G[Response and exit status]
Loading

Technical review

Best possible solution:

Keep signing beside the existing retry client and preserve the workflow payloads and response contracts.

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

Not applicable: this PR consolidates existing behavior rather than fixing a reported runtime failure.

Is this the best way to solve the issue?

Yes: adding signing to the existing retry helper removes duplication without creating a competing client or changing endpoint contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f80d0f1c3a9d.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Repository policy: Read the complete root AGENTS.md; no nested AGENTS.md or maintainer-notes directory was present. Applied narrow-change, proof, bootstrap, changelog-fragment, and read-only review guidance. (AGENTS.md:1, 5898029ddb78)
  • Introduced implementation: The pinned introduced diff replaces 14 inline signing blocks with the shared helper. Each call retains its URL, payload, timeout, response handling, and failure handling; the helper retains HMAC-SHA256 and delegates to the unchanged retry client. (scripts/control-plane-curl.sh:47, 5898029ddb78)
  • Current-main necessity and base drift: Fetched main still contains only the retry helper and retains inline workflow signing. None of the eight introduced paths changed between the merge base and fetched main, so no overlapping base changes require synchronization. (scripts/control-plane-curl.sh:5, f80d0f1c3a9d)
  • Retry and bootstrap provenance: fix(queue): retry control-plane 5xx and propagate retryable admission failures (re-land) #1503 established bounded retries and commit-pinned temporary downloads to avoid sparse-checkout contamination. The parent-to-commit diff verifies the helper’s introduction; this PR preserves those mechanisms. (scripts/control-plane-curl.sh:5, 31fc0b87393b)
  • Real transport proof: The fully inspected PR body, captured source revision e382af5d257006e9052f41580e66f9123c18ee578241c65c5ca2b66ca4a04286, reports real curl requests to an HTTP server before and after the refactor. Both show POST /internal/exact-review/lifecycle/router-receipt, application/json, matching body hex, and signature sha256=030535ece480d24c82e0bd74e2829bdd9fd2f307c827a6503c9f541dab67dba4. This demonstrates request equivalence, not deployed Actions execution. (5898029ddb78)
  • Workflow-client supporting coverage: The existing reconciliation test executes the extracted production Bash step with the real helper and curl against loopback HTTP that rejects incorrect signatures. The PR body reports this scenario passing; the drift harness separately checks the received body’s HMAC with a curl stub. (test/repair/exact-review-reconcile-workflow.test.ts:116, 5898029ddb78)

Likely related people:

  • Peter Steinberger: Raw commit 31fc0b8 adds scripts/control-plane-curl.sh:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 31fc0b87393b; files: scripts/control-plane-curl.sh)

Review metrics

Metric Value Why it matters
Signing duplication 14 inline signing blocks replaced by 1 helper Signing-format maintenance now has one shell owner.
Production versus test changes Production +43/-96; tests and harness +11/-7 The consolidation reduces production code while adapting existing coverage.

Labels

Label changes:

  • add P3: This preserves existing behavior while reducing workflow maintenance cost.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This preserves existing behavior while reducing workflow maintenance cost.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

Reviewed October 9, 2026, 4:00 AM ET / 08:00 UTC.

@obviyus
obviyus merged commit 2ad1cdb into main Oct 9, 2026
23 checks passed
@obviyus
obviyus deleted the control-plane-signed-post branch October 9, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant