Skip to content

fix: reconcile reads canonical records with operator auth - #1149

Merged
steipete merged 7 commits into
mainfrom
steipete/operator-record-read-auth
Aug 13, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/operator-record-read-auth

Conversation

@steipete

@steipete steipete commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #1148

What Problem This Solves

Fixes an issue where exact-review dead-letter reconciliation classified every checked head mismatch as unproven when it tried to read the completed canonical review with its operator credential. Production run 31651591787 hit this for all ten checked targets because the existing canonical-record GET accepted only the separately configured webhook credential.

Why This Change Was Made

The existing read-only canonical-record route now verifies the webhook secret first and falls back to the exact-review operator secret only for the items collection, which is the sole collection read by reconciliation. closed, plans, and decision-packets remain webhook-secret-only. Missing required configuration still returns 503, invalid signatures still return 401, and the operator script and workflows remain unchanged.

The operational-cursor GET/PUT route remains webhook-only because its current client explicitly uses that credential and no operator-secret consumer exists.

User Impact

Operators can reconcile stale head-mismatch dead letters using completed canonical-review evidence instead of receiving false 401 failures and leaving every checked target as head_mismatch_unproven, without gaining read access to unrelated canonical collections.

OpenClaw Bay Impact

OpenClaw Bay is unaffected. This changes authentication on one existing internal read-only route and does not alter queue lifecycle state, telemetry, dashboard data contracts, or Bay's observer-only boundary.

Documentation Lifecycle

The docs/proof/operator-record-read-auth/ package is historical, frozen evidence for this change. It is not an active runbook or operational source of truth.

Finding Disposition

  • [P1] Limit operator fallback to active item records — resolved. Operator fallback is now restricted to items; closed, plans, and decision-packets retain webhook-only authentication.
  • Rank-up move — applied. Router and real-Worker coverage now prove denied operator access to the three webhook-only collections and retained webhook access to all four collections.

Evidence

  • Router-level distinct-secret regression test covers operator, webhook, and garbage signatures across all four collections, plus missing-configuration 503 behavior.
  • Docker-backed Crabbox provider=local-container receipt: lease cbx_23906feb2769 (pearl-shrimp-a24f), image node:24-bookworm, exit 0, lease auto-stopped.
  • Real Worker candidate matrix: operator items/closed/plans/decision-packets = 200/401/401/401; webhook = 200/200/200/200; garbage = 401/401/401/401.
  • pnpm run check:dashboard-strict passed without adding dashboard/worker.ts to the strict list.
  • pnpm run check passed in the same container: 3,401 tests, 3,393 passed, eight platform skips, zero failures.
  • Final committed autoreview --mode branch --base origin/main --max-priority P1: no accepted/actionable findings.
  • Final branch head: 06561bd4ee433cc3318a0ffd91d29ed29d9856d7. The frozen receipt committed in that push exercises executable head 1855dfbb0c0d0b66978a99b20756845e3d6fa131; the final commit only records the generated proof artifacts.

Real Behavior Proof

Claim: The production canonical-record GET accepts the exact-review operator credential only for active item records, preserves webhook access to all four canonical collections, and rejects invalid credentials everywhere.

Exercised surface: Two sequential real wrangler dev --local Workers over loopback HTTP, using the production router and SQLite-backed ExactReviewQueue Durable Object.

Scenario: The proof publishes valid synthetic open and closed canonical tuples to merge-base and candidate Workers configured with distinct webhook and operator values. It signs GETs for items, closed, plans, and decision-packets with the operator value, webhook value, and garbage. Between boots it kills the complete Wrangler process tree, requires /api/health to stop responding, and reuses the same port with separate persistence.

Command and environment: Docker-backed Crabbox provider=local-container, image node:24-bookworm, lease cbx_23906feb2769 (pearl-shrimp-a24f), tested executable head 1855dfbb0c0d0b66978a99b20756845e3d6fa131, base ae36d608d01701af7e06c313be96689068b5c890. The exact command is frozen in docs/proof/operator-record-read-auth/receipt.json.

Observable result: The candidate returned operator 200/401/401/401, webhook 200/200/200/200, and garbage 401/401/401/401 for items/closed/plans/decision-packets. The merge base remained webhook-only. Both process-tree shutdown checks observed the health endpoint down. The focused router test, dashboard-strict gate, and full repository gate passed in the same lease. Crabbox exited 0 and reported leaseStopped=true.

Artifact or trace: docs/proof/operator-record-read-auth/behavior-report.json, container-transcript.txt, container-stderr.txt, and receipt.json. TruffleHog 3.96.0 found zero verified or unknown secrets in the captured logs.

Limits: Credentials and record content are synthetic. The proof exercises the real local Worker, router, HMAC verification, and Durable Object record store; it does not deploy, read production state, mutate GitHub beyond this PR update, or broaden cursor authentication.

@clawsweeper

clawsweeper Bot commented Aug 13, 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: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 8:28 PM ET / August 13, 2026, 00:28 UTC.

ClawSweeper review

What this changes

The PR lets the exact-review operator credential read active canonical item records while retaining webhook-only access to closed records, plans, and decision packets.

Regression provenance

Possible regression — probable (reproduction; reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still rejects the operator-signed canonical item read, and this PR repairs that bounded mismatch. The prior P1 is resolved by restricting fallback authentication to items.

Likely related people: steipete (recent area contributor; high confidence).

Priority: P2
Reviewed head: 06561bd4ee433cc3318a0ffd91d29ed29d9856d7

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) The small authorization repair has focused coverage, a resolved prior finding, and strong real-Worker proof.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The PR includes a Docker-backed real local Worker run with distinct credentials and the expected before/after authorization matrix.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The PR includes a Docker-backed real local Worker run with distinct credentials and the expected before/after authorization matrix.
Evidence reviewed 7 items Current-main gap: Current main accepts canonical-record reads only with the webhook secret, while the reconciliation workflow supplies the operator secret for this client.
Scoped authorization: The branch captures the requested collection and enables operator-secret verification only when it is items; all other collections keep the webhook-only path.
Sole identified consumer: The dead-letter reconciliation operator reads only /records/<slug>/items/<number>, matching the new narrow fallback boundary.
Findings None None.
Security None None.

How this fits together

Exact-review reconciliation reads canonical records from the dashboard Worker before resolving stale review jobs. The Worker authenticates the signed request and forwards permitted reads to the Durable Object record store.

flowchart LR
  A[Reconciliation worker] --> B[Signed item-record request]
  B --> C[Dashboard Worker]
  C --> D{Record collection}
  D -->|Active items| E[Webhook or operator authentication]
  D -->|Other collections| F[Webhook authentication]
  E --> G[Canonical record store]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Merging deliberately grants the operator credential read access to active canonical item records across repository slugs; the submitted route and proof retain the webhook-only boundary for the other three collections.
  • Complete next step (P2) - The patch has no remaining mechanical defect; it needs normal maintainer approval after the current checks finish.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Authorization matrix 12 credential-and-collection outcomes The focused test and real Worker proof cover three credentials across four collections.
Diff shape production +23/-5, tests +78, frozen proof +1,211 The executable change is narrow; the larger remainder is auditable proof for the internal authentication boundary.

Merge-risk options

Maintainer options:

  1. Accept the item-only credential scope (recommended)
    Merge with operator access limited to active item records and the existing webhook-only boundary retained for closed, plans, and decision-packet records.

Technical review

Best possible solution:

Preserve the item-only operator fallback and merge the repair after the current review and normal status checks are ready for maintainer approval.

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

Yes: source shows reconciliation signs an active-item canonical-record GET with the operator credential while current main accepts that route only with the webhook credential.

Is this the best way to solve the issue?

Yes: reusing the existing signed route and allowing the operator credential only for the sole consuming collection is the narrowest maintainable repair.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR includes a Docker-backed real local Worker run with distinct credentials and the expected before/after authorization matrix.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This repairs a bounded internal reconciliation workflow without evidence of a user-facing outage.
  • merge-risk: 🚨 security-boundary: The Worker accepts an additional credential for one existing internal record-read collection.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The PR includes a Docker-backed real local Worker run with distinct credentials and the expected before/after authorization matrix.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR includes a Docker-backed real local Worker run with distinct credentials and the expected before/after authorization matrix.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the recent main-branch reconciliation change touching the dashboard Worker and authored the current scoped repair. (role: recent area contributor; confidence: high; commits: c8a9737486d5, 06561bd4ee43; files: dashboard/worker.ts, scripts/exact-review-dead-letter-operator.mjs)

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-13T00:04:04.954Z sha e57a601 :: needs changes before merge. :: [P1] Limit operator fallback to active item records
  • reviewed 2026-08-13T00:11:02.697Z sha e57a601 :: found issues before merge. :: [P1] Limit operator fallback to active item records

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The main PR body now records the requested finding disposition and Rank-up exception against the explicit work-order authorization boundary. The head and frozen proof are unchanged.

@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 13, 2026
@steipete
steipete merged commit 637c333 into main Aug 13, 2026
19 checks passed
@steipete
steipete deleted the steipete/operator-record-read-auth branch August 13, 2026 00:30
steipete added a commit that referenced this pull request Aug 14, 2026
#1163)

Quota campaign PR 3/5: content-addressed R2 cache for exact-review bundles - repeat artifact downloads stop hitting GitHub entirely.

Design: on first successful GitHub artifact download the validated bundle is stored at immutable R2 key artifacts/exact-review/v1/<sha256> via the existing state-blob transport; a queue receipt binds the digest to producer run/attempt, artifact name, canonical item key, lease revision, and protocol version. Retries look up the receipt, fetch from R2, and verify the digest before use; any absence, corruption, or lease-revision mismatch falls back to GitHub (artifacts remain the authority - R2 is strictly a cache). New endpoints (/artifact-cache/receipt/lookup|store) authenticate with the publisher-scoped webhook secret; the operator secret keeps its admin-only scope per the #1149 least-privilege doctrine. Retention: 30 days with bounded incremental pruning (128 rows/objects per pass).

Counted proof: repeat downloads for the same publication tuple go 1 -> 0 GitHub requests; missing-object and lease-mismatch cases each correctly fall back with 1. Targets the repository_actions:artifact_download class (12.8k cumulative + ~6k circuit-skips, 36% measured repeat floor). Phase B (producer uploads R2 directly, GitHub becomes disaster fallback) follows once this proves out in production.

Proof: real R2 semantics in the container, full gate green + dashboard-strict, Crabbox local-container receipt at this exact head, machine-verified SHA provenance. Verdict clean (no findings, proof sufficient) on 8be2e61.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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