Repository navigation
improve(control-ui): public conversation pages match the chat design and add copy buttons - #168156
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. |
…and add copy buttons Public share pages now carry the Control UI's design tokens and chat element styles (tinted user bubbles, flat assistant prose with the lobster avatar in the gutter, grouped turns, matching code/quote/table treatment), follow the system light/dark setting, and close with a short OpenClaw introduction and install line. Both public routes share one Content Security Policy that adds font-src and style-src 'self' so the page can link the Gateway-hosted Instrument Sans stylesheet, which is already a public root asset. The fixed entry script is emitted on every public page and injects a copy control into code blocks and the install line; its login probe and live refresh stay gated as before. The renderer takes the Control UI mount as assetBasePath.
|
Codex review: needs maintainer review before merge. What this changesThis PR gives public conversations the Control UI’s chat styling, self-hosted typeface, code-copy buttons, and an OpenClaw introduction. Example: A shared conversation contains
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it provides useful public-reader improvements, both earlier findings are resolved, and no actionable defect remains. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway public routes authorize publication, filter transcript content, and render standalone HTML whose browser script handles login handoff, refresh, and copying. flowchart LR
A[Public conversation URL] --> B[Gateway public route]
B --> C[Publication checks]
C --> D[Filtered transcript]
D --> E[Shared HTML renderer]
E --> F[Browser reader]
F --> G[Clipboard]
Technical reviewBest possible solution: Retain the shared renderer and CSP with the completed caller and refresh-fixture fixes. Do we have a high-confidence way to reproduce the issue? The supplied before screenshots establish the presentation problem; source inspection confirms the earlier integration defects are repaired without running target code. Is this the best way to solve the issue? The existing shared renderer is the appropriate owner, and one CSP for both routes prevents policy drift while preserving publication checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2d6f7a3052a0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +90, Tests +49, Docs +2. Total +141 across 10 files. Added test files: 0. View PR surface stats
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 (2 earlier review cycles)
Reviewed October 10, 2026, 12:18 AM ET / 04:18 UTC (Revision 3). |
492709e to
60d7e16
Compare
|
Merged via squash.
|
#168156 named an HTML constant OPENCLAW_PITCH, which the production OPENCLAW_* name ratchet counts as an environment variable (456 > 455). Rename it so the budget reflects real environment names again.
#168156 removed the last production importer of PUBLIC_SESSION_ENTRY_SCRIPT, so knip --production flags it as an unused export. The refresh test now extracts the exact inline script from renderPublicSessionDocument output (the same bytes the CSP hash covers) instead of importing the constant.
…and add copy buttons (openclaw#168156) * improve(control-ui): public conversation pages match the chat design and add copy buttons Public share pages now carry the Control UI's design tokens and chat element styles (tinted user bubbles, flat assistant prose with the lobster avatar in the gutter, grouped turns, matching code/quote/table treatment), follow the system light/dark setting, and close with a short OpenClaw introduction and install line. Both public routes share one Content Security Policy that adds font-src and style-src 'self' so the page can link the Gateway-hosted Instrument Sans stylesheet, which is already a public root asset. The fixed entry script is emitted on every public page and injects a copy control into code blocks and the install line; its login probe and live refresh stay gated as before. The renderer takes the Control UI mount as assetBasePath. * test(gateway): pass the Control UI mount to public session renderer callers * test(gateway): give the public reader refresh stub the enhancer's DOM surface
openclaw#168156 named an HTML constant OPENCLAW_PITCH, which the production OPENCLAW_* name ratchet counts as an environment variable (456 > 455). Rename it so the budget reflects real environment names again.
openclaw#168156 removed the last production importer of PUBLIC_SESSION_ENTRY_SCRIPT, so knip --production flags it as an unused export. The refresh test now extracts the exact inline script from renderPublicSessionDocument output (the same bytes the CSP hash covers) instead of importing the constant.
What Problem This Solves
Publicly shared conversations rendered as a generic dark page that looked nothing like the Control UI: the page's Content Security Policy blocked the Gateway-hosted typeface so it fell back to the system font, there was no way to copy a code block, and a visitor who had never seen OpenClaw learned nothing about it.
User Impact
User impact: public readers now see a shared conversation in the Control UI's chat layout and typeface, following the system light/dark setting; every code block and the install command have a one-click copy control; and the page closes with a short OpenClaw introduction and install line. Login handoff, live refresh, pagination, the unavailable page, and the content filters (no tool output, reasoning, files, images, hidden messages, or credential patterns) are unchanged. The bearer
/share/sessionroute now serves the same small hashed page script as the canonical thread URL (it previously shipped no script).Why This Change Was Made
The public page is server-rendered HTML with a strict CSP, so it cannot load the Control UI bundle; instead it now carries the Control UI's own design tokens and chat element styles (
ui/src/styles/base.css,ui/src/styles/chat/text.css): tinted right-aligned user bubbles, flat assistant prose with the lobster avatar in the gutter, grouped consecutive turns, and the same code, quote, and table treatment. The closing section reuses the README's wording and links.Both public routes now share one
PUBLIC_SESSION_CONTENT_SECURITY_POLICY. It addsfont-src 'self'andstyle-src 'self'so the page can link<mount>/fonts/instrument-sans.css, which the Gateway already serves as a public root asset for the login page; nothing third-party is allowed. The fixed entry script is emitted on every page (its login probe and live refresh stay gated as before) and now also injects the copy control into code blocks as progressive enhancement, using the Clipboard API with a selection fallback. Fenced code is wrapped in adiv.codeso the control stays pinned while a wide block scrolls.renderPublicSessionDocumenttakes the Control UI mount asassetBasePath.Release-note context: public conversation pages match the Control UI, load its typeface, offer copy buttons on code, and end with an OpenClaw introduction.
Evidence
Synthetic transcript rendered by the real renderer and served under the real policy.
Before (dark):
After (dark):
After (light):
After (phone, dark):
Code block with the copy control on hover:
fonts/instrument-sans.cssandinstrument-sans-latin.woff2load with200,document.fonts.check('16px "Instrument Sans"')istrue, and the body resolves to Instrument Sans. A real click on the install copy control sets the copied state and shows the check icon; no CSP violations in the console.pnpm test src/gateway/control-ui-public-session-render.test.ts src/gateway/control-ui-public-session.http.test.ts src/gateway/control-ui-public-chat.http.test.ts --maxWorkers=1: 3 files, 38 tests passed (about 95 s wall, dominated by the gateway compile step). New assertions cover the font link, the shared policy carrying the page's only inline script hash on both routes, grouped turns, and the closing section's presence on public pages and absence on the unavailable page.pnpm tsgoclean;oxfmtapplied.docs/web/urls.md(Public session transcripts).mainafter fix(control-ui): skip the reader bounce on operator reloads #168007 (public-reader login handoff); the resolution carries that change's hide-Log-in-while-probing rule into the new stylesheet, script, andnoscriptblock.control-ui-public-session-entry.test.ts,chat-display-projection.cold-imports.test.ts) pass the newassetBasePath; six suites (those two, the three public-page suites, andcontrol-ui-session-entry-document.http.test.ts) pass with 71 tests, andpnpm tsgois clean.control-ui-public-session-refresh.test.ts), which runs the entry script against a hand-built document stub, now stubsquerySelectorAllfor the copy-control enhancer; it passes alongside the renderer suite. The first CI run on the rebased head (38021922035) failed only there.