Skip to content

fix(ui): skip cache policy reads for private requests - #196952

Merged
vincentkoc merged 2 commits into
mainfrom
fix-sw-private-cache-eligibility
Nov 12, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix-sw-private-cache-eligibility

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

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

  • Signed candidate 4ee7010b2bbf72cfe23ab50564d08cb8ddb97929 integrates frozen official baseline 5bffc70821b5ccfc88c2969e197218c00f00bb2c. Its four SW/test/allocation files are byte-identical to the incoming reviewed patch; the exact patch against that baseline has SHA-256 bcdcab7fff7a7c036233852fc660e22cf25895d3fd97745c2786f18cdde0f046. Production delta: −1 line; tests: +47 net lines with a matching isolated allocation.
  • Current draft source CI, attempt 3 actually checked out that candidate and compared the frozen baseline. Workflow metadata identifies e9fc001435486e677dea64d6d02e555e94665301 on main; the source checkout is separately verified. This manual source run does not qualify native PR-associated CI admission.
  • Cache 52, history 3 and lifecycle 32 passed on each Linux x64 Node 24.22.1 and Bun 1.4.4: 174 passed, zero failed/skipped/pending, verified from correlated runtime inventory and actual module receipts.
  • All four unchanged browser sign-in recovery cases passed: automatic/interactive renewal with service workers allowed/blocked. This is the existing HTTP/Playwright harness, without a live Team/Firefox recovery claim.
  • Canonical paired UI build/performance passed: Chat JS 1,301,068 B gzip (cap 1,301,131), New JS 803,216 (803,364), startup JS 91,838 (92,137), CSS 326,207 (326,575). Every gzip delta is +0 against the frozen base; no headroom gain is claimed.
  • Current build passed, including dist, generated assets/schema, CLI smokes, native-host checks and built-artifact checks. Declared frozen-target skips remain skips. Current lint, production/test types, guards and UI locale parity jobs also passed.
  • Local autoreview reviewed the exact committed frozen-base→candidate range at P0–P2 with full SW/cache/history/lifecycle/auth source: scoped-clean, no findings. Runtime proof was supplied evidence, not rerun by the reviewer.
  • Fresh exact-candidate ClawSweeper review completed with zero findings, no before-merge actions and no remaining Rank-up moves.
  • Actual PR CI, attempt 1 tested merge dca2f33a802c7fc1b8d24ad329368482f3fcba34 with ordered parents a38ea90f53272bd6e64ea7230d6556523d05c7aa and 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.
  • Primary and independent inspection attribute that failure to unchanged baseline transcript-test readiness: chat-pane-run-activity.test.ts:101 waits 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.
  • Named follow-up: test-transcript readiness — await admitted activity content in the activity test. Keep that repair separate from this SW change. The completed manual source-proof run was cancelled after its required proof jobs; its aggregate is not green CI.

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.

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.
@vincentkoc vincentkoc self-assigned this Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The service worker checks public-asset membership and Authorization before reading browser cache policy.

Example: GET /openclaw/avatar/main?mediaTicket=synthetic-ticket

  • Before: The service worker reads Request.cache before determining that the request cannot use its asset cache.
  • After: The request reaches the existing network and recovery flow without the service worker reading Request.cache.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-correct, with meaningful harness coverage; the underlying native failure remains outside the demonstrated scope.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this MEMBER-authored PR; its changed getter ordering is covered by the production-source VM harness, while linked browser-auth coverage exercises existing recovery behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Private Control UI requests encounter an unnecessary browser cache-policy getter before reaching normal delivery and recovery.
Reason: The maintainer-authored direction is approved, and the narrow change removes unnecessary browser-policy access while preserving existing request outcomes.

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
Reviewed head: 4ee7010b2bbf72cfe23ab50564d08cb8ddb97929

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied scenarios do not demonstrate the original native getter failure or a red-on-base browser reproduction; the PR expressly disclaims a browser-wide crash fix.
Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Private-request exclusion and early cache-policy read keeps the original intent (9764de1: Offline recovery excluded arbitrary private HTTP reads and credentials from public asset caching.)
  • Prior-version public-asset reuse keeps the original intent (ca009ba: Older documents need exact cached fonts/themes from complete previous generations without admitting new stale-version writes.)
  • Fetch fixture request construction keeps the original intent (f461e03: The shared fixture supports foreground request and optional offline-download lifecycle coverage; lazy getter forwarding makes the ordering regression observable.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d587206 adds ui/public/sw.js:512 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d5872069d833; files: ui/public/sw.js)
  • RoboClaw: Raw commit 9764de1 adds ui/public/sw.js:343 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9764de174749; files: ui/public/sw.js)

PR surface

Source -1, Tests +47, Other +1. Total +47 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 8 9 -1
Tests 2 50 3 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 4 59 12 +47

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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:

  • P2: This is a bounded service-worker eligibility correction; the evidence does not establish a browser-wide crash or memory-leak fix.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-11T01:24:44.392Z sha 37aa199 :: needs maintainer review before merge. :: none

Reviewed November 11, 2026, 8:01 PM ET / November 12, 2026, 01:01 UTC (Revision 2).

Baseline-Refresh: 2888f8056cebfdde59742e22c8948b91a403458b
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 11, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 12, 2026 00:55
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review current head 4ee7010b2bbf72cfe23ab50564d08cb8ddb97929. The PR description now links exact-source cache/history/lifecycle proof on Node and Bun (174 passed), unchanged browser-auth recovery (4 passed), paired asset gzip deltas (+0), build and completed local autoreview. Normal PR-associated CI is now running; native CI/security and landing qualification remain pending. Please check asset/auth eligibility before Request.cache, private request delivery/recovery, and public no-store/current/prior cache symmetry. No Firefox/Team OOM recovery is claimed.

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 12, 2026
@vincentkoc
vincentkoc merged commit bc56f78 into main Nov 12, 2026
191 of 194 checks passed
@vincentkoc
vincentkoc deleted the fix-sw-private-cache-eligibility branch November 12, 2026 01:24
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 12, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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