Skip to content

🙌 OpenHands: AI-Driven Development

fix(themes): make warning feedback theme-aware (#18333)

Engel Nyst5a8978c0afde
diff --git a/.pr/warning-feedback.html b/.pr/warning-feedback.html
new file mode 100644
index 0000000000..c51fb9daf2
--- /dev/null
+++ b/.pr/warning-feedback.html
@@ -0,0 +1,154 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="color-scheme" content="light dark">
+ <title>Warning feedback across themes · OpenHands Agent Canvas</title>
+ <style>
+ :root { color-scheme: light dark; --bg:#10171c; --panel:#182229; --ink:#edf2f3; --muted:#b4c0c5; --line:#3b4a52; --teal:#7bd3c4; --amber:#e8c86b; --red:#ff9389; --code:#0b1115; font:16px/1.6 ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
+ * { box-sizing:border-box; }
+ body { margin:0; background:var(--bg); color:var(--ink); }
+ main { width:min(1050px,100%); margin:auto; padding:56px 28px 88px; }
+ a { color:var(--teal); text-underline-offset:.2em; overflow-wrap:anywhere; }
+ a:focus-visible { outline:2px solid var(--amber); outline-offset:4px; }
+ .eyebrow,.tag { color:var(--teal); font:600 .8rem/1.4 ui-monospace,SFMono-Regular,monospace; letter-spacing:.08em; text-transform:uppercase; }
+ h1,h2,h3,p { margin-top:0; }
+ h1 { max-width:850px; margin-bottom:14px; font-size:clamp(2.4rem,7vw,4.6rem); line-height:1.04; letter-spacing:-.045em; }
+ h2 { margin:0 0 14px; font-size:1.55rem; line-height:1.2; }
+ h3 { margin:0 0 8px; font-size:1.05rem; }
+ .lede { max-width:790px; color:var(--muted); font-size:1.15rem; }
+ .meta { color:var(--muted); font-size:.9rem; }
+ .actions { display:flex; flex-wrap:wrap; gap:12px; margin:26px 0 40px; }
+ .button { display:inline-block; padding:10px 15px; border:1px solid var(--teal); border-radius:5px; color:var(--ink); text-decoration:none; font-weight:700; }
+ .button.primary { background:var(--teal); color:#0d1919; }
+ section { margin:42px 0; }
+ .card { padding:24px; border:1px solid var(--line); border-radius:10px; background:var(--panel); }
+ .grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
+ .flow { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:14px; }
+ .flow article { min-height:150px; padding:18px; border:1px solid var(--line); border-radius:8px; background:var(--code); }
+ .arrow { color:var(--teal); font-size:2rem; font-weight:700; }
+ code,pre { font: .9rem/1.6 ui-monospace,SFMono-Regular,monospace; }
+ code { color:#f1d987; }
+ pre { overflow:auto; margin:10px 0 0; padding:14px; border:1px solid var(--line); border-radius:6px; background:var(--code); color:var(--ink); }
+ table { width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
+ th,td { padding:11px 12px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
+ th { color:var(--teal); font-size:.85rem; }
+ .pass { color:var(--teal); font-weight:700; }
+ .note { color:var(--muted); font-size:.9rem; }
+ .pill { display:inline-block; margin:3px 5px 3px 0; padding:4px 9px; border:1px solid var(--line); border-radius:99px; color:var(--muted); font-size:.78rem; }
+ .diagram { width:100%; height:auto; }
+ footer { margin-top:56px; padding-top:20px; border-top:1px solid var(--line); color:var(--muted); font-size:.85rem; }
+ @media(max-width:680px) { main{padding:38px 18px 60px}.grid{grid-template-columns:1fr}.flow{grid-template-columns:1fr}.arrow{transform:rotate(90deg);justify-self:center}.card{padding:18px}table{font-size:.88rem}th,td{padding:8px 6px} }
+ </style>
+</head>
+<body>
+<main>
+ <header>
+ <p class="eyebrow">OpenHands Agent Canvas · PR #18333 · Issue #18331</p>
+ <h1>Warning text should follow the theme.</h1>
+ <p class="lede">Six hardcoded yellow and amber findings cross four UI paths. This proposal gives warning text its own semantic role, readable on every built-in theme while keeping control-warning color behavior separate.</p>
+ <p class="meta">Base: <code>738b23d2</code> · implementation: <code>cca69c13</code> · spec <code>WN-001</code></p>
+ <div class="actions">
+ <a class="button primary" href="https://enyst.github.io/arch/agentic-linting-refactoring.html#warning-feedback-film">Watch Before / After</a>
+ <a class="button" href="https://enyst.github.io/experiments/agentic-linting-refactoring/warning-feedback-before-after.mp4">Download MP4</a>
+ <a class="button" href="https://github.com/OpenHands/OpenHands/issues/18331">Issue #18331</a>
+ </div>
+ </header>
+
+ <section>
+ <p class="tag">Change</p>
+ <h2>One warning role, two kinds of color ownership</h2>
+ <div class="flow" aria-label="Raw warning colors are replaced with a semantic text role while panel tint and border remain on the control-warning role">
+ <article>
+ <h3>Before · palette utility</h3>
+ <p>Text and icons pick fixed yellow or amber shades. Light themes wash them out, and host overrides cannot reach those classes.</p>
+ <pre><code>text-amber-300
+text-yellow-400
+border-amber-400/30
+bg-amber-400/5</code></pre>
+ </article>
+ <span class="arrow" aria-hidden="true">→</span>
+ <article>
+ <h3>After · semantic roles</h3>
+ <p>Small warning text uses <code>feedback-warning</code>. The trust notice keeps the existing <code>warning</code> role for its tint and border.</p>
+ <pre><code>text-feedback-warning
+border-warning/30
+bg-warning/5</code></pre>
+ </article>
+ </div>
+ <svg class="diagram" viewBox="0 0 960 156" role="img" aria-labelledby="diagram-title diagram-desc" style="margin-top:22px">
+ <title id="diagram-title">Warning text token path</title>
+ <desc id="diagram-desc">The feedback-warning CSS variable flows through the Tailwind text token to warning messages. Embedded hosts can override the same variable.</desc>
+ <rect x="12" y="20" width="220" height="104" rx="10" fill="#182229" stroke="#3b4a52"/><text x="122" y="62" text-anchor="middle" fill="#edf2f3" font-size="17">Theme token</text><text x="122" y="91" text-anchor="middle" fill="#f1d987" font-size="16">--oh-feedback-warning</text>
+ <path d="M236 72h60" stroke="#7bd3c4" stroke-width="3"/><path d="m288 64 10 8-10 8" fill="none" stroke="#7bd3c4" stroke-width="3"/>
+ <rect x="304" y="20" width="220" height="104" rx="10" fill="#182229" stroke="#3b4a52"/><text x="414" y="62" text-anchor="middle" fill="#edf2f3" font-size="17">Tailwind text role</text><text x="414" y="91" text-anchor="middle" fill="#f1d987" font-size="16">text-feedback-warning</text>
+ <path d="M528 72h60" stroke="#7bd3c4" stroke-width="3"/><path d="m580 64 10 8-10 8" fill="none" stroke="#7bd3c4" stroke-width="3"/>
+ <rect x="596" y="20" width="190" height="104" rx="10" fill="#182229" stroke="#3b4a52"/><text x="691" y="62" text-anchor="middle" fill="#edf2f3" font-size="17">Warning UI</text><text x="691" y="91" text-anchor="middle" fill="#f1d987" font-size="16">Home · Apps · ACP</text>
+ <path d="M790 72h44" stroke="#7bd3c4" stroke-width="3"/><path d="m826 64 10 8-10 8" fill="none" stroke="#7bd3c4" stroke-width="3"/>
+ <rect x="842" y="20" width="106" height="104" rx="10" fill="#182229" stroke="#3b4a52"/><text x="895" y="57" text-anchor="middle" fill="#edf2f3" font-size="15">Host</text><text x="895" y="82" text-anchor="middle" fill="#7bd3c4" font-size="14">override</text>
+ </svg>
+ <p class="note">The role is added to <code>AGENT_SERVER_UI_DEFAULT_CSS_VARIABLES</code>, so an embedding application can supply its own value through the existing CSS-variable override path. No server API or compatibility change is needed.</p>
+ </section>
+
+ <section>
+ <p class="tag">Theme behavior</p>
+ <h2>Contrast is measured on the surfaces people see</h2>
+ <div class="card">
+ <table>
+ <thead><tr><th>Surface / theme</th><th>Before</th><th>After</th><th>Result</th></tr></thead>
+ <tbody>
+ <tr><td>Home · Light+</td><td>1.36:1</td><td>5.26:1</td><td class="pass">Pass</td></tr>
+ <tr><td>Apps trust notice · Light+</td><td>1.08:1</td><td>5.80:1</td><td class="pass">Pass</td></tr>
+ <tr><td>Home · Solarized Light</td><td>1.30:1</td><td>5.78:1</td><td class="pass">Pass</td></tr>
+ <tr><td>Apps trust notice · Solarized Light</td><td>1.00:1</td><td>6.18:1</td><td class="pass">Pass</td></tr>
+ </tbody>
+ </table>
+ </div>
+ <p class="note">The contrast contract also covers ACP credentials and the required-secret onboarding state against their actual secondary surface. The minimum ACP conflict result is 6.10:1 across the five themes. Home and Apps were captured on desktop and phone in all five themes with no horizontal overflow.</p>
+ <div class="grid">
+ <article class="card"><h3>Base and dark themes</h3><p><code>--oh-feedback-warning: #c9b974</code>. Dark themes inherit the default value; the separate control role remains untouched.</p></article>
+ <article class="card"><h3>Light palettes</h3><p>Light+ uses <code>#7D5D08</code>; Solarized Light uses <code>#735400</code>. Both keep small text above 4.5:1 on the tested warning surfaces.</p></article>
+ </div>
+ </section>
+
+ <section>
+ <p class="tag">Scope</p>
+ <h2>Four paths, six findings, unchanged behavior</h2>
+ <div class="grid">
+ <article class="card"><h3>Home</h3><p>Missing-LLM warning icon changes from the raw yellow utility to <code>text-feedback-warning</code>.</p></article>
+ <article class="card"><h3>Canvas Apps</h3><p>Trust notice text becomes theme-aware. Its amber tint and border become the existing <code>warning</code> token equivalents.</p></article>
+ <article class="card"><h3>ACP credentials</h3><p>Credential-conflict messages use the same readable warning text role in onboarding and Settings.</p></article>
+ <article class="card"><h3>Required ACP secrets</h3><p>The blocked-onboarding message uses the new role. The condition that blocks progression is unchanged.</p></article>
+ </div>
+ <p><span class="pill">No copy changes</span><span class="pill">No routing changes</span><span class="pill">No validation changes</span><span class="pill">No credentials saved</span><span class="pill">No LLM call</span></p>
+ </section>
+
+ <section>
+ <p class="tag">Verification</p>
+ <h2>Tests protect the color contract and host path</h2>
+ <div class="card">
+ <ul>
+ <li>Theme tests assert at least 4.5:1 for all five themes on Home, the warning-tinted Apps panel, ACP credentials, and the onboarding blocked warning.</li>
+ <li>Two real-browser regression tests verify a host-supplied warning color reaches the Home icon and Apps trust notice.</li>
+ <li>Focused component and theme tests: 48 passed. Lint: 0 errors; 733 warnings. App and library builds passed.</li>
+ <li>Full local suite: 816 files passed; the two failures are the unrelated Docker session-key subprocess tests (exit 127). GitHub CI is the full-suite check for this PR.</li>
+ </ul>
+ <p>Production evidence uses <a href="https://enyst.github.io/arch/agentic-linting-refactoring.html#warning-feedback-film">real control-openhands Before/After footage</a> from Canvas and Agent Server 1.54.0. The film includes labeled slides, actual UI footage, phone-width captures, and very quiet ambient music.</p>
+ </div>
+ </section>
+
+ <section>
+ <p class="tag">Source</p>
+ <h2>Review the exact implementation</h2>
+ <ul>
+ <li><a href="https://github.com/OpenHands/OpenHands/blob/0f1b6f62507f1ccdb4e63f61cf3dc48356a0d4fa/src/routes/canvas-extensions.tsx">Before: Apps trust notice</a> · <a href="https://github.com/enyst/playground/blob/cca69c138ab220566aa436a40494567df98dff84/src/routes/canvas-extensions.tsx">After</a></li>
+ <li><a href="https://github.com/enyst/playground/blob/cca69c138ab220566aa436a40494567df98dff84/src/styles/agent-server-ui-style-scope.ts">Host-exposed default CSS variables</a> · <a href="https://github.com/enyst/playground/blob/cca69c138ab220566aa436a40494567df98dff84/src/tailwind.css">Tailwind semantic role</a></li>
+ <li><a href="https://github.com/enyst/playground/blob/cca69c138ab220566aa436a40494567df98dff84/src/themes/color-theme/definitions/light-plus.ts">Light+ value</a> · <a href="https://github.com/enyst/playground/blob/cca69c138ab220566aa436a40494567df98dff84/src/themes/color-theme/definitions/solarized-light.ts">Solarized Light value</a></li>
+ <li><a href="https://github.com/enyst/playground/blob/cca69c138ab220566aa436a40494567df98dff84/__tests__/themes/color-themes.test.tsx">Contrast test</a> · <a href="https://github.com/enyst/playground/blob/cca69c138ab220566aa436a40494567df98dff84/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts">Host override browser tests</a> · <a href="https://github.com/OpenHands/OpenHands/issues/18331">Issue and acceptance criteria</a></li>
+ </ul>
+ </section>
+ <footer>OpenHands Agent Canvas · PR #18333 · Design note generated for review; `.pr/` artifacts are removed by the repository workflow after approval.</footer>
+</main>
+</body>
+</html>
diff --git a/__tests__/themes/color-themes.test.tsx b/__tests__/themes/color-themes.test.tsx
index 6bd9354e20..357b1f9cfd 100644
--- a/__tests__/themes/color-themes.test.tsx
+++ b/__tests__/themes/color-themes.test.tsx
@@ -1,4 +1,5 @@
import { act, render, screen } from "@testing-library/react";
+import { readFileSync } from "node:fs";
import { afterEach, describe, expect, it } from "vitest";
import { AgentServerUIRoot } from "#/components/providers/agent-server-ui-root";
import { AGENT_SERVER_UI_DEFAULT_CSS_VARIABLES } from "#/styles/agent-server-ui-style-scope";
@@ -8,10 +9,16 @@ import {
applyColorTheme,
} from "#/themes/color-themes";
+const defaultWarningColor = readFileSync(
+ `${process.cwd()}/src/tailwind.css`,
+ "utf-8",
+).match(/^\s*--oh-warning:\s*([^;]+);/m)?.[1];
+
describe("color themes", () => {
// @spec MCP-004 — Form feedback follows readable theme text roles
+ // @spec WN-001 — Warning feedback also meets the small-text contrast contract
it.each(Object.entries(COLOR_THEMES))(
- "keeps small form feedback readable on the %s modal surface",
+ "keeps small feedback text readable on the %s modal surface",
(_key, theme) => {
// Resolve the shipped palette, including stylesheet-owned defaults.
const variables: Record<string, string> = {
@@ -19,35 +26,58 @@ describe("color themes", () => {
...theme.scale,
...theme.tokens,
};
+ // Brand defaults stay CSS-owned so runtime theme overrides can win.
+ if (defaultWarningColor) {
+ variables["--oh-warning"] ??= defaultWarningColor;
+ }
const resolve = (name: string): string => {
const value = variables[name];
expect(value, `Missing theme token ${name}`).toBeDefined();
const reference = /^var\((--[\w-]+)\)$/.exec(value);
return reference ? resolve(reference[1]) : value;
};
- const luminance = (hex: string): number => {
- const channels = [1, 3, 5].map((offset) => {
- const channel =
- Number.parseInt(hex.slice(offset, offset + 2), 16) / 255;
- return channel <= 0.04045
+ const channels = (hex: string): number[] =>
+ [1, 3, 5].map(
+ (offset) => Number.parseInt(hex.slice(offset, offset + 2), 16) / 255,
+ );
+ const luminance = (color: string | number[]): number => {
+ const values = typeof color === "string" ? channels(color) : color;
+ const linear = values.map((channel) =>
+ channel <= 0.04045
? channel / 12.92
- : ((channel + 0.055) / 1.055) ** 2.4;
- });
- return (
- channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722
+ : ((channel + 0.055) / 1.055) ** 2.4,
);
+ return linear[0] * 0.2126 + linear[1] * 0.7152 + linear[2] * 0.0722;
};
- const surface = luminance(resolve("--oh-color-base-secondary"));
+ const contrast = (ink: number, surface: number) =>
+ (Math.max(ink, surface) + 0.05) / (Math.min(ink, surface) + 0.05);
+ const modalSurface = luminance(resolve("--oh-color-base-secondary"));
for (const role of ["--oh-feedback-error", "--oh-feedback-success"]) {
- const ink = luminance(resolve(role));
- const ratio =
- (Math.max(ink, surface) + 0.05) / (Math.min(ink, surface) + 0.05);
expect(
- ratio,
+ contrast(luminance(resolve(role)), modalSurface),
`${role} against the modal surface`,
).toBeGreaterThanOrEqual(4.5);
}
+
+ const warningInk = luminance(resolve("--oh-feedback-warning"));
+ const trustBackground = channels(resolve("--oh-background"));
+ const warningTint = channels(resolve("--oh-warning"));
+ const tintedTrustSurface = warningTint.map(
+ (channel, index) => channel * 0.05 + trustBackground[index] * 0.95,
+ );
+ const warningSurfaces: Array<[string, number]> = [
+ ["ACP credential surface", modalSurface],
+ ["Home raised banner", luminance(resolve("--oh-surface-raised"))],
+ ["Apps trust notice tint", luminance(tintedTrustSurface)],
+ ];
+
+ for (const [surfaceName, surface] of warningSurfaces) {
+ expect(
+ contrast(warningInk, surface),
+ `--oh-feedback-warning against ${surfaceName}`,
+ ).toBeGreaterThanOrEqual(4.5);
+ }
},
);
@@ -74,10 +104,12 @@ describe("color themes", () => {
expect(style.getPropertyValue("--oh-radius")).toBe("12px");
});
// @spec MCP-004 — Form feedback follows readable theme text roles
+ // @spec WN-001 — Warning feedback can be overridden by an embedding host
it("preserves host feedback colors when the selected palette changes", () => {
const overrides = {
"--oh-feedback-error": "#672727",
"--oh-feedback-success": "#24542d",
+ "--oh-feedback-warning": "#755300",
} as const;
render(
<AgentServerUIRoot
diff --git a/specs/warning-feedback.md b/specs/warning-feedback.md
new file mode 100644
index 0000000000..41d4c3c483
--- /dev/null
+++ b/specs/warning-feedback.md
@@ -0,0 +1,10 @@
+# WN-001 — Readable warning feedback
+
+**Spec ID:** WN-001
+**Status:** Implemented
+
+Small warning text and warning icons use the `feedback-warning` text role, backed by `--oh-feedback-warning`. The built-in role meets 4.5:1 on the theme surfaces used by the Home no-LLM banner, Canvas Apps trust notice, ACP conflict messages, and required-secret onboarding warning. Light+ and Solarized Light use darker text shades while retaining the existing brand warning color for controls and tint.
+
+Embedding roots may override the role. The UI follows the nearest `[data-agent-server-ui]` scope. Changing the role does not change warning copy, validation, routing, credential state, or trust controls.
+
+Real browser coverage verifies the Home icon and Apps trust notice follow the host override. The theme contract checks every built-in palette.
diff --git a/src/components/features/home/llm-not-configured-banner.tsx b/src/components/features/home/llm-not-configured-banner.tsx
index bbd413a801..aac943ffec 100644
--- a/src/components/features/home/llm-not-configured-banner.tsx
+++ b/src/components/features/home/llm-not-configured-banner.tsx
@@ -17,6 +17,7 @@ import { getLockedCloudHost } from "#/api/agent-server-config";
* configured; the settings query refetches after a key is saved, so the banner
* unmounts on its own.
*/
+// @spec WN-001 — Home no-LLM warning icon uses theme-aware warning feedback
export function LlmNotConfiguredBanner() {
const { t } = useTranslation("openhands");
const { navigate } = useNavigation();
@@ -34,7 +35,7 @@ export function LlmNotConfiguredBanner() {
>
<div className="flex min-w-0 items-start sm:items-center">
<div className="flex-shrink-0">
- <FaTriangleExclamation className="align-middle text-yellow-400" />
+ <FaTriangleExclamation className="align-middle text-feedback-warning" />
</div>
<Typography.Text className="ml-3 text-sm font-medium">
{t(I18nKey.HOME$LLM_NOT_CONFIGURED_MESSAGE)}
diff --git a/src/components/features/onboarding/steps/setup-acp-secrets-step.tsx b/src/components/features/onboarding/steps/setup-acp-secrets-step.tsx
index 7f8dbb1f76..266a3935f7 100644
--- a/src/components/features/onboarding/steps/setup-acp-secrets-step.tsx
+++ b/src/components/features/onboarding/steps/setup-acp-secrets-step.tsx
@@ -55,6 +55,7 @@ interface SetupAcpSecretsStepProps {
* already exists shows an "already saved" placeholder and is left untouched
* unless the user types a replacement.
*/
+// @spec WN-001 — Required-secret warning uses theme-aware warning feedback
export function SetupAcpSecretsStep({
providerKey,
isActive,
@@ -195,7 +196,7 @@ export function SetupAcpSecretsStep({
{blockNext ? (
<p
data-testid="onboarding-acp-secrets-blocked"
- className="text-sm text-amber-300"
+ className="text-sm text-feedback-warning"
>
{t(I18nKey.ONBOARDING$ACP_SECRETS_REQUIRED_BLOCKED)}
</p>
diff --git a/src/components/features/settings/acp-conflict-warnings.tsx b/src/components/features/settings/acp-conflict-warnings.tsx
index d90e03c382..83ef2f9e86 100644
--- a/src/components/features/settings/acp-conflict-warnings.tsx
+++ b/src/components/features/settings/acp-conflict-warnings.tsx
@@ -7,6 +7,7 @@ import { I18nKey } from "#/i18n/declaration";
* ``getAcpCredentialConflicts``). Rendered identically by the onboarding
* credentials step and the Settings → Agent credentials section.
*/
+// @spec WN-001 — Credential conflict warnings use theme-aware warning feedback
export function AcpConflictWarnings({
conflicts,
}: {
@@ -20,7 +21,7 @@ export function AcpConflictWarnings({
<p
key={`${credential}:${conflicting}`}
data-testid="acp-credential-conflict-warning"
- className="text-sm text-amber-300"
+ className="text-sm text-feedback-warning"
>
{t(I18nKey.SETTINGS$ACP_CREDENTIAL_CONFLICT_WARNING, {
credential,
diff --git a/src/routes/canvas-extensions.tsx b/src/routes/canvas-extensions.tsx
index f80761b877..37b9e92ade 100644
--- a/src/routes/canvas-extensions.tsx
+++ b/src/routes/canvas-extensions.tsx
@@ -38,6 +38,7 @@ type PendingAction =
const CANVAS_EXTENSIONS_DOCS_URL =
"https://docs.openhands.dev/openhands/usage/agent-canvas/canvas-extensions";
+// @spec WN-001 — Apps trust notice uses theme-aware warning feedback
export default function CanvasExtensionsScreen() {
const { t } = useTranslation("openhands");
const { backend } = useActiveBackend();
@@ -125,7 +126,7 @@ export default function CanvasExtensionsScreen() {
</BrandButton>
</div>
- <div className="rounded-xl border border-amber-400/30 bg-amber-400/5 px-4 py-3 text-sm text-amber-100">
+ <div className="rounded-xl border border-warning/30 bg-warning/5 px-4 py-3 text-sm text-feedback-warning">
{t(I18nKey.SETTINGS$APPS_TRUST_NOTICE)}
</div>
diff --git a/src/styles/agent-server-ui-style-scope.ts b/src/styles/agent-server-ui-style-scope.ts
index 343b02a512..742fdec590 100644
--- a/src/styles/agent-server-ui-style-scope.ts
+++ b/src/styles/agent-server-ui-style-scope.ts
@@ -63,6 +63,8 @@ export const AGENT_SERVER_UI_DEFAULT_CSS_VARIABLES = {
"--oh-success": "#a5e75e",
"--oh-success-foreground": "var(--cool-grey-950)",
"--oh-warning-foreground": "var(--cool-grey-950)",
+ // @spec WN-001 — Embedded roots can override warning text color
+ "--oh-feedback-warning": "#c9b974",
"--oh-danger": "#e76a5e",
"--oh-danger-foreground": "var(--cool-grey-50)",
"--oh-segment": "var(--cool-grey-925)",
diff --git a/src/tailwind.css b/src/tailwind.css
index e162e4d3fb..7f9af96b34 100644
--- a/src/tailwind.css
+++ b/src/tailwind.css
@@ -21,6 +21,8 @@
/* @spec MCP-004 — Form feedback follows readable theme text roles */
--color-feedback-error: var(--oh-feedback-error);
--color-feedback-success: var(--oh-feedback-success);
+ /* @spec WN-001 — Warning text has a separate readable theme role */
+ --color-feedback-warning: var(--oh-feedback-warning);
--color-basic: var(--oh-color-basic);
--color-tertiary: var(--oh-color-tertiary);
--color-tertiary-light: var(--oh-color-tertiary-light);
@@ -128,6 +130,8 @@
--oh-success-foreground: var(--cool-grey-950);
--oh-warning: #c9b974;
--oh-warning-foreground: var(--cool-grey-950);
+ /* @spec WN-001 — Default warning text stays distinct from warning controls */
+ --oh-feedback-warning: #c9b974;
--oh-danger: #e76a5e;
--oh-danger-foreground: var(--cool-grey-50);
--oh-segment: var(--cool-grey-925);
diff --git a/src/themes/README.md b/src/themes/README.md
index e78fe7c5ad..05f73727ee 100644
--- a/src/themes/README.md
+++ b/src/themes/README.md
@@ -37,10 +37,11 @@ them; changing the page background alone is not a complete theme.
high-emphasis ink (white in dark palettes, dark in light palettes); its
paired `contrast-foreground` is for inverse pills and tooltips. Opacity and
state variants such as `hover:bg-contrast/10` retain their stated values.
-- Use `feedback-error` and `feedback-success` for small validation and connection
- messages. These text roles meet 4.5:1 on the built-in modal surface and leave
- the general danger/success control colors unchanged. Embedded hosts can
- override `--oh-feedback-error` and `--oh-feedback-success` for their surfaces.
+- Use `feedback-error`, `feedback-success`, and `feedback-warning` for small
+ validation, connection, and warning messages. These text roles meet 4.5:1 on
+ the built-in modal surface and leave the general danger/success/warning control
+ colors unchanged. Embedded hosts can override `--oh-feedback-error`,
+ `--oh-feedback-success`, and `--oh-feedback-warning` for their surfaces.
- Literal white is reserved for fixed-color surfaces (for example the blue
Plan control, an image-lightbox scrim, or a document preview). Do not globally
redefine white or add theme-specific selectors that reinterpret utilities.
diff --git a/src/themes/color-theme/definitions/light-plus.ts b/src/themes/color-theme/definitions/light-plus.ts
index 75f75c3b58..44735c8d59 100644
--- a/src/themes/color-theme/definitions/light-plus.ts
+++ b/src/themes/color-theme/definitions/light-plus.ts
@@ -65,6 +65,8 @@ export const LIGHT_PLUS_TOKENS: Partial<
// Feedback text must remain readable on the light modal surface.
"--oh-feedback-error": "#C0282D",
"--oh-feedback-success": "#0F734D",
+ // @spec WN-001 — Darker warning text preserves contrast on light surfaces
+ "--oh-feedback-warning": "#7D5D08",
"--oh-color-basic": "#616161",
"--oh-color-tertiary": "#E5E5E5",
"--oh-color-tertiary-light": "#4D4D4D",
diff --git a/src/themes/color-theme/definitions/solarized-light.ts b/src/themes/color-theme/definitions/solarized-light.ts
index cbbc3ea52b..8a8e3acf3a 100644
--- a/src/themes/color-theme/definitions/solarized-light.ts
+++ b/src/themes/color-theme/definitions/solarized-light.ts
@@ -67,6 +67,8 @@ const SOLARIZED_LIGHT_TOKENS: Partial<
"--oh-color-success": "#859900",
"--oh-feedback-error": "#BB2A26",
"--oh-feedback-success": "#5D6A00",
+ // @spec WN-001 — Darker warning text preserves contrast on Solarized surfaces
+ "--oh-feedback-warning": "#735400",
"--oh-color-basic": "#839496",
"--oh-color-tertiary": "#E6DFCC",
"--oh-color-tertiary-light": "#657B83",
diff --git a/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts b/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
index 1fc8a82256..b432538107 100644
--- a/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
+++ b/tests/e2e/mock-llm/regressions/mock-llm-ui-regressions.spec.ts
@@ -651,4 +651,44 @@ test.describe("UI regressions", () => {
await expect(dropdown).toBeEnabled({ timeout: 15_000 });
await expect(dropdown).toHaveValue("");
});
+ // @spec WN-001 — Home warning icon follows the embedding host warning role
+ test("home warning icon follows the host warning color", async ({ page }) => {
+ await routeSessionApiKey(page);
+ await page.goto("/", { waitUntil: "domcontentloaded" });
+ await expect(
+ page.getByTestId("home-llm-not-configured-banner"),
+ ).toBeVisible();
+ const icon = page
+ .getByTestId("home-llm-not-configured-banner")
+ .locator("svg")
+ .first();
+ await icon.evaluate((element) => {
+ const scope = element.closest("[data-agent-server-ui]");
+ if (!scope) throw new Error("Agent Server UI theme scope not found");
+ (scope as HTMLElement).style.setProperty(
+ "--oh-feedback-warning",
+ "#8b1029",
+ );
+ });
+ await expect(icon).toHaveCSS("color", "rgb(139, 16, 41)");
+ });
+
+ // @spec WN-001 — Canvas Apps trust notice follows the host warning role
+ test("Apps trust notice follows the host warning color", async ({ page }) => {
+ await routeSessionApiKey(page);
+ await page.goto("/apps", { waitUntil: "domcontentloaded" });
+ const notice = page.getByText("This app runs trusted JavaScript", {
+ exact: false,
+ });
+ await expect(notice).toBeVisible();
+ await notice.evaluate((element) => {
+ const scope = element.closest("[data-agent-server-ui]");
+ if (!scope) throw new Error("Agent Server UI theme scope not found");
+ (scope as HTMLElement).style.setProperty(
+ "--oh-feedback-warning",
+ "#8b1029",
+ );
+ });
+ await expect(notice).toHaveCSS("color", "rgb(139, 16, 41)");
+ });
});