Repository navigation
fix(ui): skip cache policy reads for private requests - #196952
Conversation
Restrict service-worker cache policy reads to unauthenticated immutable or versioned public assets. Keep private requests in the existing foreground delivery and owning-client recovery flow. Exercise the actual request getter and no-store behavior across complete cache generations. Grant exactly 47 net regression-test lines without changing the shared ceiling.
|
🦞👀 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 service worker checks public-asset membership and Authorization before reading browser cache policy. Example: GET /openclaw/avatar/main?mediaTicket=synthetic-ticket
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR makes a focused eligibility-ordering correction that current main still lacks, with no introduced correctness or security finding. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI service worker receives scoped browser requests, serves eligible public assets from existing caches, and sends private requests through network delivery and requesting-client recovery. flowchart TD
A[Browser request] --> B[Scope and request checks]
B --> C[Public asset and authorization eligibility]
C --> D[Cache policy]
D --> E[Existing asset caches]
C --> F[Network delivery]
E --> F
F --> G[Response and requesting client recovery]
Technical reviewBest possible solution: Keep eligibility ordering in the existing fetch handler while preserving public-cache admission and private-request recovery. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically reads Request.cache for private requests; the underlying native request/load-flag failure remains unqualified, and no target code was executed during this review. Is this the best way to solve the issue? The patch is the smallest complete ordering correction: it reuses existing asset eligibility and delivery owners without adding state, fallback paths, or production test seams. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4947e40db109. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -1, Tests +47, Other +1. Total +47 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (1 earlier review cycle)
Reviewed November 11, 2026, 8:01 PM ET / November 12, 2026, 01:01 UTC (Revision 2). |
Baseline-Refresh: 2888f8056cebfdde59742e22c8948b91a403458b
|
@clawsweeper re-review Please review current head |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Restrict service-worker cache policy reads to unauthenticated immutable or versioned public assets. Keep private requests in the existing foreground delivery and owning-client recovery flow. Exercise the actual request getter and no-store behavior across complete cache generations. Grant exactly 47 net regression-test lines without changing the shared ceiling.
What Problem This Solves
The service worker reads browser cache policy for private HTTP requests before checking whether their URL and authentication make them eligible for asset caching.
User Impact
Private media, plugin, avatar, and RPC reads keep normal foreground delivery and sign-in recovery without consulting public-asset cache policy. Public assets retain the existing authentication, no-store, version, and response-policy rules. No migration or operator action is required.
Why This Change Was Made
Check immutable/versioned asset membership and Authorization before accessing
Request.cache, then reuse that eligibility for cache lookup. Private requests still pass through the existing network/recovery owner. Production code decreases by one line; no cache, fallback, or request lifecycle is added.The regression fixture now forwards the actual fetch-event request getter. Tests assert zero cache-policy reads for private/unversioned/authenticated requests, and network-only no-store delivery across three complete cache generations. The separate test allocation grants exactly 47 net regression-test lines; the shared ceiling is unchanged.
Evidence
4ee7010b2bbf72cfe23ab50564d08cb8ddb97929integrates frozen official baseline5bffc70821b5ccfc88c2969e197218c00f00bb2c. Its four SW/test/allocation files are byte-identical to the incoming reviewed patch; the exact patch against that baseline has SHA-256bcdcab7fff7a7c036233852fc660e22cf25895d3fd97745c2786f18cdde0f046. Production delta: −1 line; tests: +47 net lines with a matching isolated allocation.e9fc001435486e677dea64d6d02e555e94665301onmain; the source checkout is separately verified. This manual source run does not qualify native PR-associated CI admission.dca2f33a802c7fc1b8d24ad329368482f3fcba34with ordered parentsa38ea90f53272bd6e64ea7230d6556523d05c7aaand the candidate. All 60 jobs finished; security passed. UI 2/3 failed one Bun activity assertion; its CI gate remains failed. The changed cache module passed all 52 cases on that same Bun invocation. Native build-artifacts was skipped; the separately verified candidate build above supplies build proof.chat-pane-run-activity.test.ts:101waits for.chat-thread-inner, also emitted by a cold-row loading placeholder, then immediately expects an activity descendant. The actual baseline/tested-merge chat owner, helpers, configuration and dependency inputs are identical; SW tests use a private Node VM and a distinct fork environment from jsdom activity tests. This is concrete scoped source attribution under the native unrelated-CI exception; the original CI timing remains unknown, and no baseline runtime failure reproduction is claimed. Tests remain fail with exact-head/attempt attribution; security, reviews and protected native merge admission remain required.The native crash investigation identified a cache-getter boundary, but the exact request/load-flag producer remains unqualified. This change does not establish a browser-wide crash or memory-leak fix.