Skip to content

fix(control-ui): skip the reader bounce on operator reloads - #168007

Merged
steipete merged 1 commit into
mainfrom
steipete/coldload-entry-bounce
Oct 10, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/coldload-entry-bounce

Conversation

@steipete

@steipete steipete commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 /chat route 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.

Measurement (3 samples each) Before After
App document commit, median 2,758 ms 926 ms
Individual commit samples 2,768 / 2,758 / 2,750 ms 926 / 927 / 922 ms
Documents loaded 2 1
Serial entry HTTP requests 3 1
Public-reader request / probe on successful entry both neither

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.

  • Regression demonstrated against the original worker, then passing with the change. Coverage includes mounted paths, ordinary chat routes, missing hints, denied/redirected/unmarked responses, native HTTP-auth handoff, token/password behavior, and pending-login visibility.
  • Current-head remote validation: 133 tests across 7 files passed on Blacksmith Testbox tbx_01m4hs7pfx54h509yynxqvsx1e, with 33.85 s test-runner wall time. The isolated checkout initially lacked dependencies; pnpm install --frozen-lockfile prepared it, then the focused SW cache/lifecycle, navigation, and session-entry tests passed. The lease is stopped.
  • Authoring-time pnpm test <file> --maxWorkers=1 remote 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.
  • Initial candidate node scripts/check-changed.mjs: passed, including all 27 core/test type graphs, UI types, lint, formatting, dead exports, and repository guards. AWS lease cbx_6d7b2efce6e3, run run_78b66adc044a7f0d9d644c2dc1872d2f; timed tests plus checks took 15m32s (sync excluded). Current-head CI below now supplies the rebased lint/type/UI/E2E proof.
  • Rebased onto 4ac1a8028b312c56f84686ac52dca989d6d94c48, which fixes the inherited session-PR host test failure. Verified with git 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-diff confirms the lane patch is unchanged.
  • Gateway/UI build and synthetic browser entry proof passed on the original candidate. Independent detached review was clean at P0–P2; the rebase introduces no new lane changes.

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.

Before: synthetic operator reload paints the public-reader interstitial

After: the same synthetic session opens directly in the app

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.

Job class Result
Lint 6 passed
Types 7 passed
UI unit tests 3 passed
UI E2E All 9 selected shards passed; 1 separate job skipped by scope
Node All 9 selected jobs passed; 1 separate job skipped by scope
Other setup, guards, security, and gate jobs 14 passed; 21 skipped by scope

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.

@clawsweeper

clawsweeper Bot commented Oct 9, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M labels Oct 9, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Returning 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.

  • Before: Three serial entry requests load two documents and briefly display the public reader with a login button.
  • After: One protected app document opens directly while preserving the URL and fragment.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, useful repair with shipped browser-entry evidence, preserved authorization and recovery contracts, no stored-data format changes, successful exact-head CI, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded isolated Chrome runs exercise the changed worker through an actual Gateway and synthetic HTTPS identity proxy, replacing three entry requests with one protected document; removing identity after registration returns the reader without app access or a loop, and inspected before/after images corroborate presentation.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Signed-in proxy operators briefly see a public-reader loading screen and login button when reloading their conversation.
Reason: Removing misleading presentation and unnecessary serial entry requests provides clear user value with a focused change.

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
Reviewed head: 63be93f9b3b645f950a51e2613a5fc1e074d1424

Before merge

None.

Findings

None.

Agent review details

How this fits together

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

Technical review

Best 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

  • Online worker navigation changes intended behavior with a stated reason (388ba32: Deliver HTTP-auth challenges through native navigation so browsers can display their credential prompt.)
  • Offline navigation keeps the original intent (9764de1: Allow previously signed-in users to reopen prepared local work when the browser explicitly reports offline.)
  • Pending reader presentation keeps the original intent (47cbd73: Show neutral loading until access resolves, preserving confirmed denial, connection recovery, and no-JavaScript access.)
  • Protected session entry keeps the original intent (8787ee0: Share canonical conversation links between anonymous readers and authorized operators without weakening session permissions.)
  • Credential-based deep links keeps the original intent (a1ca0cd: Restore automatic operator entry while preserving anonymous-reader isolation and browser-owned credentials.)
  • Worker registration and activation keeps the original intent (1f941a0: Move open Control UI pages onto the activated build instead of leaving stale bundles running.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduction diff adds protected navigation selection and response marking within existing owners; unrelated base movement is excluded. (ui/public/sw.js:303, 63be93f9b3b6)
  • Current main still takes the detour: Fetched main retains native online navigation and the public-reader probe; comparison with the introduction base shows no change to the central production owners. (ui/public/sw.js:315, 24c8911913b4)
  • Protected admission and final authority: Session entry authenticates and resolves exact session access before marking success; the HTML sender rechecks current client and session authority after asynchronous preparation and before returning bytes. (src/gateway/control-ui-session-entry.ts:107, 63be93f9b3b6)
  • Browser behavior evidence: The complete supplied body, sourceRevision ee5ff0be2f93502b6068ee6bb0a99787f264c5029df6f43c6a1c0688e61b37c9, records isolated Chrome runs through a real Gateway and synthetic HTTPS identity proxy: direct entry replaces the reader/probe sequence, and removing identity after registration returns the unavailable reader without app access or a loop. (63be93f9b3b6)
  • Inspected before and after screenshots: Downloaded proof-image-1.png shows the reader loading screen and login button; proof-image-2.png shows the synthetic dashboard app shell. These corroborate presentation; the recorded browser observations establish routing behavior. (63be93f9b3b6)
  • Exact-head CI and merge state: REST reads confirm CI run 38017068901 succeeded on the reviewed head, paginated check runs have no failures or unfinished checks, commit statuses are successful, and GitHub reports the open PR cleanly mergeable. (63be93f9b3b6)

Likely related people:

  • Peter Steinberger: Raw commit a1ca0cd adds src/gateway/control-ui-public-session-render.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a1ca0cd615f4; files: src/gateway/control-ui-public-session-render.ts)
  • RoboClaw: Raw commit 47cbd73 adds src/gateway/control-ui-public-session-render.ts:38 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 47cbd73e6f0e; files: src/gateway/control-ui-public-session-render.ts)
  • Nayrosk: Raw commit 388ba32 adds ui/public/sw.js:56 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 388ba3218bf2; files: ui/public/sw.js)

PR surface

Source +37, Tests +150, Docs +6. Total +193 across 11 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 6 44 7 +37
Tests 4 151 1 +150
Docs 1 8 2 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 203 10 +193

Review metrics

Metric Value Why it matters
Production versus tests Production +44/-7; tests +151/-1 Production growth provides marked document selection and fallback within existing owners; tests cover navigation routing and access-result presentation.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Removes a visible reload interruption and redundant requests in trusted-proxy deployments while the existing entry flow remains usable.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-09T23:02:25.781Z sha eec73de :: needs maintainer review before merge. :: none
  • reviewed 2026-10-09T23:35:46.941Z sha eec73de :: needs maintainer review before merge. :: none
  • reviewed 2026-10-10T02:34:18.181Z sha 63be93f :: needs maintainer review before merge. :: none

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.
@steipete
steipete force-pushed the steipete/coldload-entry-bounce branch from eec73de to 63be93f Compare October 10, 2026 02:28
@steipete
steipete merged commit 430f975 into main Oct 10, 2026
128 checks passed
@steipete
steipete deleted the steipete/coldload-entry-bounce branch October 10, 2026 02:55
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 10, 2026
…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.
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 docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M 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