Issue
Toggling dark mode in Settings has no effect on hostContext.theme or the style variables sent to MCP apps — they always resolve to "light".
How to reproduce
- Open the Inspector
- Navigate to the Playground and start a chat with an MCP app that renders a widget
- Go to Settings and toggle "Dark Mode" on
- Return to the Playground and inspect
result.hostContext.theme in the widget debug panel — it is still "light" and the style variables remain light-mode values
Expected Behavior
When dark mode is toggled on, result.hostContext.theme should be "dark" and hostContext.styles.variables should contain the dark-mode design tokens.
Screenshots
N/A
Platform
Additional Context
Theme had two competing sources of truth: themeMode in the preferences store (set by the Settings toggle) and draftHostContext.theme in the host context store (baked in by buildDefaultWorkspaceHostContext). When the global theme changed, loadWorkspaceHostContext silently skipped the update whenever the host context was dirty or a saved workspace config existed. The stale draftHostContext.theme then won the resolution chain in both PlaygroundMain and MCPAppsRenderer.
Other host context fields (locale, timezone, device capabilities) were unaffected because they only flow through patchHostContext — no competing global preference store.
Issue
Toggling dark mode in Settings has no effect on
hostContext.themeor the style variables sent to MCP apps — they always resolve to"light".How to reproduce
result.hostContext.themein the widget debug panel — it is still"light"and the style variables remain light-mode valuesExpected Behavior
When dark mode is toggled on,
result.hostContext.themeshould be"dark"andhostContext.styles.variablesshould contain the dark-mode design tokens.Screenshots
N/A
Platform
Additional Context
Theme had two competing sources of truth:
themeModein the preferences store (set by the Settings toggle) anddraftHostContext.themein the host context store (baked in bybuildDefaultWorkspaceHostContext). When the global theme changed,loadWorkspaceHostContextsilently skipped the update whenever the host context was dirty or a saved workspace config existed. The staledraftHostContext.themethen won the resolution chain in bothPlaygroundMainandMCPAppsRenderer.Other host context fields (locale, timezone, device capabilities) were unaffected because they only flow through
patchHostContext— no competing global preference store.