Repository navigation
perf(github): add durable ETag read broker - #1164
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 2:17 AM ET / 06:17 UTC. ClawSweeper reviewWhat this changesThe PR adds a Durable Object-backed ETag broker that conditionally revalidates selected GitHub REST reads across publication and dashboard runs. Merge readinessThis PR remains necessary: it adds a distinct cross-run conditional-revalidation layer not present on the current main baseline. The supplied loopback proof is strong, but the review environment could not execute read-only repository inspection because its sandbox failed before commands ran, so source-level approval should wait for a fresh review-capable run. Priority: P2 Review scores
Verification
How this fits togetherClawSweeper’s publisher and dashboard read GitHub REST data to review items and show operational health. This change supplies cached validators before live reads and returns stored JSON only after a matching GitHub 304 confirmation. flowchart LR
A[Publication and dashboard readers] --> B[ETag key builder]
B --> C[Durable ETag broker]
C --> D[Live GitHub conditional read]
D --> E{Response status}
E -->|200| F[Store bounded JSON and ETag]
E -->|304 plus confirmation| G[Return confirmed stored JSON]
F --> H[Review and health decisions]
G --> H[Review and health decisions]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the existing live-read behavior on every cache failure path while using the broker only to add authenticated conditional revalidation and confirmed 304 replay. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug report; the PR supplies a controlled loopback exercise of the proposed conditional-read behavior. Is this the best way to solve the issue? Unclear pending independent source review; the stated live-304-plus-confirmation design is a conservative fit if all fallback paths retain current behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6a358d239c1e. 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
|
Summary
Add the rank-4 durable ETag response broker for cross-run GitHub REST revalidation. The quota-savings analysis basis is rank 4, “Conditional requests,” with observed repeat floors of 21.5% for item metadata, 17.6% for comments, and 19.5% for reviews. The predecessor boundaries are the GraphQL activity cursor (#1159), apply read generations (#1161), and the publisher-scoped durable cache pattern (#1163).
The queue Durable Object stores bounded JSON bodies with their ETag, SHA-256 digest, response timestamp, validation timestamp, and expiry. Runners use publisher-scoped HMAC lookup/store/confirm endpoints. Lookup never returns a body: only a live GitHub 304 followed by a matching durable ETag/digest confirmation can return cached bytes. A failed lookup or confirmation falls back to an unconditional live read, preserving final pre/post-mutation guard authority.
Key and bounds
The version-1 key schema is
[1, credential_pool, route_with_sorted_query, media_type]. Collection routes materializeper_pageandpage=1, so page 1 can never validate page 2. Credential pools arerepository_actions,target_app, andpublic_read_fallback; raw tokens are never persisted.Storage is capped at 2,048 entries and 512 KiB of UTF-8 JSON per body, with 30-day retention aligned to the existing exact-review receipt convention. Missing ETags, malformed JSON, oversized bodies, unavailable broker calls, and failed confirmations are fail-open cache skips.
Integration sites
src/clawsweeper-github-runtime.ts.dashboard/worker.ts.Telemetry
broker_lookupandconditional_responseare separate units. Outcomes distinguishcache_hit,cache_miss,cache_skip,cache_200_stored, andcache_304_served. A lookup hit is not reported as quota savings; onlycache_304_servedproves a zero-point conditional response. Existing invocation and wire-attempt rows remain unchanged.Behavior proof
Final head
bd2ef9502f5988219a475d2cba83723b0c1038b0passed Docker-backed Crabbox withprovider=local-container, leasecbx_0cdf5e2b4f54, imagenode:24-bookworm:If-None-Matchon the wire, 304, durable confirmation, byte-identical body and asserted digest;pnpm run check:dashboard-strict: pass;pnpm run check: 3,454 tests, 3,446 passed, 8 skipped, 0 failed;docs/proof/etag-read-broker/receipt.json; staticjq, commit-object cross-checks, and TruffleHog all passed.This reduces quota charges, not wire requests. The loopback GitHub and credentials are deterministic fixtures; production GitHub and production Worker state were not mutated.
OpenClaw Bay
OpenClaw Bay is unaffected. This changes internal read transport and closed telemetry dimensions only; the public observer payload remains read-only and exposes no queue, recovery, deploy, rollback, or mutation action.