Repository navigation
perf(review): cache exact-review bundles in R2 - #1163
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 1:37 AM ET / 05:37 UTC. ClawSweeper reviewWhat this changesThe PR adds an R2-backed, digest-addressed cache for validated exact-review artifact bundles so unchanged publication retries can avoid GitHub artifact downloads. Merge readinessKeep open for normal maintainer review: the supplied PR evidence shows a real local cache/fallback exercise, but local source and history inspection could not run because the read-only sandbox failed before executing commands. Priority: P2 Review scores
Verification
How this fits togetherExact-review publication prepares review bundles from GitHub artifacts before publishing review results. This cache sits between that preparation step and GitHub Artifacts, using Durable Object receipts and R2 objects to reuse a validated bundle while preserving GitHub fallback behavior. flowchart LR
A[Exact review publication] --> B[Receipt lookup]
B --> C{Valid R2 cache entry?}
C -->|Yes| D[Restore validated bundle]
C -->|No| E[Download GitHub artifact]
E --> F[Validate and cache bundle]
D --> G[Publish review result]
F --> G
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land only after a reviewer can inspect the current-base merge result and confirm that malformed, missing, and expired receipt paths preserve the established GitHub fallback and circuit behavior. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect report; the PR supplies a high-confidence controlled behavior exercise of the new cache protocol, but local independent execution was unavailable. Is this the best way to solve the issue? Unclear; the cache-first design and explicit GitHub fallback are plausible, but the sandbox failure prevented verification against current main and the complete merged implementation. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against c9eda83c29d2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…arges (#1164) Quota campaign PR 4/5: durable ETag read broker - unchanged GitHub responses stop costing quota. No wrapper sent If-None-Match before this; every repeat read paid a full quota charge (measured repeat floors: item_metadata 21.5%, comments 17.6%, reviews 19.5%). The broker persists ETag + body + digest in the queue DO (publisher-HMAC endpoints per the #1163 pattern; 30-day TTL; 2048-entry/512KiB bounds), keyed by credential pool, sorted route/query, media type, and page - a page-1 304 can never validate page 2. Cached bodies are released only after a live 304 plus digest confirmation; final pre/post-mutation guards always revalidate (a 304 is a live authoritative answer, but no guard ever consumes an unrevalidated cache). Composes with #1161: generations cover within-run reuse, the broker covers cross-run revalidation. Integrated at the highest-repeat sites first: apply issue/pull metadata, paged comment/review collections, dashboard run/job health reads. Telemetry counts 200-with-store, 304-from-cache, miss, and skip as distinct units - this PR reduces QUOTA CHARGES, not wire requests (5 wire calls / 3 charged 200s in the counted fixture). Proof: loopback ETag semantics with byte-identical 304 replay (digest asserted), page isolation, final-guard revalidation; full gate 3446/0 + dashboard-strict; Crabbox local-container receipt at this exact head, machine-verified provenance. Verdict clean (no actionable findings, proof sufficient) on bd2ef95.
Summary
Cache validated exact-review artifact bundles in R2 by content digest so unchanged publication retries can avoid another GitHub artifact download. GitHub Artifacts remains authoritative: every cache miss, missing/corrupt object, receipt mismatch, or validation failure falls back to the existing GitHub path, subject to the existing open-circuit skip.
This is phase A of the two-phase design: GitHub download first, then populate R2. Producer-side R2 upload remains a later change after this path is proven.
Analysis citation
Implements rank 3,
repository_actions:artifact_download, from the 2026-08-13 ClawSweeper GitHub API savings analysis: 12,784 observed artifact-download operations plus roughly 6,000 circuit skips, with a conservative 36% successful-repeat floor. The analysis recommended an immutable digest key plus a receipt binding producer run/attempt, canonical item key, lease revision, and protocol version.Protocol and ownership
artifacts/exact-review/v1/<lowercase-sha256>.(producer_run_id, producer_run_attempt, artifact_name, canonical_item_key, lease_revision, protocol_version).digest,bytes, derivedobject_key,created_at, andexpires_at.CLAWSWEEPER_WEBHOOK_SECRET. These are automated publisher data-plane operations, and that secret already enters the batch job.EXACT_REVIEW_OPERATOR_SECRETremains confined to human recovery/admin endpoints.Retention
Receipts expire after 30 days, matching existing terminal-receipt conventions. Each cache lookup/store performs bounded incremental cleanup: at most 128 expired receipts and one 128-object R2 page. A digest-leading
(digest, expires_at)index supports live-reference checks. Old unreferenced objects, including upload orphans, are deleted; active receipts retain shared objects.Counted behavior proof
Docker-backed Crabbox
provider=local-container, leasecbx_27fd45c696a1, imagenode:24-bookworm; lease stopped automatically. The committed receipt is docs/proof/r2-bundle-cache/receipt.json.All four paths produced SHA-256
3133665a6449f68c78754dfdca7548fa3b450474dd97cd54f4bb79b2a86d8eb3. Counted repeat result:1 → 0GitHub artifact requests (100% avoided for the exercised repeat).Behavior-tested code head:
0e9ca08dea526b536e6818176228a09409a3c6a9; tree:d06aa801c6ee434707f15d9724e237bb8cec8181. Both were resolved withgit rev-parseand cross-checked withgit cat-file -ebefore the container run. PR tip8be2e61d6cb4aca6feb1685be695727e37ca11d6differs only by the refreshed committed receipt.The same lease ran
pnpm run check: dashboard-strict, docs, formatting, builds, all lint lanes, 260-file full tests, and coverage passed (81.58% lines / 74.00% branches / 87.41% functions).Limits: Wrangler local R2/Durable Object semantics rather than deployed Cloudflare networking; counted loopback artifact server rather than GitHub's hosted artifact service. Production bundle input remains bounded at 64 MiB, with a 66 MiB archive bound.
Review disposition
OpenClaw Bay
Not affected. This changes internal publication data-plane acquisition and adds no observer or control contract; Bay remains observer-only.