Skip to content

SvgImageSource diagnostics for Windows Companion nav-icon blank-out repro#576

Draft
RBrid wants to merge 1 commit into
openclaw:mainfrom
RBrid:user/rbrid/SvgImageSourceDiagnostics2
Draft

SvgImageSource diagnostics for Windows Companion nav-icon blank-out repro#576
RBrid wants to merge 1 commit into
openclaw:mainfrom
RBrid:user/rbrid/SvgImageSourceDiagnostics2

Conversation

@RBrid

@RBrid RBrid commented May 28, 2026

Copy link
Copy Markdown
Contributor

Adds passive, logging-only diagnostics to investigate report of WinUI 3 NavigationView SVG icons going blank after long uptime while FontIcons continue to render. No behavior change.

Bug occurrence screenshot:
image

Strategy (event-driven, no false-positive heuristics):

  • Subscribe to SvgImageSource.Opened/OpenFailed on all 20 sidebar icon resources at HubWindow construction; track which keys have ever opened.
  • Sanity-check on NavView.Loaded, XamlRoot.Changed, ActualThemeChanged, and a 60s repeating DispatcherQueue timer; warn when a NavigationView ImageIcon still references a tracked SvgImageSource that never saw Opened.
  • Capture correlation signals via Windows.System.MemoryManager (AppMemoryUsageIncreased / AppMemoryUsageLimitChanging) and snapshot uptime/handles/working-set/memory level on each warning.
  • Cap warnings at 50/session; defensive global-miss guard logs once if zero of N tracked sources ever opened (suggests handler attach raced decode) instead of burning the cap with per-icon noise.
  • Skip entirely when high-contrast fallback swaps SVGs for FontIcons.
  • TeardownSvgDiagnostics() in Closed handler stops the timer and unhooks static MemoryManager events to avoid window leaks across the App.xaml.cs open/close cycle.

Reviewed via three rounds of dual-model adversarial review (Claude Opus 4.6 + GPT-5.2-Codex):

  • r1: replaced incorrect RasterizePixelWidth/Height heuristic (input property, not decode output) with event-driven Opened tracking; added TeardownSvgDiagnostics() to plug static MemoryManager leak; try/catch hardened OnAppMemoryUsageLimitChanging.
  • r2: disposed Process.GetCurrentProcess handle; added defensive guard for hypothetical Opened-before-attach race.
  • r3: clean.

Validation: ./build.ps1, Shared 2023/29 skipped, Tray 862/0.

Adds passive, logging-only diagnostics to investigate Scott's report of
WinUI 3 NavigationView SVG icons going blank after long uptime while
FontIcons continue to render. No behavior change.

Strategy (event-driven, no false-positive heuristics):
- Subscribe to SvgImageSource.Opened/OpenFailed on all 20 sidebar icon
  resources at HubWindow construction; track which keys have ever opened.
- Sanity-check on NavView.Loaded, XamlRoot.Changed, ActualThemeChanged,
  and a 60s repeating DispatcherQueue timer; warn when a NavigationView
  ImageIcon still references a tracked SvgImageSource that never saw
  Opened.
- Capture correlation signals via Windows.System.MemoryManager
  (AppMemoryUsageIncreased / AppMemoryUsageLimitChanging) and snapshot
  uptime/handles/working-set/memory level on each warning.
- Cap warnings at 50/session; defensive global-miss guard logs once if
  zero of N tracked sources ever opened (suggests handler attach raced
  decode) instead of burning the cap with per-icon noise.
- Skip entirely when high-contrast fallback swaps SVGs for FontIcons.
- TeardownSvgDiagnostics() in Closed handler stops the timer and
  unhooks static MemoryManager events to avoid window leaks across the
  App.xaml.cs open/close cycle.

Reviewed via three rounds of dual-model adversarial review (Claude
Opus 4.6 + GPT-5.2-Codex):
- r1: replaced incorrect RasterizePixelWidth/Height heuristic
  (input property, not decode output) with event-driven Opened
  tracking; added TeardownSvgDiagnostics() to plug static MemoryManager
  leak; try/catch hardened OnAppMemoryUsageLimitChanging.
- r2: disposed Process.GetCurrentProcess handle; added defensive guard
  for hypothetical Opened-before-attach race.
- r3: clean.

Validation: ./build.ps1, Shared 2023/29 skipped, Tray 862/0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clawsweeper

clawsweeper Bot commented May 28, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed June 4, 2026, 7:32 PM ET / 23:32 UTC.

Summary
The PR adds passive WinUI HubWindow SvgImageSource diagnostics and wires initialization/teardown into HubWindow construction and close handling.

Reproducibility: no. The underlying blank-icon condition is a long-uptime Windows UI failure, and the available evidence is the original occurrence screenshot plus source inspection, not a repeatable current-main reproduction or after-change runtime log.

Review metrics: 1 noteworthy metric.

  • Diff surface: 2 files changed, 342 additions, 0 deletions. The PR adds always-on HubWindow lifecycle instrumentation, so initialization and teardown behavior matter more than UI appearance.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted real-run logs, terminal output, or a recording showing SvgDiag initialization plus either a useful warning/correlation log or clean close behavior.
  • [P1] Fix the MemoryManager subscription rollback path so every successful static event subscription is unhooked on close or init failure.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body has an original failure screenshot and validation text, but no after-change logs, terminal output, recording, or redacted runtime artifact from a real Windows Companion run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A real Windows Companion run or recording would materially help prove the diagnostic initialization and teardown path. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: run Windows Companion with this PR and capture redacted SvgDiag initialization plus clean close/reopen teardown logs or warning output.

Risk before merge

  • [P1] No after-change real Windows Companion logs, terminal output, recording, or runtime artifact show that the new SvgDiag path initializes, warns usefully, or tears down cleanly.
  • [P1] The partial MemoryManager subscription path can leave a static handler rooted if one subscription succeeds and a later subscription throws, which is exactly the lifecycle area the PR touches.

Maintainer options:

  1. Make static event rollback explicit (recommended)
    Track the two MemoryManager subscriptions independently or undo the first subscription in the catch before considering the lifecycle instrumentation mergeable.
  2. Pause until proof is added
    Keep the draft open until the contributor adds redacted real Windows Companion output showing the diagnostic path from the changed build.
  3. Accept temporary diagnostic lifecycle risk
    Maintainers could explicitly accept always-on diagnostic instrumentation risk, but that should happen only after deciding the long-uptime blank-icon investigation is worth shipping.

Next step before merge

  • [P1] Contributor proof is still missing and the PR is draft, so a maintainer/contributor loop is needed even though the code defect itself is narrow.

Security
Cleared: The diff adds in-process WinUI diagnostics only and does not change dependencies, workflows, secrets, downloads, package resolution, or external code execution paths.

Review findings

  • [P2] Undo partial MemoryManager hooks on subscription failure — src/OpenClaw.Tray.WinUI/Windows/HubWindow.SvgDiagnostics.cs:136-138
Review details

Best possible solution:

Land only a rollback-safe, passive diagnostics patch with redacted real-run evidence from Windows Companion showing initialization and either useful warning output or clean teardown behavior.

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

No. The underlying blank-icon condition is a long-uptime Windows UI failure, and the available evidence is the original occurrence screenshot plus source inspection, not a repeatable current-main reproduction or after-change runtime log.

Is this the best way to solve the issue?

Unclear as submitted. Passive diagnostics are a plausible investigation path, but the static event rollback issue and missing real-run proof need to be resolved before this is the best merge path.

Full review comments:

  • [P2] Undo partial MemoryManager hooks on subscription failure — src/OpenClaw.Tray.WinUI/Windows/HubWindow.SvgDiagnostics.cs:136-138
    HookMemoryPressureListener subscribes AppMemoryUsageIncreased before AppMemoryUsageLimitChanging, but _memoryManagerHooked is set only after both succeed. If the second subscription throws after the first succeeds, TeardownSvgDiagnostics skips unhooking the first static handler and the closed HubWindow can stay rooted across close/reopen cycles.
    Confidence: 0.78

Overall correctness: patch is incorrect
Overall confidence: 0.78

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 99efc50cbc22.

Label changes

Label justifications:

  • P3: The PR is diagnostic-only support work for a hard-to-reproduce visual issue, not an urgent behavior fix.
  • merge-risk: 🚨 availability: The diff adds static MemoryManager event hooks to a long-lived window lifecycle path, and a partial subscription failure can leak HubWindow instances.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body has an original failure screenshot and validation text, but no after-change logs, terminal output, recording, or redacted runtime artifact from a real Windows Companion run. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

  • Repository policy read: AGENTS.md was read fully; its validation requirements apply after code changes, but this review is explicitly read-only and cannot run artifact-producing build/test commands. (AGENTS.md:1, 99efc50cbc22)
  • Current main lacks SvgDiagnostics: A current-main search for SvgDiagnostics, InitializeSvgDiagnostics, TeardownSvgDiagnostics, MemoryManager, and SvgDiag returned no matches in the WinUI tray source. (99efc50cbc22)
  • PR diagnostic initialization: The proposed InitializeSvgDiagnostics method hooks SVG handlers, MemoryManager listeners, NavView.Loaded, and a repeating DispatcherQueue timer. (src/OpenClaw.Tray.WinUI/Windows/HubWindow.SvgDiagnostics.cs:62, abd36d8fd31f)
  • Lifecycle defect location: HookMemoryPressureListener subscribes AppMemoryUsageIncreased before AppMemoryUsageLimitChanging and sets the single teardown flag only after both subscriptions succeed. (src/OpenClaw.Tray.WinUI/Windows/HubWindow.SvgDiagnostics.cs:136, abd36d8fd31f)
  • PR metadata and proof context: GitHub API shows the PR is open and draft with one commit and two changed files; the body contains validation text and an original failure screenshot but no after-change runtime proof. (abd36d8fd31f)
  • Previous review comment checked: The existing durable ClawSweeper comment already requested real behavior proof and identified the same partial MemoryManager subscription rollback issue, and the current fetched diff still contains that sequence. (src/OpenClaw.Tray.WinUI/Windows/HubWindow.SvgDiagnostics.cs:136, abd36d8fd31f)

Likely related people:

  • shanselman: GitHub path history shows multiple recent HubWindow shell/navigation merges by Scott Hanselman, including merge commits touching the same HubWindow files. (role: introduced behavior and merger; confidence: medium; commits: 8714381248a2, da9800a2905c, 928d3853f6f1; files: src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml, src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml.cs)
  • christineyan4: Local blame in the shallow checkout points the current HubWindow constructor, SVG resource block, and high-contrast fallback lines to the v0.6.3 localization commit authored by Christine Yan. (role: recent area contributor; confidence: medium; commits: 85445c78066b; files: src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml, src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml.cs)
  • kenehong: Commit ea8e93f refined the companion navigation title bar and changed both HubWindow.xaml and HubWindow.xaml.cs near the shell/navigation surface this PR instruments. (role: recent adjacent contributor; confidence: medium; commits: ea8e93fce60f; files: src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml, src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml.cs)
  • ranjeshj: Commit a727197 touched HubWindow.xaml.cs while enforcing warning-clean product builds, which is relevant to new tray WinUI code added by this PR. (role: recent area contributor; confidence: medium; commits: a727197dd709; files: src/OpenClaw.Tray.WinUI/Windows/HubWindow.xaml.cs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels May 28, 2026
@RBrid RBrid marked this pull request as ready for review May 28, 2026 23:23
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. and removed proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels May 28, 2026
@RBrid RBrid marked this pull request as draft June 4, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant