Skip to content

Fix Start menu activation for running tray app - #1262

Merged
shanselman merged 1 commit into
mainfrom
shanselman-fix-start-menu-activation
Aug 28, 2026
Merged

shanselman merged 1 commit into
mainfrom
shanselman-fix-start-menu-activation

Conversation

@shanselman

Copy link
Copy Markdown
Collaborator

Summary

  • Route a no-argument secondary launch through the existing current-user ActivationRouter pipe as the default Hub route.
  • Keep explicit protocol, command-line, and post-setup activation precedence unchanged, while unknown arguments remain ignored.
  • Retry the existing IPC boundary for a bounded startup-listener race without adding another IPC mechanism or window owner.
  • Preserve WindowManager.ShowHub as the authoritative restore and foreground path.

Fixes #1218

Validation

  • ./build.ps1: passed, including documentation validation and all product builds.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: passed, 3819 passed, 32 skipped, 0 failed.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore --filter FullyQualifiedName~ActivationRouterTests: passed, 36 passed, 0 failed.
  • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore: passed, 1010 passed, 0 failed.
  • python .agents/skills/autoreview/scripts/autoreview --mode local --stream-engine-output: clean, no accepted or actionable findings.
  • Rubber-duck review found that the first retry test did not force an initial pipe timeout. The test now starts the listener after 1200 ms, proving the production retry path after the first 1000 ms connect attempt fails.
  • Full dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore was attempted twice but did not complete after more than 10 minutes. The stale testhost was stopped. This is the known unrelated native host hang in IPGlobalProperties-backed BrowserProxy coverage; focused activation tests are green.

Real behavior proof

Current-head commit 473e7645 was built and launched with ./run-app-local.ps1 -NoBuild -Isolated -AllowNonMain on native Windows.

  1. Opened the Hub, then closed it to the running tray process.
  2. Confirmed no OpenClaw window remained visible while current-head PID 33272 stayed alive.
  3. Started the same current-head executable again with no arguments and the same isolated tray data directory.
  4. The existing process restored a visible OpenClaw Companion window with HWND 395906114 on the Connection page.
  5. Process inspection reported MatchingCurrentHeadProcesses=1 and SecondaryHelperProcesses=0, confirming the secondary process exited and no duplicate long-lived tray instance remained.
  6. Isolated runtime log recorded:
[2026-08-28 01:41:09.627] [INFO] Received deep link via IPC: openclaw://<host>/
[2026-08-28 01:41:09.631] [INFO] Handling deep link: openclaw://<host>/

Computer-use accessibility inspection confirmed the restored native window title OpenClaw Companion, the OpenClaw Windows Companion title text, and the selected Connection route.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: needs maintainer proof decision A ClawSweeper-authored PR needs a maintainer proof capture or override decision. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 4:49 AM ET / 08:49 UTC.

ClawSweeper review

What this changes

The PR sends a no-argument secondary launch through the existing current-user activation pipe as the Hub route, with bounded retries for primary-process startup.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this collaborator PR open for normal landing review. The introduced change fixes the source-proven no-argument forwarding gap while preserving the existing activation owner and security checks.

Priority: P2
Reviewed head: 473e7645be0b9658ea572e12f1384fdb71f5484b

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: The collaborator proof gate is not applicable; nevertheless, the PR body contains current-head native-Windows activation, process-count, accessibility, and redacted runtime-log evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The collaborator proof gate is not applicable; nevertheless, the PR body contains current-head native-Windows activation, process-count, accessibility, and redacted runtime-log evidence.
Evidence reviewed 7 items Introduced activation behavior: The secondary-instance branch now delegates all launch forwarding to the activation router, which maps a true no-argument launch to the default Hub URI and retries the existing forwarding boundary.
Existing security and ownership boundary retained: The default URI is parsed by the existing route table, while forwarding still validates payload size and deep-link syntax before opening the current-user pipe.
Focused regression coverage: Tests cover the default Hub route, a listener that begins after the first 1000 ms connection attempt, and the refusal to forward unknown arguments.
Findings None None.
Security None None.

Live Verification

Command: pwsh -NoProfile -File .\run-app-local.ps1 -Isolated -AllowNonMain

Result: FAIL (failed) — execution before step 1 run: sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.24.0.tgz | [ERR_PNPM_NO_LOCKFILE] Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

sh -lc pnpm install --ignore-scripts --frozen-lockfile failed: ! Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-11.24.0.tgz | [ERR_PNPM_NO_LOCKFILE] Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

Assertions:

  • FAIL expect_output: Launching OpenClaw Tray

How this fits together

The WinUI tray app uses a mutex to prevent duplicate processes and a current-user named pipe to deliver second-launch activations to the running app. The activation router converts the received deep link into a route that restores the Hub window.

flowchart LR
  A[Start menu launch] --> B[Single-instance mutex]
  B -->|Running instance| C[Activation router]
  C --> D[Current-user IPC pipe]
  D --> E[Running tray app]
  E --> F[Hub restore and foreground]
  B -->|No running instance| G[Normal startup]
Loading

Before merge

  • Add real behavior proof - Not applicable: The collaborator proof gate is not applicable; nevertheless, the PR body contains current-head native-Windows activation, process-count, accessibility, and redacted runtime-log evidence.
  • Resolve merge risk (P1) - The contributor reports the full tray suite remained blocked by an unrelated native-host hang; focused activation tests, the build, shared tests, and native runtime proof are recorded, while broader CI was still running in the captured context.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Focused change balance production +26 net, tests +48 net, docs 0 net The implementation is limited to the existing activation owner, with more regression coverage than production growth.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1218
Summary: This PR explicitly targets the canonical Start-menu restoration report and implements its requested forwarding, restore, and duplicate-process behavior.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused router-owned forwarding fix once normal CI and maintainer review complete, preserving the single current-user IPC route for all second-launch activation.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the focused router-owned forwarding fix once normal CI and maintainer review complete, preserving the single current-user IPC route for all second-launch activation.

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

Yes. The base activation path forwarded only explicit launch candidates, so a Start-menu launch with no arguments exited after seeing the mutex; the PR adds the missing default-Hub candidate and supplies a native-Windows after-fix run.

Is this the best way to solve the issue?

Yes. It extends the existing ActivationRouter and current-user IPC path rather than introducing another instance coordinator or window owner.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a visible but limited tray activation workflow without evidence of data loss, security exposure, or broad runtime unavailability.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: needs maintainer proof decision: A ClawSweeper-authored PR needs a maintainer proof capture or override decision. Not applicable: The collaborator proof gate is not applicable; nevertheless, the PR body contains current-head native-Windows activation, process-count, accessibility, and redacted runtime-log evidence.

Label justifications:

  • P2: This repairs a visible but limited tray activation workflow without evidence of data loss, security exposure, or broad runtime unavailability.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: needs maintainer proof decision: A ClawSweeper-authored PR needs a maintainer proof capture or override decision. Not applicable: The collaborator proof gate is not applicable; nevertheless, the PR body contains current-head native-Windows activation, process-count, accessibility, and redacted runtime-log evidence.

Evidence

What I checked:

  • Introduced activation behavior: The secondary-instance branch now delegates all launch forwarding to the activation router, which maps a true no-argument launch to the default Hub URI and retries the existing forwarding boundary. (src/OpenClaw.Tray.WinUI/App.xaml.cs:573, 473e7645be0b)
  • Existing security and ownership boundary retained: The default URI is parsed by the existing route table, while forwarding still validates payload size and deep-link syntax before opening the current-user pipe. (src/OpenClaw.Tray.WinUI/Services/ActivationRouter.cs:55, 473e7645be0b)
  • Focused regression coverage: Tests cover the default Hub route, a listener that begins after the first 1000 ms connection attempt, and the refusal to forward unknown arguments. (tests/OpenClaw.Tray.Tests/ActivationRouterTests.cs:335, 473e7645be0b)
  • Architecture policy alignment: The updated ledger records ActivationRouter as the authoritative activation and IPC owner, with App remaining the lifecycle caller rather than regaining parallel forwarding logic. (docs/ARCHITECTURE.md:192, 473e7645be0b)
  • Feature provenance: Blame shows the existing ActivationRouter boundary was introduced by Barbara Kudiess in 17a8b03, while this PR introduces only the retry/default-Hub extension. (src/OpenClaw.Tray.WinUI/Services/ActivationRouter.cs:51, 17a8b0363a82)
  • Current-head runtime proof: The supplied PR body records a native-Windows run of 473e764: a hidden running tray process was restored by a second no-argument launch, then process inspection confirmed one long-lived current-head process. (473e7645be0b)

Likely related people:

  • Barbara Kudiess: Introduced the current ActivationRouter ownership boundary and its single-instance IPC implementation in the preceding tray orchestration refactor. (role: activation-router introducer; confidence: high; commits: 17a8b0363a82; files: src/OpenClaw.Tray.WinUI/Services/ActivationRouter.cs, src/OpenClaw.Tray.WinUI/App.xaml.cs)

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.

@shanselman
shanselman merged commit 169afab into main Aug 28, 2026
24 checks passed
@shanselman
shanselman deleted the shanselman-fix-start-menu-activation branch August 28, 2026 09:20
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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: needs maintainer proof decision A ClawSweeper-authored PR needs a maintainer proof capture or override decision.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Start-menu launch does not restore window when app is already running in the system tray

1 participant