Skip to content

fix(ui): refresh MCP app colors after lazy themes load - #160565

Merged
roboclaw-bot merged 1 commit into
mainfrom
fix/mcp-applied-theme-colors
Sep 28, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
fix/mcp-applied-theme-colors

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes already-open MCP apps keeping the previous palette when a newly selected Control UI theme finishes loading.

User Impact

Embedded apps update their backgrounds, text, borders, and status colors when the selected palette is ready, without requiring a resize or reopening the app.

Why This Change Was Made

Notify theme subscribers after deferred palette application even when the mascot and hat stay unchanged. Immediate preference updates, synchronous notification coalescing, stale-generation/disposal guards, and the existing MCP token adapter are preserved.

Evidence

Actual Control UI components and AppBridge with the canonical mocked Gateway and a synthetic MCP protocol fixture, not an authenticated external MCP server. The first Tide stylesheet response was held and released while the same app remained mounted; no resize occurred.

Before

Before: embedded app remains on the previous light palette

After

After: embedded app receives the selected Tide dark palette

  • Browser proof: the app previously stayed light with #ffffff after the host became Tide dark; it now receives dark mode and #161d25. Mounted identities stayed unchanged and resize count remained zero.
  • Five owner regressions pass, covering deferred load/error completion, synchronous coalescing, supersession and disposal. Original source fails both deferred-palette cases. Changed test file: 4.69 s wall.
  • Broader scoped context/MCP validation: 88 tests passed across nine files; relevant types, formatting, lint/style checks, repository guards and independent P0–P2 review passed.
  • This independent branch preserves the exact reviewed owner/test bytes. Full production build and live-backend verification were not run.

Requested by @vyctorbrzezowski as part of the Control UI theme-drift audit.

Work sessions

Notify theme subscribers after a deferred palette applies even when mascot and hat stay unchanged. Preserve immediate preferences, coalesce synchronous publication, and retain generation and disposal fences.

Co-authored-by: vyctorbrzezowski <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 2:19 PM ET / 18:19 UTC (Revision 2).

ClawSweeper review

What this changes

The branch makes the Control UI notify mounted MCP apps when a lazily loaded theme palette applies and adds five timing and lifecycle regression cases.

Merge readiness

✅ Ready for maintainer review

The bug remains in current main. This focused PR has credible visual proof and no identified blocking defect. The previous draft-status blocker is resolved.

Priority: P2
Reviewed head: 8a1445f4ad82ea93ab4d10a3748ee4791f4ae036

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level fix has relevant visual proof and regression coverage, with no identified merge blocker.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The changed theme owner feeds the mounted MCP app's AppBridge context. Inspected before/after browser screenshots show the embedded card changing from stale light colors to the selected dark palette in the stated mocked-Gateway, synthetic-fixture flow; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The changed theme owner feeds the mounted MCP app's AppBridge context. Inspected before/after browser screenshots show the embedded card changing from stale light colors to the selected dark palette in the stated mocked-Gateway, synthetic-fixture flow; no stored-data contract changes.
Evidence reviewed 7 items Introduced fix: The PR publishes again after deferred palette application while retaining the generation guard and coalescing synchronous application.
Current-main gap: Fetched main still notifies on palette completion only when the mascot or avatar hat changes, leaving an unchanged-branding palette without a completion notice.
Mounted app delivery path: The mounted MCP app subscribes to theme notices and sends a new host context through AppBridge; that context includes computed host style variables.
Findings None None.
Security None None.

How this fits together

The Control UI theme owner reads appearance preferences and applies a palette when its stylesheet is ready. Mounted MCP apps receive the resolved colors through theme notifications and AppBridge context updates.

flowchart LR
A[Appearance selection] --> B[Theme owner]
B --> C{Stylesheet ready?}
C -->|No| D[Lazy palette load]
D --> E[Apply palette]
C -->|Yes| E
B --> F[Preference notice]
E --> G[Palette notice]
F --> H[MCP app context]
G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -4, Tests +99. Total +95 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 9 -4
Tests 1 99 0 +99
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 104 9 +95

Review metrics

Metric Value Why it matters
Production versus test lines production +5/-9; tests +99 The small owner repair is paired with focused regression coverage.
New regression suite cost 5 cases; 4.69 s wall reported The reported file cost is within the repository's five-second target.

Technical review

Best possible solution:

Keep palette-ready publication in the theme owner so mounted apps receive refreshed computed colors while stale or disposed selections remain ignored.

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

Yes. On current main, select an unloaded Tide palette while an MCP app is mounted; the source omits the palette-ready notification when branding stays the same. This review did not execute that flow.

Is this the best way to solve the issue?

Yes. The change uses the existing theme subscription and AppBridge context path while retaining the generation and disposal guards.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: An already-open embedded app can retain stale colors after a theme switch, with limited user impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The changed theme owner feeds the mounted MCP app's AppBridge context. Inspected before/after browser screenshots show the embedded card changing from stale light colors to the selected dark palette in the stated mocked-Gateway, synthetic-fixture flow; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed theme owner feeds the mounted MCP app's AppBridge context. Inspected before/after browser screenshots show the embedded card changing from stale light colors to the selected dark palette in the stated mocked-Gateway, synthetic-fixture flow; no stored-data contract changes.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The changed theme owner feeds the mounted MCP app's AppBridge context. Inspected before/after browser screenshots show the embedded card changing from stale light colors to the selected dark palette in the stated mocked-Gateway, synthetic-fixture flow; no stored-data contract changes.

Evidence

What I checked:

  • Introduced fix: The PR publishes again after deferred palette application while retaining the generation guard and coalescing synchronous application. (ui/src/app/bootstrap-theme.ts:119, 8a1445f4ad82)
  • Current-main gap: Fetched main still notifies on palette completion only when the mascot or avatar hat changes, leaving an unchanged-branding palette without a completion notice. (ui/src/app/bootstrap-theme.ts:126, 3a3ce2be2277)
  • Mounted app delivery path: The mounted MCP app subscribes to theme notices and sends a new host context through AppBridge; that context includes computed host style variables. (ui/src/components/mcp-app-view.ts:472, 8a1445f4ad82)
  • Regression coverage: Five new cases cover deferred load and error completion, synchronous coalescing, supersession, and disposal. The PR body reports a 4.69-second wall time; this review did not execute tests. (ui/src/app/bootstrap-theme.palette.test.ts:46, 8a1445f4ad82)
  • Visual behavior proof: The prepared PR screenshots were inspected: the embedded card is light before the fix and dark after it in the stated mocked-Gateway browser scenario. The images show the color result; unchanged mount identity and zero resizes are claims in the PR body. (8a1445f4ad82)
  • Feature history: Recent merged theme-owner work is attributed to Peter Steinberger; earlier MCP host-style publication is attributed to Jason (Json). Partial-clone blob fetch failures prevented raw-parent source-line introduction verification. (ui/src/app/bootstrap-theme.ts, b8e5c0e0eadf)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-09-28T17:01:56.091Z sha 8a1445f :: needs changes before merge. :: none

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 28, 2026 18:12
@roboclaw-bot
roboclaw-bot enabled auto-merge (squash) September 28, 2026 18:31
@roboclaw-bot
roboclaw-bot merged commit 89c0030 into main Sep 28, 2026
146 checks passed
@roboclaw-bot
roboclaw-bot deleted the fix/mcp-applied-theme-colors branch September 28, 2026 19:33
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
Notify theme subscribers after a deferred palette applies even when mascot and hat stay unchanged. Preserve immediate preferences, coalesce synchronous publication, and retain generation and disposal fences.

Co-authored-by: vyctorbrzezowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant