Provide one shared Windows session-ending signal and wire it for production use
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- desktop, operating-systems
Research direction
Start by inspecting the shared layer around WebSocketClientBase.cs and the tray host's session-event or window handling and registration paths. Choose one of the specified Windows session-ending mechanisms, then add the abstraction, implementation, production wiring, and tests for real wiring and substitution. Run ./build.ps1 and the three listed Shared, Tray, and Connection test projects; done means all pass without a real shutdown or WSL.
Written by the indexing model from the issue text.
Description
What
Three existing issues each guard a different call site that can start wsl.exe during a Windows session-end sequence:
- #1572 — the process-start boundary of the managed-local provenance probe
- #1573 — the tray's keep-alive entry points
- #1574 — the reconnect retry loop
All three need the same input: a reliable, injectable answer to "is a Windows session-end sequence in progress?". No such source exists in the repository today, and #1572 deliberately left the concrete Windows wiring out of its scope. As the reviews on #1573 and #1574 note, three independently-defined seams would be incompatible with each other, or would never be wired to anything real.
This issue owns that prerequisite: the abstraction, a concrete Windows source, and its production registration. It is the contract the other three implement against.
Where
- The contract must be consumable from
src/OpenClaw.Shared—WebSocketClientBase.cs(#1574) lives there, and that assembly must not gain a Win32 or tray dependency. Put the abstraction in the shared layer; put the Windows implementation where the host can observe session events. - A concrete source is
Microsoft.Win32.SystemEvents.SessionEnding, or theWM_QUERYENDSESSION/WM_ENDSESSIONpair handled on the tray's own window. Either is acceptable; where a window already exists, prefer the message pair, because it lets the process act before the session ends rather than only observing that it is ending.
Required behaviour
- One injectable abstraction answering "is the Windows session ending?", consumed by all three call sites — a single source of truth, no per-call-site re-derivation of the state.
- A production implementation actually wired up in the tray host, not left as a null / always-false default in a released build. A seam that is never connected is worse than none: it looks fixed and is not.
- Substitutable in tests: forcing "ending" must not require shutting Windows down.
- Registering it must not change behaviour when no session end is in progress.
- Do not use
Environment.HasShutdownStartedas the whole answer; on its own it is not reliable evidence that a session-end sequence is in progress. - If the mechanism can observe the transition (a session end has been requested) and not merely a latched state, expose that. #1574 needs to react to a session end that begins during an in-flight backoff wait, and #1572 prefers to decline as early as possible.
Scope
- Add the abstraction, the Windows implementation and its registration. That is the whole of this issue.
- Do not change the three consumer call sites — #1572, #1573 and #1574 own those, and each owns exactly one production file (plus, in #1573's case, the keep-alive cancellation boundary under discussion there).
- Do not refactor
AppShutdownCoordinatoror the ordered-shutdown design recorded indocs/ARCHITECTURE.md. - Do not add a new user-facing setting.
This should stay a small change: one new contract, one new implementation, one registration. Keeping it that small is deliberate — a previous single issue covering all three spawn paths produced a fix artifact that spanned three subsystems and was rejected as too broad for autonomous execution.
Acceptance
./build.ps1
dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore
dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore
dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restore
Required regression test
- A test asserting the wiring is real: with the host configured as in production, the abstraction the consumers receive is the Windows implementation, not a default no-op. This is the failure mode that otherwise ships silently.
- A test asserting the substitutable path: an implementation reporting "ending" is observed as ending by a consumer, and one reporting "not ending" is observed as not ending — without any real session end.
- The test suite must not require an actual shutdown, a real
wsl.exe, or WSL to be installed.
Related
Prerequisite for #1572, #1573 and #1574 — they depend on this contract and should not be closed in favour of it. #1571 is the evidence umbrella for the underlying defect.
What I can and cannot contribute
- I can confirm the reported behaviour on Windows 11 Home China build
10.0.26300with OpenClaw Companion2026.9.4.0, including the Event 1074 → Event 26 ordering and tray-log excerpts during teardown. - I do not have a working build environment for this repository, so I cannot run
./build.ps1or the test projects. Someone else needs to verify.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 336
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 177
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openclaw/openclaw-windows-node
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:no-new-fix-pr clawsweeper:not-repro-on-main impact:ux-release-blocker issue-rating: 🦪 silver shellfish P0
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openclaw/openclaw-windows-node#1843 · 3 comments · 2 reactions ·
Maintainers usually reply within 1 day
-
clawsweeper:needs-product-decision clawsweeper:needs-security-review clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:security impact:ux-friction issue-rating: 🦞 diamond lobster P2 stale
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
openclaw/openclaw-windows-node#1763 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3 stale
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openclaw/openclaw-windows-node#1762 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-release-blocker issue-rating: 🦞 diamond lobster P0
Difficulty 4/5 3-5 days Newbie friendliness 25/100
openclaw/openclaw-windows-node#1969 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Companion stays connected when the Gateway stops responding but TCP stays openPossibly taken @roboclaw-bot claimed this 1 day ago. Openclawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
openclaw/openclaw-windows-node#1958 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
All issues in openclaw/openclaw-windows-node
Similar issues
-
effort:S P3 refactor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nightscout/nocturne#3243 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
dasher-project/Dasher-Windows#84 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libnativeapi/nativeapi#21 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
enhancement P3 performance
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
thomhurst/TUnit#7380 · 2 comments ·
Maintainers usually reply within 1 day