Repository navigation
fix(control-ui): skip the reader bounce on operator reloads - #168007
Conversation
|
🦞👀 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 changesReturning trusted-proxy operators open chat links directly in the Control UI through the existing service worker. Example: A signed-in operator reloads /chat/main/dashboard/12345678-aaaa-4000-8000-000000000001?dashboard=expanded after visiting the updated app.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains useful on current main: it removes the operator reload detour, preserves access checks and fallbacks, and has no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe browser service worker routes chat document requests to the Gateway, whose protected session-entry owner authenticates the viewer and checks session access before serving the Control UI. flowchart TD
A[Chat link navigation] --> B{Proxy worker hint}
B -->|Present| C[Protected session entry]
C --> D{Current access allowed}
D -->|Marked success| E[Control UI document]
D -->|Denied or failed| F[Public reader]
B -->|Absent| F
F --> G[Existing probe and handoff]
Technical reviewBest possible solution: Reuse protected session entry for returning proxy operators while preserving public-reader, credential-login, offline, and native-auth recovery. Do we have a high-confidence way to reproduce the issue? Current-main source retains the public-document, access-probe, and app-handoff sequence, corroborated by the supplied browser comparison; this review ran no target code. Is this the best way to solve the issue? The shortcut uses the existing navigation and protected-entry owners, preserves current authorization and supported fallbacks, and adds no competing authentication policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 24c8911913b4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +37, Tests +150, Docs +6. Total +193 across 11 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 (3 earlier review cycles)Reviewed October 9, 2026, 10:54 PM ET / October 10, 2026, 02:54 UTC (Revision 4). |
Route returning trusted-proxy operator browsers through the protected session-entry document in their existing service worker. Preserve public readers, token/password entry, native HTTP auth, and current session authority checks.
eec73de to
63be93f
Compare
…openclaw#168007) Route returning trusted-proxy operator browsers through the protected session-entry document in their existing service worker. Preserve public readers, token/password entry, native HTTP auth, and current session authority checks.
What Problem This Solves
Fixes the public-reader interstitial and login-button flash when a signed-in operator reloads a Control UI chat deep link behind a trusted login proxy.
The campaign evidence measured a signed-in reload of a dashboard deep link: 679 ms to the public document, a 1.08 s access probe, and another roughly 0.9 s document request before the app committed at +2.77 s. This is the entry portion of the recorded 14-state, roughly 15-second startup.
Related: #166049, #166783, #167097.
User Impact
After visiting the updated app, trusted-proxy operator browsers reopen
/chat/...directly into one authenticated app document. The public-reader document and preliminary probe disappear from the successful path. The URL and fragment stay intact. Browsers without the hint and token/password deployments keep their existing handoff. The login affordance stays hidden while an unavailable reader is still checking access, then becomes available on denial or failure.No configuration option, server schema, persistent server record, or authentication policy changes. A service-worker registration is a navigation hint only; every private entry still passes the protected endpoint's current authentication and session-access checks. First visits without the worker retain the existing public-reader/probe flow.
Why This Change Was Made
Trusted-proxy app documents opt the existing service-worker registration into direct entry. The worker fetches the protected session-entry document without following redirects and accepts only a marked successful response. Denial, redirects, network failures, and unmarked proxy login pages fall back to the original public request. If that route itself issues an HTTP authentication challenge, a native protected navigation preserves the browser's auth prompt.
The public
/chatroute still never authenticates or exposes private data, and CSP remains hash-based. Token/password login shells deliberately do not carry the admission marker. No new client database or storage record is needed.Production delta: +37 lines (44 added, 7 removed), excluding tests and docs. The growth is required for the protected-response distinction and native-auth/public-reader fallbacks. The old online-navigation branch is replaced; the reader and its probe remain necessary for unhinted browsers, denied viewers, and existing credential-based entry.
Evidence
A synthetic loopback Gateway and HTTPS proxy expose
/chat/*without identity and add identity only on protected routes. Headless Chrome uses isolated browser and Gateway state. The baseline worker comes from the pre-change head, with original pending-login visibility; both cases use the same Gateway authorization and synthetic dashboard session. A 900 ms response delay is applied only to chat documents and session-entry requests to isolate this lane from unrelated asset traffic.Removing proxy identity after worker registration produces the public unavailable document, with no app and no redirect loop. These numbers measure document entry, not the remaining app layout, WebSocket, dashboard, or transcript startup work.
tbx_01m4hs7pfx54h509yynxqvsx1e, with 33.85 s test-runner wall time. The isolated checkout initially lacked dependencies;pnpm install --frozen-lockfileprepared it, then the focused SW cache/lifecycle, navigation, and session-entry tests passed. The lease is stopped.pnpm test <file> --maxWorkers=1remote wall times: navigation 3.64 s, protected entry 27.39 s, public-reader entry 5.09 s, entry-document HTTP 27.76 s. The new navigation file contains no real timers or server boots; the existing HTTP/auth files retain their compiled dependency setup.node scripts/check-changed.mjs: passed, including all 27 core/test type graphs, UI types, lint, formatting, dead exports, and repository guards. AWS leasecbx_6d7b2efce6e3, runrun_78b66adc044a7f0d9d644c2dc1872d2f; timed tests plus checks took 15m32s (sync excluded). Current-head CI below now supplies the rebased lint/type/UI/E2E proof.4ac1a8028b312c56f84686ac52dca989d6d94c48, which fixes the inherited session-PR host test failure. Verified withgit merge-base --is-ancestor 4ac1a8028b31 HEAD. The versioned-asset cache-first path from perf(control-ui): reuse versioned assets and uploaded avatars #167993 and this lane's protected navigation routing are both retained.git range-diffconfirms the lane patch is unchanged.Screenshots below contain synthetic fixture data only. The after capture shows the app shell reached directly; this change does not claim to fix its later layout/content settling.
CI disposition
Current head:
63be93f9b3b645f950a51e2613a5fc1e074d1424.CI run 38017068901 completed successfully on this exact head. Every one of its 71 jobs is terminal: 48 passed, 23 intentionally skipped, 0 failed, 0 cancelled, 0 pending. The PR check rollup is green.
The prior inherited failure from run 38001999916 is fixed by the included main commit
4ac1a8028b31. No unrelated failures occurred in the new run. No CI reruns were requested. All task-owned leases and Gateways are stopped. This PR remains open and ready; it has not been merged.