Skip to content

fix(macos): user accent from Control UI is clobbered by config snapshots and never live-updates the chat window - #128703

Merged
steipete merged 2 commits into
mainfrom
steipete/blissful-cannon-0fe1e6
Aug 24, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/blissful-cannon-0fe1e6

Conversation

@steipete

@steipete steipete commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where macOS app users who set a Control UI user accent (ui.prefs.accent, landed in #128432/#128577) would see the native app chrome fall back to the operator ui.seamColor — or a stale color — depending on which gateway payload arrived last, and where accent changes never reached a running app at all. Three defects:

  • ChannelsStore.applyUIConfig read raw ui.seamColor from the config.get snapshot and overwrote AppStateStore.seamColorHex, clobbering the user accent that TalkModeRuntime.applyTalkConfig had set from the talk.config payload (which already applies the precedence server-side).
  • The native chat window read AppStateStore.seamColorHex once at window construction, so accent changes never live-updated the window's userAccent.
  • No macOS consumer existed for the gateway's hash-only config.changed broadcast, so ChannelsStore's config snapshot was loaded once at startup and a Control UI accent change (or any config change) never refreshed shared state while the app ran (flagged by ClawSweeper's review; addressed in the second commit).

Why This Change Was Made

The accent precedence contract (user accent → operator ui.seamColor → theme default) must hold on every path that feeds native-app chrome, and a Control UI edit must end in a visible outcome in the running app. The snapshot path now resolves ui.prefs.accent ?? ui.seamColor through a testable helper (ChannelsStore.uiAccent) mirroring src/gateway/server-methods/talk.ts. The chat window derives its accent inside MacChatSurface.body from the @Observable AppStateStore (deleting the one-shot userAccent init plumbing), so any accent change recolors open windows. ChannelsStore now subscribes to gateway pushes (same idiom as InstancesStore) and re-fetches config.get on config.changed, reconnect snapshots, and sequence gaps; the refresh applies non-force so an in-progress local settings draft wins, and the in-flight reload queue's pending flag became a closed level (none/refresh/force) so refreshes arriving mid-load are coalesced instead of dropped and a requeued refresh cannot clobber a dirty draft.

User Impact

User accent set in the Control UI now sticks in the macOS app regardless of payload arrival order, propagates to a running app without restart, and recolors open native chat windows live. Docs (docs/gateway/configuration-reference.md) document the precedence for native-app chrome.

Evidence

  • ChannelsStoreUIConfigTests (5 tests): precedence, whitespace fallback, both-absent → nil, a real-ConfigSnapshot regression through applyConfigSnapshot (fails pre-fix: returned operator seam #445566 instead of user accent #112233), and gateway-push refresh classification (config.changed/snapshot/seqGap refresh; unrelated events don't).
  • ChannelsSettingsSmokeTests (8 tests) extended: reload queue coalesces a refresh during an in-flight load, force stays sticky over refresh, and non-force snapshots leave dirty drafts intact.
  • swift build green; both suites pass; repo SwiftFormat macOS lane clean (0/26).
  • Codex autoreview per commit: both clean ("patch is correct", 0.99 / 0.98).
  • Production LOC: +49/−21 | Tests: +81/−5. Growth is the new event-consumer capability (gateway push subscription + closed reload-request level); the precedence/window fixes themselves are net negative.
  • ClawSweeper rank-up moves: (1) consume gateway config-change notifications — done in commit 2; (2) live before/after capture of a Control UI edit recoloring an open native chat — skipped this PR: it needs a signed app bundle plus a live gateway rig; the event→refresh→observation chain is covered end-to-end by the unit seams above (push classification, non-force apply, observable store read in body).

…update chat window

The Control UI user accent (ui.prefs.accent) landed in #128432/#128577 with
precedence user accent -> operator ui.seamColor -> theme default, and the
gateway's talk.config payload already applies it. The macOS app had two gaps:

- ChannelsStore.applyUIConfig read raw ui.seamColor from the config.get
  snapshot and clobbered the user accent set from talk.config depending on
  arrival order. It now resolves ui.prefs.accent ?? ui.seamColor via a
  testable helper mirroring the gateway precedence.
- The native chat window read AppStateStore.seamColorHex once at window
  construction, so accent changes never live-updated. MacChatSurface now
  reads the @observable store in body, deleting the one-shot userAccent
  plumbing.

Docs: configuration-reference.md documents the precedence for native-app
chrome. Regression test fails pre-fix (snapshot returned the operator seam
color instead of the user accent).
@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 24, 2026 11:47
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 24, 2026
@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 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 24, 2026, 8:25 AM ET / 12:25 UTC.

ClawSweeper review

What this changes

The PR preserves the Control UI user accent in macOS configuration snapshots, refreshes configuration after Gateway change notifications, and makes native chat windows read the shared accent reactively.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: the new Gateway push listener is active only while Cron Settings is selected, so a normal open chat window still does not receive Control UI accent changes.

Priority: P2
Reviewed head: 11162a69bf3ad9f0fdf1f94dd021c171e9f038f9

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has focused source coverage, but its central live-update claim remains false outside Cron Settings.
Proof confidence 🌊 off-meta tidepool Not applicable: Maintainer-authored PRs are exempt from the external contributor proof gate; the stated signed-app and live-Gateway requirement also means no after-fix native-window outcome is shown.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Maintainer-authored PRs are exempt from the external contributor proof gate; the stated signed-app and live-Gateway requirement also means no after-fix native-window outcome is shown.
Evidence reviewed 5 items Listener is scoped to Cron Settings: The only production call sites for ChannelsStore.start and stop are CronSettings lifecycle handlers; leaving that pane cancels the push task.
New listener cannot run for ordinary chat use: The added subscription and refresh handler live in ChannelsStore, so they exist only during the Cron Settings lifecycle identified above.
Chat already observes shared state: MacChatSurface derives its accent from AppStateStore during body rendering; the missing link is updating that state while chat is open.
Findings 1 actionable finding [P1] Move config refresh out of the Cron settings lifecycle
Security None None.

How this fits together

Gateway emits a hash-only configuration-change event after persisted edits; the macOS app must refetch configuration and update shared UI state. Native chat windows render their accent from that shared state.

flowchart LR
  A[Control UI accent edit] --> B[Gateway configuration]
  B --> C[Configuration change event]
  C --> D[macOS app lifecycle consumer]
  D --> E[Shared accent state]
  E --> F[Open native chat window]
Loading

Before merge

  • Move config refresh out of the Cron settings lifecycle (P1) - ChannelsStore.start() is called only by CronSettings, and onDisappear stops it. Therefore this new subscription is absent for the ordinary open-chat flow, leaving AppStateStore.seamColorHex unchanged after a Control UI edit unless the user happens to keep Cron Settings active. Put the listener under an app or visible-chat lifecycle owner.
  • Resolve merge risk (P1) - Merging leaves the documented connected-client refresh behavior conditional on an unrelated Cron Settings pane being open.
  • Resolve merge risk (P1) - Production is net +28 lines, but the added subscription is attached to a channel-settings lifecycle rather than the app or chat lifecycle that owns native chrome updates.
  • Complete next step (P2) - This maintainer-labeled PR has a clear P1 lifecycle-owner repair, but requires maintainer handling rather than an automated repair lane.

Findings

  • [P1] Move config refresh out of the Cron settings lifecycle — apps/macos/Sources/OpenClaw/ChannelsStore+Lifecycle.swift:29-30
Agent review details

Security

None.

PR surface

Docs +3, Other +104. Total +107 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 1 4 1 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 6 130 26 +104
Total 7 134 27 +107

Review metrics

Metric Value Why it matters
Production versus tests production +49/-21; tests +81/-5; docs +4/-1 The net production growth adds a config-event consumer, but its current lifecycle does not cover the user flow the PR claims to repair.
Live config consumers 1 added The single new consumer is scoped to Cron Settings, which is why it cannot provide app-wide accent refresh.

Merge-risk options

Maintainer options:

  1. Rehome the live config consumer (recommended)
    Start the lightweight config listener with the app or visible-chat lifecycle so a Control UI edit updates open chat without visiting Cron Settings.

Technical review

Best possible solution:

Move the config-change subscription and snapshot-to-AppStateStore update to a lifecycle owner active whenever native chat is visible, and remove the Cron Settings coupling.

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

Yes, source-reproducible: open a native chat without Cron Settings selected, then change the Control UI accent; no ChannelsStore push subscription exists because its only start call is in CronSettings.

Is this the best way to solve the issue?

No: the refresh logic is correct in isolation, but its owner is inactive for ordinary chat use; it belongs with app or chat visibility lifecycle rather than Cron Settings.

Full review comments:

  • [P1] Move config refresh out of the Cron settings lifecycle — apps/macos/Sources/OpenClaw/ChannelsStore+Lifecycle.swift:29-30
    ChannelsStore.start() is called only by CronSettings, and onDisappear stops it. Therefore this new subscription is absent for the ordinary open-chat flow, leaving AppStateStore.seamColorHex unchanged after a Control UI edit unless the user happens to keep Cron Settings active. Put the listener under an app or visible-chat lifecycle owner.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded macOS native-chat configuration update defect with limited blast radius.
  • merge-risk: 🚨 other: The PR documents live connected-client refresh but attaches its sole new consumer to an unrelated settings-pane lifecycle.
  • 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: Maintainer-authored PRs are exempt from the external contributor proof gate; the stated signed-app and live-Gateway requirement also means no after-fix native-window outcome is shown.

Evidence

What I checked:

Likely related people:

  • steipete: Authored merged user-accent work and the current macOS follow-up, connecting this person to both the precedence contract and its native consumer. (role: introduced surrounding preference contract and recent area contributor; confidence: high; commits: 8e6c34fba3db, 11162a69bf3a; files: src/gateway/server-methods/talk.ts, apps/macos/Sources/OpenClaw/ChannelsStore+Lifecycle.swift, apps/macos/Sources/OpenClaw/WebChatSwiftUI.swift)

Rank-up moves

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

  • Move the listener to an app or visible-chat lifecycle owner and add a regression covering that owner.
  • Capture a redacted before/after native-chat accent update from a running app and Gateway after the lifecycle repair.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-24T11:55:30.388Z sha b8da089 :: found issues before merge. :: [P1] Refresh the shared accent on gateway config changes

Addresses the review finding that no macOS consumer turned the gateway's
hash-only config.changed broadcast into refreshed shared state, so a
Control UI accent change never reached an open native chat window while
the app ran. ChannelsStore now subscribes to gateway pushes and re-fetches
config.get on config.changed, reconnect snapshots, and sequence gaps.

The refresh applies non-force so an in-progress local settings draft wins
(the gateway rejects stale-hash writes anyway). The in-flight reload queue
gains a closed pending level (none/refresh/force) so a refresh arriving
during a load is coalesced instead of dropped, and a requeued refresh
cannot clobber a dirty draft the way the old boolean force-pending did.
@steipete
steipete merged commit 33b10fe into main Aug 24, 2026
60 checks passed
@steipete
steipete deleted the steipete/blissful-cannon-0fe1e6 branch August 24, 2026 12:38
@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 25, 2026
…ots and never live-updates the chat window (openclaw#128703)

* fix(macos): honor user accent precedence in config snapshot and live-update chat window

The Control UI user accent (ui.prefs.accent) landed in openclaw#128432/openclaw#128577 with
precedence user accent -> operator ui.seamColor -> theme default, and the
gateway's talk.config payload already applies it. The macOS app had two gaps:

- ChannelsStore.applyUIConfig read raw ui.seamColor from the config.get
  snapshot and clobbered the user accent set from talk.config depending on
  arrival order. It now resolves ui.prefs.accent ?? ui.seamColor via a
  testable helper mirroring the gateway precedence.
- The native chat window read AppStateStore.seamColorHex once at window
  construction, so accent changes never live-updated. MacChatSurface now
  reads the @observable store in body, deleting the one-shot userAccent
  plumbing.

Docs: configuration-reference.md documents the precedence for native-app
chrome. Regression test fails pre-fix (snapshot returned the operator seam
color instead of the user accent).

* fix(macos): refresh config from gateway config.changed events

Addresses the review finding that no macOS consumer turned the gateway's
hash-only config.changed broadcast into refreshed shared state, so a
Control UI accent change never reached an open native chat window while
the app ran. ChannelsStore now subscribes to gateway pushes and re-fetches
config.get on config.changed, reconnect snapshots, and sequence gaps.

The refresh applies non-force so an in-progress local settings draft wins
(the gateway rejects stale-hash writes anyway). The in-flight reload queue
gains a closed pending level (none/refresh/force) so a refresh arriving
during a load is coalesced instead of dropped, and a requeued refresh
cannot clobber a dirty draft the way the old boolean force-pending did.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos docs Improvements or additions to documentation gateway Gateway runtime 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. size: S 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