Skip to content

fix: match inline code chips to the chat theme - #2307

Merged
paulcam206 merged 2 commits into
openclaw:mainfrom
paulcam206:paulcam206-default-inline-code-contrast
Nov 18, 2026
Merged

paulcam206 merged 2 commits into
openclaw:mainfrom
paulcam206:paulcam206-default-inline-code-contrast

Conversation

@paulcam206

@paulcam206 paulcam206 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

In Windows-default chat, an inline code chip can use the wrong background when chat and the app use opposite light and dark modes. This makes the code harder to read, especially when dark chat gets a light chip.

User Impact

User impact: Inline code in Windows-default chat uses the background for the theme the chat is actually displaying.

Why This Change Was Made

The chip now resolves the native Fluent color in the rendered chat element's theme instead of using an application-wide brush. It keeps the same Fluent token and still leaves styling to Windows in High Contrast.

Evidence

The new test mounts real assistant Markdown underneath a theme override and checks the fill of the exact inline-code range against a native XAML theme resource. Both app/chat pairings failed on 212fac114f6fd547fee43e81d1bfdae4b8b4845a; both pass with the fix.

App / chat Before After
Light / Dark Dark chat before: white code on a pale chip Dark chat after: white code on a subtle dark-theme chip
Dark / Light Light chat before: chip uses the dark-theme fill Light chat after: the chip uses the light-theme fill

Actual Companion, not the test window. On an owned Windows 11 x64 desktop, Windows' app mode was Light and the isolated Companion profile requested Dark. The repository's loopback fixture (chat-interactive, nested-tools) returned a synthetic reply with inline code 6f37c2d82. UI Automation confirmed that exact text was on screen before capture. The dark chip is visible around it below. The foreground was not changed. No provider or host command ran.

Real Companion window in Dark on Light Windows, showing the corrected dark chip around 6f37c2d82

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-winui-interactive: mounted assistant Markdown appearance in both opposite-theme pairings.

Validation

  • ./build.ps1: all five Debug win-x64 projects built.
  • dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-x64 --no-restore: passed; the transferred test and production assembly hashes matched on the guest.
  • dotnet vstest OpenClaw.Tray.UITests.dll /TestCaseFilter:FullyQualifiedName~InlineCodeChip_FollowsTheChatThemeRatherThanTheApplicationTheme: red before (1 failed per pairing at the expected color assertion), green after (1 passed per pairing, 0 skipped).
  • dotnet vstest OpenClaw.Tray.UITests.dll /TestCaseFilter:FullyQualifiedName~ReactorMarkdown: 8 passed, 0 failed or skipped.
  • ./scripts/validate-docs.ps1: 74 files and the proof-pool documentation gate passed; git diff --check: clean.
  • dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore: 5,906 passed, 29 environment/opt-in skips, 0 failed on the final serial run.
  • dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore: 6,755 passed, 0 failed or skipped on the provisioned guest.

Local ClawSweeper review --local-range completed on this head against 212fac114f6fd547fee43e81d1bfdae4b8b4845a: no code findings, security cleared. Its offline report asked for candidate runtime and managed results, not a code revision. Independent P0–P3 review found no actionable defect. The two questions raised by the WinUI rubber-duck review were covered on the guest: the negative control failed in both app themes, and the screenshots show foreground is unchanged.

Initial hosted UI job read the chip before the deferred restyle completed. The test now waits for the same independent color assertion, not just for ActualTheme and an existing highlighter. No expected value or timeout changed. The ReactorMarkdown filter then passed 8/8 in each of two fresh processes (OPENCLAW_UI_TEST_APP_THEME=Light and Dark). The full build was repeated; Shared and Tray code/tests did not change. Current-head CI.

Real Behavior Proof

  • Environment tested: Windows 11 x64 (build 29683), disposable Hyper-V guest, interactive WinUI test window, synthetic message and app-scoped test profile.
  • PR head or commit tested: 0958f001e9f24288bf59986fcc1b0e24218e9295 for the updated mounted regression. Full Companion capture uses the product build from 70842ad3dd0ca7ceec9a4e82c6b722c9cf538ccf; only the test file changed between heads.
  • Exact steps or command run: Run the focused WinUI command under Validation in a fresh test process with OPENCLAW_UI_TEST_APP_THEME=Light, and again with Dark. The test mounts Markdown under the opposite element theme.
  • Evidence after fix: The two right-hand test crops show the fixed renderer. The separate Companion window capture shows the current production code with synthetic Gateway data.
  • Observed result: App Light/chat Dark: #80F9F9F9 corrected to #15FFFFFF. App Dark/chat Light: #15FFFFFF corrected to #80F9F9F9. The adjacent Markdown test still clears and restores highlighters on the existing High Contrast test probe.
  • Screenshot or artifact links verified? All four comparison crops were fetched successfully from GitHub; the Companion capture was inspected locally and will be checked after upload.
  • Not verified or blocked: The Companion capture used a synthetic Gateway, not a live provider or pairing path. The High Contrast probe is not an OS contrast-mode toggle.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation:

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? No
  • Migration needed? No
  • If yes, list the exact upgrade steps:

Review Conversations

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

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦞👀
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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

Inline-code backgrounds now follow the displayed chat theme when it differs from the application theme.

Example: The application uses Light mode while chat uses Dark mode and displays openclaw status.

  • Before: The code has a pale chip using #80F9F9F9.
  • After: The code has the dark-theme chip using #15FFFFFF.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A narrow, correct repair supported by visible application proof, independent mounted regression coverage, and passing current-head CI.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected comparison images demonstrate both opposite-theme corrections, and the actual Windows 11 Companion capture shows the corrected dark chip through the shipped chat UI with synthetic Gateway data; the subsequent commit changes only test synchronization.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Inline code can have a hard-to-read background when chat and application light/dark modes differ.
Reason: This maintainer-authored repair restores documented theme behavior without adding settings, owners, or public contracts.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current theme mismatch with a focused change and no actionable findings; keep it open for landing once its draft status is resolved.

Priority: P2
Reviewed head: 0958f001e9f24288bf59986fcc1b0e24218e9295

Before merge

None.

Findings

None.

Agent review details

How this fits together

The native Markdown presentation layer takes rendered assistant text and applies theme-aware text highlighters while preserving Reactor's text, selection, and sanitization ownership.

flowchart LR
  A[Assistant Markdown] --> B[Safe timeline renderer]
  B --> C[Mounted native text]
  C --> D[Inline presentation]
  E[Chat element theme] --> D
  D --> F[Theme matched code chip]
Loading

Technical review

Best possible solution:

Land the existing theme-color lookup repair and its mounted regression while preserving foreground styling and the High Contrast bypass.

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

Current main retains the application-brush lookup responsible for the mismatch; the supplied negative controls and inspected before/after images cover both opposite-theme pairings.

Is this the best way to solve the issue?

The patch is the smallest complete repair: reuse the existing theme-color resolver inside the current presentation owner and retain one native regression against an independent XAML resource.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0d74aee5f723.

Provenance checked

  • Inline-code background and Markdown presentation keeps the original intent (a6ff6a1: Preserve Windows theme backgrounds while improving native Markdown spacing, tones, and code presentation.)
  • Chat visual contract wording keeps the original intent (243f9cf: Document native inline-code backgrounds and system-controlled High Contrast styling.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Focused fix still needed on main: The pinned diff replaces the application brush lookup with the existing element-theme color resolver; fetched main still uses ControlFillColorSecondaryBrush. (src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs:238, 0958f001e9f2)
  • Independent mounted regression: The added test mounts production Markdown under the opposite theme and compares the exact code range against a native XAML ThemeResource; its condition wait observes the final color without weakening the assertion. (tests/OpenClaw.Tray.UITests/ReactorMarkdownWebParityProofTests.cs:246, 0958f001e9f2)
  • Visual proof inspected: All four downloaded before/after crops show the corrected chip in both opposite-theme pairings. The full Companion capture visibly shows the dark chip around 6f37c2d using synthetic Gateway data. Its production code is unchanged between the captured revision and current head. Scratch writes were rejected as read-only, so the additional image was inspected directly from the authenticated response. (src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs:238, 0958f001e9f2)
  • Current-head validation and draft state: REST confirms this PR remains a draft with a clean mergeable state; current-head CI Gate, UI suites, changed-test soak, and fixture checks succeeded. No builds or tests were executed during this read-only review. (0958f001e9f2)
  • Original intent and feature ownership: History and the earlier Markdown presentation PR establish theme-aware code backgrounds and High Contrast preservation as intended behavior, with bkudiess carrying the feature and subsequent refinements. Deeper local history searches encountered unavailable promisor objects; the relevant changed-line provenance and recent ownership were independently available. (src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs:221, 0d74aee5f723)

Likely related people:

  • Barbara Kudiess: Raw commit a6ff6a1 adds src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs:207 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a6ff6a164b20; files: src/OpenClaw.Tray.WinUI/Chat/ChatMarkdownPresentation.cs)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Focused change size Production +7/-2; tests +61/-0; documentation +3/-2 The larger test delta supplies a distinct native rendering regression with an independent theme-resource oracle and reuses existing fixtures.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: The wrong chip background reduces inline-code readability in opposite-theme configurations without blocking chat.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-18T03:25:01.998Z sha 70842ad :: needs maintainer review before merge. :: none

Reviewed November 18, 2026, 1:26 PM ET / 18:26 UTC (Revision 2).

@paulcam206

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Nov 18, 2026
@paulcam206
paulcam206 marked this pull request as ready for review November 18, 2026 18:47
@paulcam206
paulcam206 merged commit 30cfe59 into openclaw:main Nov 18, 2026
60 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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