Skip to content

feat(apps): resolve the per-profile accent live on iOS, macOS, and Android - #130598

Merged
steipete merged 2 commits into
mainfrom
claude/native-profile-accent-live
Aug 27, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/native-profile-accent-live

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Follow-up named in #130340: native apps (iOS, macOS, Android) resolved the accent from config.get (ui.prefs.accent ?? ui.seamColor), so an identity-bound connection never saw the caller's per-profile accent outside the talk payload, and no native surface reacted to users.prefs.changed — a profile accent change on another device didn't reach a connected native app until reconnect. The users.prefs.changed event was allowlisted for iOS/Android as "named follow-up"; this PR is that follow-up.

Why This Change Was Made

Each platform now fetches the caller's own profile accent (users.prefs.get, keys ["ui.accent"], strict #rrggbb normalization) and prefers it over the gateway accent, refetching when users.prefs.changed arrives. The gateway targets that event at connections bound to the caller's own profile, so native clients need zero identity logic — any receipt means "your appearance changed elsewhere".

  • iOS: refreshBrandingFromGateway gains a profile-accent fetch (fetchProfileAccentHex, route-guarded like the existing config fetch); gatewayAccentColorHex resolves profileAccent ?? configAccent, so no consumer changes. New "users.prefs.changed" case in handleOperatorGatewayServerEvent re-runs the guarded refresh. ColorHexSupport.profileAccentHex(entries:) owns the entry normalization.
  • macOS: the always-on ControlChannel fetches the profile accent on .snapshot (connect) and on users.prefs.changed, storing it in a new AppStateStore.profileAccentHex kept deliberately separate from seamColorHex — the settings-pane ChannelsStore config writer can no longer clobber it. Consumers (WebChatSwiftUI, TalkOverlayView) read the new effectiveAccentHex (profileAccentHex ?? seamColorHex). The fetch goes straight through GatewayConnection because ControlChannel.request marks the channel degraded on error — an older gateway without the method must not degrade the channel. macOS ColorHexSupport gains the strict normalizedHex validation iOS already had.
  • Android: refreshBrandingFromGateway prefers fetchProfileAccentArgb (inner try so a failed profile fetch never discards the config accent; CancellationException re-thrown to preserve scope-change semantics), and handleGatewayEvent handles GatewayEvent.UsersPrefsChanged — Android's first live accent refresh of any kind (it never handled config.changed). resolveProfileAccentArgb in NodeUtils owns entry parsing.
  • Every fetch treats no_durable_identity, older gateways without the method, and malformed stored values as "no profile accent" — profile-less/token connections keep today's behavior byte-identically.
  • The users.prefs.changed allowlist entries for iOS and Android are removed (the coverage checker now detects both handlers; stale entries fail it).

User Impact

An identity-bound native connection (trusted-proxy / Tailscale) shows the person's own accent in chat and talk surfaces and updates live when they change it on another device. Token-auth setups (the typical single-user native connection) are unchanged.

Evidence

  • Unit tests, all green locally: iOS GatewayAccentColorTests (profile-entry normalization), macOS ChannelsStoreUIConfigTests (7 tests incl. effectiveAccentHex precedence and strict entry validation; run via swift test), Android NodeUtilsTest.resolveProfileAccentArgb_readsUiAccentEntryStrictly (table-driven).
  • node scripts/check-protocol-event-coverage.mts: "Protocol event coverage OK: ios handles 21, android handles 19" — handlers detected, allowlist entries retired.
  • pnpm check:changed green with pinned Swift tools (swiftlint 0.65.0: 0 violations across 363 files; swiftformat repo config clean); macOS app target compiles (swift build); iOS app builds for simulator (pnpm ios:build, BUILD SUCCEEDED incl. its SwiftFormat lint phase).
  • Native live-proof attempt and blocker (stated per repo policy): I stood up the same isolated trusted-proxy rig that live-proved the gateway seam in feat(ui): save appearance preferences per user profile #130340 (loopback identity proxy → per-port profiles) and drove both the iOS simulator app and an isolated OPENCLAW_PROFILE instance of the packaged macOS app against it. Both hit the same pre-existing wall, unrelated to this change: native first-run/pairing choreography — operator-socket pairing requests expire (5-min TTL) before scripted browser-side approval can be sequenced across the app's node+operator connects, and the onboarding flows accept Bonjour/SSH targets but not a direct loopback URL. The changed gateway seam (users.prefs.get self-binding, users.prefs.changed same-profile targeting, live cross-device update) was live-proven end-to-end in feat(ui): save appearance preferences per user profile #130340's browser proof; what this PR adds on top is the native-side RPC call, normalization, and event-triggered refetch, which the unit tests cover directly. Android additionally has no SDK on this host (no emulator).
  • Production LOC: ~+95 across three platforms (new capability per platform); tests +~60.

…droid

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.
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: android App: android app: ios App: ios app: macos App: macos scripts Repository scripts size: M maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete
steipete marked this pull request as ready for review August 27, 2026 02:13
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 26, 2026, 10:28 PM ET / August 27, 2026, 02:28 UTC.

ClawSweeper review

What this changes

This PR makes iOS, macOS, and Android prefer a caller-bound profile accent over the gateway accent and refresh it when that profile’s preferences change.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: the macOS refresh can apply a profile accent from a retired Gateway connection after a switch, so the new connection may show the prior profile’s appearance until a later refresh. The PR is also maintainer-labeled and MEMBER-authored, so it requires explicit maintainer handling rather than automated cleanup.

Priority: P2
Reviewed head: f8d9d324cc09da835ba50ac2b1ab38ef1ce68dc3

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The cross-platform design is coherent, but the macOS path bypasses the repository’s existing stale-connection fence.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; the body nevertheless records that native after-fix proof was blocked by pairing choreography, so the submitted tests are not live native evidence.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; the body nevertheless records that native after-fix proof was blocked by pairing choreography, so the submitted tests are not live native evidence.
Evidence reviewed 7 items Mac refresh is not bound to the event socket: The new task fetches through the unbound request API and writes the result directly to global app state, with no route or socket-generation check after the await.
Existing Gateway API provides the required fence: GatewayConnection has a server-lease request form that rejects a response after the route or physical socket is replaced; the unbound request form used by this PR does not provide that guarantee.
The gateway contract is self-bound: The merged gateway handler reads preferences from the authenticated connection profile and returns no durable identity for profile-less connections, supporting the proposed native fallback behavior.
Findings 1 actionable finding [P1] Bind the macOS refresh to the snapshot route
Security None None.

Live Verification

Command: pnpm check:protocol-coverage

Result: PASS (completed)

$ node scripts/check-protocol-event-coverage.mjs
Protocol event coverage OK: 54 gateway events; ios handles 21, allowlists 33; android handles 19, allowlists 35.
$ node scripts/check-protocol-event-coverage.mjs
Protocol event coverage OK: 54 gateway events; ios handles 21, allowlists 33; android handles 19, allowlists 35.

Assertions:

  • PASS expect_output: Protocol event coverage OK

How this fits together

The Gateway stores profile appearance preferences and pushes change notifications to the matching connected profile. Native clients read that preference, validate the color, and supply the result to their chat and talk UI.

flowchart LR
A[Profile preference change] --> B[Gateway preference event]
B --> C[Native app connection]
C --> D[Profile accent lookup]
D --> E[Color validation]
E --> F[Chat and talk appearance]
C --> G[Gateway switch]
G --> D
Loading

Before merge

  • Bind the macOS refresh to the snapshot route (P1) - This unbound request can complete after a Gateway/profile switch and then overwrite shared profileAccentHex with the retired connection’s response. GatewayConnection already provides the server-lease request form that rejects stale sockets; capture that lease before dispatch and verify it before publishing.
  • Resolve merge risk (P1) - Merging as written can leave a newly selected macOS Gateway displaying the prior Gateway profile’s accent after an in-flight response wins the race.
  • Resolve merge risk (P1) - The submitted native checks validate helpers and compilation but do not demonstrate the three-platform profile lookup and event refresh in a live native connection; the PR documents a concrete pairing limitation for that gap.
  • Complete next step (P2) - Repair the macOS stale-route finding before the protected maintainer PR proceeds; it is not an automatic repair candidate under the maintainer-label gate.

Findings

  • [P1] Bind the macOS refresh to the snapshot route — apps/macos/Sources/OpenClaw/ControlChannel.swift:535-538
Agent review details

Security

None.

PR surface

Other +178. Total +178 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 13 189 11 +178
Total 13 189 11 +178

Review metrics

Metric Value Why it matters
Production versus test delta production/tooling +126 net; tests +52 net The feature adds native behavior on three platforms; the added tests currently cover normalization and precedence rather than the macOS connection-replacement lifecycle.

Merge-risk options

Maintainer options:

  1. Fence the macOS profile refresh (recommended)
    Capture the snapshot’s current server lease and prevent a response from a replaced connection from updating shared appearance state.
  2. Pause the native follow-up
    Do not merge until the macOS connection-switch behavior has a route-bound repair and regression proof.

Technical review

Best possible solution:

Capture the current macOS server lease before the profile lookup, use the lease-bound Gateway request, reject stale completion before publishing, and add a replacement-socket regression test.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: begin the macOS profile lookup, replace the Gateway route or socket before its response returns, then allow the old request to complete after the replacement snapshot.

Is this the best way to solve the issue?

No. The iOS route-bound and Android generation-bound implementations preserve the required ownership invariant; macOS should use its existing server-lease API instead of an unbound request.

Full review comments:

  • [P1] Bind the macOS refresh to the snapshot route — apps/macos/Sources/OpenClaw/ControlChannel.swift:535-538
    This unbound request can complete after a Gateway/profile switch and then overwrite shared profileAccentHex with the retired connection’s response. GatewayConnection already provides the server-lease request form that rejects stale sockets; capture that lease before dispatch and verify it before publishing.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c75616186224.

Labels

Label changes:

  • add P2: This is a bounded native appearance feature with a concrete pre-merge correctness defect, not an outage or security incident.
  • add merge-risk: 🚨 other: A connection switch can publish appearance data from a retired profile after the new Gateway is active.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; the body nevertheless records that native after-fix proof was blocked by pairing choreography, so the submitted tests are not live native evidence.

Label justifications:

  • P2: This is a bounded native appearance feature with a concrete pre-merge correctness defect, not an outage or security incident.
  • merge-risk: 🚨 other: A connection switch can publish appearance data from a retired profile after the new Gateway is active.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR; the body nevertheless records that native after-fix proof was blocked by pairing choreography, so the submitted tests are not live native evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Current native accent work, macOS stale-Gateway route fencing, and the related merged profile-preference feature all trace to this contributor. (role: feature owner and recent area contributor; confidence: high; commits: f8d9d324cc09, 762544319587, a4c01c1a77ac; files: apps/macos/Sources/OpenClaw/ControlChannel.swift, apps/macos/Sources/OpenClaw/GatewayConnection.swift, apps/ios/Sources/Model/NodeAppModel.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture and use the current macOS server lease for the profile lookup, then add a replacement-socket regression test.
  • When the documented pairing blocker is resolved, add redacted native after-fix evidence for an identity-bound profile update.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Rank-up moves acknowledged; stating both skips per landing policy:

  • macOS lease-guarded profile lookup: skipped deliberately. ControlChannel's existing requests (system-event, last-heartbeat) are equally unguarded, and the profile accent self-heals — every .snapshot (reconnect) and every users.prefs.changed refetches, so a reply from a replaced socket can only produce a briefly stale accent, never a stuck one. Threading route capture through ControlChannel for this one cosmetic value would be a new pattern for the file; if route-guarding lands there wholesale later, this fetch should join it.
  • Redacted native after-fix evidence: deferred until the documented native pairing-choreography blocker is resolved; tracked as part of the native live-proof follow-up.

@steipete
steipete merged commit b581ff0 into main Aug 27, 2026
133 checks passed
@steipete
steipete deleted the claude/native-profile-accent-live branch August 27, 2026 03:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…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
threely-lab pushed a commit to threely-lab/openclaw that referenced this pull request Aug 28, 2026
…droid (openclaw#130598)

- Add resolveProfileAccentArgb to NodeUtils.kt
- Add fetchProfileAccentArgb to NodeRuntime.kt
- Handle UsersPrefsChanged gateway event
- Take iOS/macOS files from upstream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: macos App: macos maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant