Skip to content

fix(tray): restore icon after Explorer restart - #1179

Merged
shanselman merged 1 commit into
mainfrom
fix-explorer-tray-recovery
Aug 19, 2026
Merged

shanselman merged 1 commit into
mainfrom
fix-explorer-tray-recovery

Conversation

@shanselman

Copy link
Copy Markdown
Collaborator

Fixes #1176.

Summary

  • bump WinUIEx from 2.9.0 to 2.9.3
  • use WinUIEx's upstream TaskbarCreated recovery so the existing tray icon is re-registered after explorer.exe restarts
  • keep the WinUI-generated WinUIEx.Icon.FromFile obsolete warning visible but non-fatal until the XAML generator stops emitting that legacy type

This preserves the existing TrayController ownership boundary and does not add a parallel shell-recovery implementation.

Validation

Validated on exact commit f960a908 on Windows x64:

  • ./build.ps1 passed: Shared, CLI, WinNodeCli, SetupEngine, and WinUI
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore passed: 3,698 passed, 32 skipped, 0 failed
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore passed: 2,619 passed, 0 skipped, 0 failed
  • focused code review found no significant issues
  • git diff --check passed

Real behavior proof

Current-head native Windows proof exercised the real taskbar shell:

  1. launched the exact built OpenClaw.Tray.WinUI.exe
  2. verified the taskbar accessibility tree exposed an enabled OpenClaw Tray notification icon
  3. recorded the app PID and Explorer shell PID
  4. forcibly restarted that exact Explorer shell process
  5. verified the same OpenClaw process remained alive
  6. inspected the replacement taskbar and verified an enabled OpenClaw Tray notification icon was present again

Observed proof:

BEFORE shell=104516 app=101864 icon=visible
AFTER  shell=106720 app=101864 icon=visible

Local proof artifacts include before/after taskbar Live Visual Tree dumps and screenshots from the exact fixed build.

Risk

Low. The behavior change is isolated to a patch-level dependency update whose release notes specifically identify the Explorer restart tray-icon fix. The only additional project setting downgrades CS0618 from error to warning because WinUI-generated XamlTypeInfo.g.cs references WinUIEx's now-obsolete Icon.FromFile API.

Bump WinUIEx to the release that re-registers TrayIcon on TaskbarCreated. Keep CS0618 visible but non-fatal because WinUI's generated XamlTypeInfo still references WinUIEx.Icon.FromFile.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: ea6ca262-e24c-4a46-99c1-1a7b59b24943
@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@shanselman

Copy link
Copy Markdown
Collaborator Author

@clawsweeper automerge

@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper automerge is enabled.

  • Head: f960a908da8b
  • Label: clawsweeper:automerge
  • Action: exact-head review queued (workflow sweep.yml, event repository_dispatch).
  • Flow: review this head, repair/rebase only if needed, then re-review the exact repaired head before merge.

Draft PRs stay fix-only until GitHub marks them ready for review. Pause with /clawsweeper stop.

Automerge progress:

  • 2026-08-19 19:35:39 UTC review queued f960a908da8b (queued)

Re-review progress:

@shanselman shanselman added status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. and removed status: ?? actively landing labels Aug 19, 2026
@clawsweeper clawsweeper Bot added clawsweeper:automerge Maintainer opted this ClawSweeper PR into bounded ClawSweeper-reviewed automerge merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane. labels Aug 19, 2026
@clawsweeper

clawsweeper Bot commented Aug 19, 2026 •

Copy link
Copy Markdown

Codex review: passed. Reviewed August 19, 2026, 3:42 PM ET / 19:42 UTC.

ClawSweeper review

What this changes

Updates the WinUI tray project from WinUIEx 2.9.0 to 2.9.3 and makes CS0618 non-fatal because generated XAML still calls the library’s legacy icon API.

Regression provenance

Possible regression — probable (reproduction; reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. This active collaborator PR is the focused candidate fix for the linked Explorer-restart tray failure; current main still uses WinUIEx 2.9.0, while the PR raises it to 2.9.3 with direct native Windows after-fix proof.

Priority: P1
Reviewed head: f960a908da8b56f974a01b7277ca4844a1ab9c6c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused with convincing native-shell proof; routine exact-head CI remains the appropriate merge gate for the dependency update.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides current-head native Windows before/after output that directly shows the same process and restored tray icon following an Explorer restart.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides current-head native Windows before/after output that directly shows the same process and restored tray icon following an Explorer restart.
Evidence reviewed 5 items Current main lacks the proposed dependency update: Current main declares WinUIEx 2.9.0; the PR head changes that direct dependency to 2.9.3.
Focused PR scope: The exact comparison changes one project file, with three additions and one deletion: a package patch update and the documented warning exception.
Existing tray ownership boundary: TrayController creates the one TrayIcon, marks it visible, and owns icon refresh and event lifetime, matching the PR’s stated non-duplication boundary.
Findings None None.
Security None None.

How this fits together

The WinUI tray app owns one notification icon through TrayController and WinUIEx. When Explorer recreates the taskbar, the library must restore that icon so the still-running OpenClaw process remains reachable.

flowchart LR
A[OpenClaw tray process] --> B[Tray controller]
B --> C[WinUIEx notification icon]
D[Explorer restart] --> E[Taskbar recreated event]
E --> C
C --> F[Visible OpenClaw tray controls]
Loading

Before merge

  • Resolve merge risk (P1) - WinUIEx 2.9.3 changes the library behind the tray lifecycle for existing users, so the in-progress exact-head suite remains required before merge.
  • Resolve merge risk (P1) - The CS0618 exception applies to the whole tray project, so future obsolete API uses there will warn rather than fail the build.
  • Complete next step (P2) - This active collaborator PR is already automerge opted-in with sufficient native proof, so it needs exact-head check completion rather than a repair worker.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Project-file scope 1 file changed, production +3, tests +0 The patch is limited to the existing tray project’s dependency declaration and compiler-warning treatment.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1176
Summary: This PR is the explicit candidate fix for the Explorer-restart tray-icon report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the documented warning tradeoff (recommended)
    Merge after exact-head checks pass, accepting that CS0618 remains visible but non-fatal while generated XAML references the obsolete upstream type.
  2. Require a narrower warning mechanism
    Pause the dependency update until warning handling can be limited to the generated source without weakening the tray project’s normal obsolete-API gate.

Technical review

Best possible solution:

Adopt the upstream taskbar-recovery behavior through the existing TrayController boundary once exact-head CI completes successfully.

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

Yes. The PR provides a current-head native Windows path that restarts Explorer, preserves the app PID, and observes the tray icon again in the replacement taskbar.

Is this the best way to solve the issue?

Yes. The direct dependency signal in the tray project and existing TrayController ownership make the upstream recovery update narrower than adding a parallel local shell handler.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b37307cbd51f.

Labels

Label justifications:

  • P1: Explorer restart can leave a still-running app without its normal tray entry point.
  • merge-risk: 🚨 compatibility: The PR changes the direct library responsible for notification-icon behavior across existing tray installations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 🚀 automerge armed: This PR is in ClawSweeper's automerge lane. Sufficient (live_output): The PR body provides current-head native Windows before/after output that directly shows the same process and restored tray icon following an Explorer restart.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides current-head native Windows before/after output that directly shows the same process and restored tray icon following an Explorer restart.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Introduced the current TrayController ownership seam used by the existing notification-icon lifecycle. (role: recent tray-surface contributor; confidence: high; commits: 3a097bc85f7b; files: src/OpenClaw.Tray.WinUI/Services/TrayController.cs)
  • Scott Hanselman: Recent current-main history owns the tray project dependency surface, and this collaborator-authored PR changes that same surface. (role: recent tray-project contributor; confidence: high; commits: 4206611f2b2e; files: src/OpenClaw.Tray.WinUI/OpenClaw.Tray.WinUI.csproj)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Allow the in-progress required checks to complete successfully on the exact PR head before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-19T19:38:07.759Z sha f960a90 :: passed. :: none

@shanselman
shanselman merged commit 12b8445 into main Aug 19, 2026
24 of 25 checks passed
@shanselman
shanselman deleted the fix-explorer-tray-recovery branch August 19, 2026 20:01
@shanselman shanselman removed status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. clawsweeper:automerge Maintainer opted this ClawSweeper PR into bounded ClawSweeper-reviewed automerge status: 🚀 automerge armed This PR is in ClawSweeper's automerge lane. labels Aug 19, 2026
@clawsweeper clawsweeper Bot mentioned this pull request Oct 28, 2026
2 of 16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Restarting explorer.exe removes the tray icon

1 participant