Repository navigation
feat(ui): save appearance preferences per user profile - #130340
Conversation
When a Control UI connection is bound to an authenticated user profile (trusted-proxy, Tailscale, GitHub identity), theme, theme mode, and accent become per-profile: stored in the existing user_preferences KV store via users.prefs.set, overriding gateway-wide ui.prefs, with live cross-device updates over a new additive users.prefs.changed event scoped to the same merged profile. Restore default deletes only the profile key and falls back to the gateway-wide value. talk.config projects the caller's profile accent for native clients. Profile-less connections (token/password/none auth) keep the existing gateway-config behavior byte-identically. Release-note context: on multi-person gateways appearance choices are now personal and follow you across devices; an admin restyling their own UI no longer reskins the whole team.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
iOS and Android resolve the profile accent through talk.config on connect and config refresh; live per-profile appearance push on natives is a named follow-up.
|
Codex review: found issues before merge. Reviewed August 26, 2026, 7:25 PM ET / 23:25 UTC. ClawSweeper reviewWhat this changesThe PR makes Control UI theme, mode, and accent profile-specific for authenticated users, with gateway-wide preferences as the fallback for unprofiled connections. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open: three identity and native-client gaps mean profile appearance can persist into unprofiled access, lose a reset during loading, or fail to reach native branding. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI receives a gateway connection snapshot, combines gateway configuration with profile preferences, and applies the resulting appearance in the browser. Gateway methods persist profile preferences and expose profile-aware accent data to connected clients. flowchart LR
A[Gateway connection] --> B[Connection identity]
B --> C[Profile preferences]
D[Gateway UI configuration] --> E[Appearance reconciliation]
C --> E
E --> F[Control UI appearance]
E --> G[Native client appearance]
F --> H[Preference update]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +501, Tests +740, Docs +6, Other +21. Total +1268 across 36 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the current connection identity, including no identity, as the sole source for reconciliation and reset scope, then wire profile-aware accent data into native branding refreshes. Do we have a high-confidence way to reproduce the issue? Yes—source establishes deterministic profile-to-none, loading-time reset, and native refresh paths; this read-only review did not execute them. Is this the best way to solve the issue? Yes—the existing architecture can address the defects by making active identity authoritative and adding a real native appearance consumer. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 25a16dd96c42. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
…pearance Addresses the three ClawSweeper review findings: - resetValue for profile-bound appearance keys is the deletion fallback (gateway value), so an explicit product-default selection persists as a profile write instead of being misclassified as a reset. - An identity switch between two known scopes forces a full appearance reconcile and clears appearance keys the returning identity never set, so a shared browser cannot keep the previous profile's look (boot keeps the last-seen shortcut). - talk.config joins the profile-dependent dispatch gate so a pending GitHub identity sync completes before the profile accent is projected; token clients pass through untouched.
|
All three review findings are fixed on this head; each was verified against the running code before the change. [P1] Persist the product-default choice for profile users — root cause was [P1] Reapply a profile when the active identity changes — the per-scope last-seen state short-circuited both the whole-object shortcut and the per-key delta in [P2] Do not project gateway accent while GitHub identity is pending — Exact-head CI is green on this head; the earlier live multi-identity proof (screenshots/video above) covers the unchanged happy paths. |
Custom palettes are browser-local by contract, so a profile must never carry theme=custom to a browser that cannot render it. The wire contract drops custom from the storable theme values (readers self-heal any stored value), a profile-bound custom selection stays retained browser-local (including the offline-queued path), and the exhaustive theme test now encodes the exception.
|
The custom-theme finding is fixed on head d364920, aligned with the existing documented contract that imported palettes live only in the browser that imported them:
|
|
Merged via squash.
|
* origin/main: (26 commits) fix(plugins): preserve registry epoch on activation rollback (#129232) refactor(plugins): make discovery invocation-owned (#130486) feat(ui): save appearance preferences per user profile (#130340) fix: Buzz bots recover relay stalls and reject revoked senders (#130467) fix(code-mode): serialize catalog handles nested in final values (#130276) fix(webchat): CLI skill and harness-injected turns render as operator-sent messages (#130427) fix(agents): read the published model catalog owner from session_status (#130277) fix(channels): preserve long presentation text (#130368) fix(agents): route CLI bootstrap truncation notice into the system prompt (#130325) refactor(plugins): unify setup registration and artifact selection (#130474) fix(memory): prevent forgotten session content from returning (#130451) refactor(outbound): consolidate transport completion (#130460) fix(workers): protect in-flight workspace manifests from concurrent retention (#130449) fix(portals): keep worker previews reachable and owned by the active environment (#130434) fix(config): keep core channels keys in the generated config schema (#120736) chore(deps): refresh dependencies after seven-day cooldown (#130296) fix(agents): remind exec models to quote shell metacharacters (#125485) fix(auth): honor shared-store ownership in temp-state exec and agent deletion (#130437) fix(openshell): preserve file writes during concurrent mirror commands (#130447) fix(workers): report full nodes as at capacity, not offline (#130445) ...
…droid (#130598) * feat(apps): resolve the per-profile accent live on iOS, macOS, and Android Named follow-up from #130340: native apps now fetch the caller's own profile accent (users.prefs.get, strict #rrggbb normalization) and prefer it over the gateway accent, refetching on users.prefs.changed — the gateway targets that event at the caller's own profile, so clients need no identity logic. macOS stores it separately from the seam color so settings-pane config refreshes cannot clobber it, and fetches bypass ControlChannel.request to avoid degrading the channel on older gateways. Profile-less and token connections are unchanged. Removes the ios/android users.prefs.changed allowlist entries now that handlers exist. * chore(macos): satisfy swiftformat explicit-self on profileAccentHex
* feat(ui): save appearance preferences per user profile When a Control UI connection is bound to an authenticated user profile (trusted-proxy, Tailscale, GitHub identity), theme, theme mode, and accent become per-profile: stored in the existing user_preferences KV store via users.prefs.set, overriding gateway-wide ui.prefs, with live cross-device updates over a new additive users.prefs.changed event scoped to the same merged profile. Restore default deletes only the profile key and falls back to the gateway-wide value. talk.config projects the caller's profile accent for native clients. Profile-less connections (token/password/none auth) keep the existing gateway-config behavior byte-identically. Release-note context: on multi-person gateways appearance choices are now personal and follow you across devices; an admin restyling their own UI no longer reskins the whole team. * chore(protocol): allowlist users.prefs.changed for mobile clients iOS and Android resolve the profile accent through talk.config on connect and config refresh; live per-profile appearance push on natives is a named follow-up. * chore(protocol): regenerate Swift/Kotlin models for users.prefs.changed * fix(ui): honor explicit defaults and identity switches for profile appearance Addresses the three ClawSweeper review findings: - resetValue for profile-bound appearance keys is the deletion fallback (gateway value), so an explicit product-default selection persists as a profile write instead of being misclassified as a reset. - An identity switch between two known scopes forces a full appearance reconcile and clears appearance keys the returning identity never set, so a shared browser cannot keep the previous profile's look (boot keeps the last-seen shortcut). - talk.config joins the profile-dependent dispatch gate so a pending GitHub identity sync completes before the profile accent is projected; token clients pass through untouched. * chore(ui): satisfy assertion-safety ratchet and docs formatting * refactor(ui): extract server-prefs storage primitives server-prefs.ts crossed the 700-line cap after the review fixes; the stateless localStorage persistence primitives move to server-prefs-storage.ts (no behavior change). Shrink-prunes the assertion-safety baseline for the moved casts. * fix(ui): keep imported custom themes out of profile storage Custom palettes are browser-local by contract, so a profile must never carry theme=custom to a browser that cannot render it. The wire contract drops custom from the storable theme values (readers self-heal any stored value), a profile-bound custom selection stays retained browser-local (including the offline-queued path), and the exhaustive theme test now encodes the exception.
…droid (openclaw#130598) * feat(apps): resolve the per-profile accent live on iOS, macOS, and Android Named follow-up from openclaw#130340: native apps now fetch the caller's own profile accent (users.prefs.get, strict #rrggbb normalization) and prefer it over the gateway accent, refetching on users.prefs.changed — the gateway targets that event at the caller's own profile, so clients need no identity logic. macOS stores it separately from the seam color so settings-pane config refreshes cannot clobber it, and fetches bypass ControlChannel.request to avoid degrading the channel on older gateways. Profile-less and token connections are unchanged. Removes the ios/android users.prefs.changed allowlist entries now that handlers exist. * chore(macos): satisfy swiftformat explicit-self on profileAccentHex
What Problem This Solves
Appearance preferences (
ui.prefs.theme,ui.prefs.themeMode,ui.prefs.accent) are gateway-global config today, and writing them requiresoperator.adminviaconfig.patch. On a multi-person gateway that shape is wrong twice over:Why This Change Was Made
When a Control UI connection is bound to an authenticated user profile (trusted-proxy, Tailscale, GitHub identity), the appearance trio becomes per-profile, stored in the existing
user_preferencesKV table in the shared state DB viausers.prefs.set(self-bound,operator.write). Precedence:Key design decisions:
user_preferencestable (lazy-additive, no schema change) with three new keys (ui.theme,ui.themeMode,ui.accent), defined once ingateway-protocolnext toGIT_COAUTHOR_PREFERENCE_KEY. Values are normalized defensively at every reader (strict#rrggbb, closed enums; invalid → unset → falls through to the gateway default).users.prefs.changed(bounded schema,operator.readscope guard), emitted only to connections bound to the same merged profile, so a person's other devices update live.control-ui-presentation.ts); only the store feeding the resolved value became identity-aware, inside the existing server-prefs provenance/pending machinery. Pending local edits still shadow incoming updates; per-profile pending state is scope-namespaced (<gateway>:profile:<id>) so shared browsers cannot replay another person's queued intent.ui.prefs/ui.seamColorremain the defaults for everyone who hasn't chosen.talk.configprojects the caller's profile accent first when the connection is profile-bound; token-authenticated nodes (no profile) are unchanged, so native apps inherit correct behavior with no app changes.users.prefs.setneedsoperator.write.Behavior change worth naming: on multi-person gateways an admin restyling their own UI no longer pushes it onto the whole team. Gateway-wide
ui.prefsbecomes the default people see before making a personal choice, and stays authoritative for profile-less connections.Startup JS budget: main's tide/beacon/phosphor baseline 341333 → 342930 B gzip (+1.6 KiB incl. jitter headroom) for the profile resolution/routing on the boot path; measured 342875 B on the combined tree.
Rebase onto the Tide/Beacon/Phosphor themes landing surfaced a real drift class: the profile store's closed theme enum would have silently dropped
"tide"/"beacon"/"phosphor"profile values. Fixed by makingUI_APPEARANCE_THEME_VALUESthe exported wire-contract list, deriving the Control UI's synced-theme set from it (new Set<ThemeName>(...)makes an unknown protocol name a compile error), and adding an exhaustiveRecord<ThemeName, true>test so a future theme missing from the wire contract fails to compile and fails at runtime. (theme.tsand the config zod enum keep their own copies — consolidating those is a named follow-up, not this PR.)User Impact
operator.writeget durable synced appearance for the first time (previously browser-local only).Evidence
packages/gateway-protocolusers-prefs schema,server-broadcast.board,server-methods/users-preferences(incl. merged-profile event targeting),server-methods/talk(profile accent projection incl. malformed-value rejection and profile-less regression), UIserver-prefs.profile/server-prefs/app-shell-gateway/config-page(102 tests, incl. the theme wire-contract exhaustiveness guard); all re-run green after the rebase.pnpm check:changedgreen (format, tsgo, oxlint, import cycles, DB-first guard, coercion guard, all others).pnpm build+pnpm ui:buildgreen; startup budget within pinned baseline.OPENCLAW_STATE_DIR, port 19310, trusted-proxy auth behind a header-injecting loopback proxy; two identities alice/bob, three browser contexts driven by Playwright, video + screenshots attached):users.prefs.changed).user_preferencesend statealice ui.theme="dash",bob ui.accent="#35b9b0".server-prefs.profile.test.tsand the untouched pre-existingserver-prefssuite.Production vs test LOC (numstat, judged): ~+330 production (feature capability: protocol keys/event, gateway emit + talk projection, UI routing/provenance) / ~+310 tests, plus docs.
alice-device1-flow.mp4