Skip to content

UI: fix chat context notice icon sizing#45533

Merged
BunsDev merged 7 commits intomainfrom
ui/dashboard-v2.1.2
Mar 13, 2026
Merged

UI: fix chat context notice icon sizing#45533
BunsDev merged 7 commits intomainfrom
ui/dashboard-v2.1.2

Conversation

@BunsDev
Copy link
Member

@BunsDev BunsDev commented Mar 13, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: the chat context usage warning rendered an unstyled raw SVG, which could balloon into an oversized icon in the chat view.
  • Why it matters: the warning obscured the chat UI and made the context-usage notice hard to read.
  • What changed: added the missing .context-notice / .context-notice__icon styles and a browser regression test that asserts the icon stays badge-sized.
  • What did NOT change (scope boundary): no chat logic, thresholds, copy, or session data behavior changed.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

None.

User-visible / Behavior Changes

The chat context usage warning now renders as a compact warning pill with a correctly sized icon instead of an oversized triangle covering the chat pane.

Security Impact (required)

  • New permissions/capabilities? (No)
  • Secrets/tokens handling changed? (No)
  • New/changed network calls? (No)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 + pnpm
  • Model/provider: N/A
  • Integration/channel (if any): Control UI chat view
  • Relevant config (redacted): session with inputTokens=3800 and contextTokens=4000

Steps

  1. Open the Control UI chat view.
  2. Render a session whose context usage is at or above the warning threshold.
  3. Observe the context usage warning pill near the composer.

Expected

  • The warning displays as a compact pill with a small icon and readable token totals.

Actual

  • Before this change, the warning icon could render at raw SVG size and dominate the chat view.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Screenshot/recording
  • Trace/log snippets
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: ran the UI in local dev, surfaced the chat context warning in the live app, and confirmed the warning icon rendered at 16px × 16px with the corrected pill layout.
  • Edge cases checked: verified the dedicated browser regression test and the broader pnpm test:ui suite both passed.
  • What you did not verify: additional browser engines beyond the Chromium-based UI test run.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (No)
  • Migration needed? (No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert commit 96e07fe0b.
  • Files/config to restore: ui/src/styles/chat/layout.css, ui/src/ui/views/chat.browser.test.ts
  • Known bad symptoms reviewers should watch for: the context usage warning reappearing as a large unstyled icon or losing its compact pill layout.

Risks and Mitigations

  • Risk: the new notice styles could unintentionally affect spacing around the composer on some viewport sizes.
    • Mitigation: the change is scoped to .context-notice only, and pnpm test:ui plus a live dev verification both passed.

@openclaw-barnacle openclaw-barnacle bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Mar 13, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR adds the missing CSS rules for .context-notice, .context-notice__icon, and .context-notice__detail that caused the chat context usage warning to render as an oversized, unstyled SVG. The CSS fix is sound and consistent with the existing .chat-new-messages pill pattern in the same file. A new Chromium browser regression test is also added, but it contains a display-value mismatch that will cause it to fail on every run.

Key changes:

  • layout.css — adds the three .context-notice* rules; correct, no issues
  • chat.browser.test.ts — new Playwright/Chromium test asserts getComputedStyle(notice).display === "flex", but the CSS sets display: inline-flex; in a real browser getComputedStyle returns "inline-flex", so the assertion fails and the regression guard is never exercised

Confidence Score: 3/5

  • The CSS fix itself is safe to merge; the test has a broken assertion that must be corrected before it can serve as a reliable regression guard.
  • The production CSS change is straightforward and low-risk. However, the accompanying browser regression test will always fail due to asserting "flex" against a display: inline-flex element, meaning CI will either block the merge or the assertion is silently skipped — either way the safety net doesn't work.
  • ui/src/ui/views/chat.browser.test.ts — the display assertion on line 81 needs to be corrected from "flex" to "inline-flex".
Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/ui/views/chat.browser.test.ts
Line: 81

Comment:
**Test assertion will always fail in Chromium**

The `.context-notice` rule uses `display: inline-flex` (see `layout.css` line 153), but the test asserts `display === "flex"`. In a real browser (this test runs on Chromium via Playwright, per `vitest.config.ts`), `getComputedStyle(el).display` returns `"inline-flex"` — never just `"flex"` — so this assertion fails on every run, making the regression guard inoperative.

```suggestion
    expect(noticeStyle.display).toBe("inline-flex");
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: b53dfa9

@BunsDev BunsDev self-assigned this Mar 13, 2026
@BunsDev BunsDev merged commit 4c77c3a into main Mar 13, 2026
11 checks passed
@BunsDev BunsDev deleted the ui/dashboard-v2.1.2 branch March 13, 2026 23:51
frankekn pushed a commit to xinhuagu/openclaw that referenced this pull request Mar 14, 2026
* UI: fix chat context notice icon sizing

* Update ui/src/ui/views/chat.browser.test.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* UI: tighten chat context notice regression test

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
ecochran76 pushed a commit to ecochran76/openclaw that referenced this pull request Mar 14, 2026
* UI: fix chat context notice icon sizing

* Update ui/src/ui/views/chat.browser.test.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* UI: tighten chat context notice regression test

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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 maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant