Repository navigation
fix(control-ui): restore operator chat deep links - #166783
Conversation
Route token/password operators through the existing app authentication gate when reopening chat links. Preserve anonymous public-reader isolation, HTTP identity denials, mounted gateway credential scopes, dashboard presentation, and composer drafts. Fixes the document-routing regression introduced by #166049.
|
🦞👀 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. Reviewed October 7, 2026, 7:41 PM ET / 23:41 UTC (Revision 2). ClawSweeper reviewWhat this changesRestore authenticated operators’ chat reloads and deep links through the existing login gate, preserve draft and dashboard parameters, and share browser credential-storage key constants. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still strands token/password operators on the public reader. The query-scope correction is sound, the prior compatibility blocker is resolved, and no blocking patch defect remains. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway serves chat links as either anonymous public-reader documents or the Control UI application. Browser-held credentials guide operators back into the application, where existing bootstrap and WebSocket authentication control session access. flowchart TD
A[Chat link or reload] --> B[Gateway document routing]
B --> C[Anonymous public reader]
B --> D[Application shell]
C --> E[Protected probe and browser credential hint]
E --> D
D --> F[Existing authentication and session access]
F --> G[Operator conversation]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +46, Tests +282, Docs +24. Total +352 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one application-shell owner and restore operator navigation while preserving anonymous publication checks and existing session authentication. Do we have a high-confidence way to reproduce the issue? Yes: current-main source shows a token/password browser's unauthenticated HTTP probe returning 401 while the reader only forwards on 204; the captured real-browser before/after trace matches that mechanism. This review did not execute the flow. Is this the best way to solve the issue? Yes: the patch reuses the existing application login gate, treats stored credentials only as navigation hints, and preserves authentication and publication ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eb7a4b157452. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
The requested existing-state compatibility proof for reviewed head
The review's own “Existing-state compatibility” evidence reaches the same conclusion: “No stored-data contract changes.” The serialized-state classifier therefore does not identify a data-model change requiring a migration. No schema, persistence format, or upgrade behavior is added by this patch; no migration change is needed. |
Preserve existing Gateway query-scoped paired-device credentials as a navigation-only hint. Keep other mounts and schemes isolated, and leave all authentication and storage writers unchanged.
|
@clawsweeper re-review Please review the current head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* fix(control-ui): restore operator chat deep links Route token/password operators through the existing app authentication gate when reopening chat links. Preserve anonymous public-reader isolation, HTTP identity denials, mounted gateway credential scopes, dashboard presentation, and composer drafts. Fixes the document-routing regression introduced by openclaw#166049. * fix(control-ui): recognize query-scoped device handoffs Preserve existing Gateway query-scoped paired-device credentials as a navigation-only hint. Keep other mounts and schemes isolated, and leave all authentication and storage writers unchanged.
What Problem This Solves
Since #166049 routed every
/chat/...document through the anonymous public reader, a logged-in operator using token or password auth can no longer reload a chat. Reloading, opening the same link in a new tab, or following a bookmark returns HTTP 404 with "Conversation unavailable. This conversation is not publicly available. Log in…", and the operator has to click Log in to get the app back. In-app navigation still works, which hides the regression until the first reload.Reproduced on main 9aa7455 (dev Gateway,
gateway.auth.mode=token, loopback HTTP, headless Chromium): after/#token=…login,GET /chat/main/<slug>is served by the reader, and the reader's handoff probeGET /__openclaw__/session-entry?path=…&probe=1returns 401. The browser holds its credential in local/session storage (openclaw.device.auth.v1:<scope>/openclaw.control.token.v1:<scope>), so an HTTP request can never prove it, and the reader never forwards.User Impact
?draft=and?dashboard=expandedparameters survive the handoff instead of 404ing.Why This Change Was Made
The reader's only forward path was the HTTP probe. That is correct for trusted-proxy/external-login deployments, where the browser carries cookies, but token/password credentials live in the browser. After a 401, and only in token/password mode, the reader now checks whether this browser already holds a Control UI credential for this Gateway scope, and if so it navigates to the existing session-entry link. The credential is never read into a request or transmitted. session-entry already serves the app shell to unauthenticated token/password requests by design, and the shell grants no data; bootstrap and WebSocket auth keep all authority. A stale credential therefore lands on the normal login gate. Because the forward does not depend on whether the thread exists, there is no existence oracle.
The storage-key prefixes the reader needs now have one owner (
src/shared/control-ui-storage.ts), which the UI settings and device-auth stores import instead of duplicating literals. The script's CSP hash is still derived from the exact script bytes.serveAppmoved up one level incontrol-ui-session-routes.tsso the public chat route and session-entry share the same app-shell owner. The remaining initial 404 on secure ingress is intentional: removing it would need server-visible authentication state, which token mode does not have.Evidence
Live on original reviewed head
a6884e2ca7d2d8091f63dc7426a03e561a6f5d37(dev Gateway built from that head, fresh state, real OpenAI provider, headless Chromium):Tests (TMPDIR isolated):
Focused:
control-ui-public-chat.http.test.ts10.8 s,control-ui-public-session-entry.test.ts3.1 s,control-ui-session-entry.test.ts7.6 s (--maxWorkers=1). Core/UI types, scoped lint, format, docs links, and the import-cycle check (0) pass. Autoreview was clean through P2.Production +85/-39, tests +303/-21, docs +24 (
docs/web/urls.md,docs/web/control-ui/security-model.md).Maintainer correction and compatibility proof
Independent review found that paired-device storage scopes retain a Gateway URL query string. The reader now recognizes existing device records for the same scheme, host, and mount with an optional query suffix; this remains only a navigation hint. It does not send credentials, write storage, or change authentication. The new positive regression fails on the original head; a neighboring-mount query case continues to stay on the reader.
After the correction, reader-script / public-chat HTTP / session-entry tests pass: 46 tests in 3 files (45.09 s Vitest, 48.12 s wrapper). Isolated
pnpm test src/gateway/control-ui-public-session-entry.test.ts --maxWorkers=1: 18 passed, 3.07 s Vitest, 4.58 s wrapper. The native changed checks pass, including core and test types, scoped lint/format, schema guards, and zero runtime import cycles. Full-candidate independent review accepted the corrected working tree; its index-only observation was resolved by staging that exact candidate. The earlier full CI success is run 37697630628, attempt 1, for the original head; the correction requires its own exact-head CI. The original live Gateway proof above is reused for unchanged routing; the query-scope correction has direct reader-script boundary proof.The storage key bytes, version-1 record format, writers, scope normalizers, and legacy migration remain unchanged. The reader adds only read-only presence checks. The completed ClawSweeper review itself confirms no stored-data contract changes; the detailed compatibility response is here. No migration is needed.