Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Reconnect retry loop invokes reconnect authorization with no Windows session-ending check

Open
#1,574 3 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp

Research direction

Start in src/OpenClaw.Shared/WebSocketClientBase.cs around the reconnect loop at :594 and ReconnectAuthorizationAsync at :156–:157, then review the session-ending abstraction used by the other call sites. Run the specified build and shared test commands. Done means the ending signal prevents authorization while a non-ending signal preserves it, with the refusal logged and the regression test using the settable delegate.

Written by the indexing model from the issue text.

Description

clawsweeper:needs-maintainer-review clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2 stale

What

The WebSocket reconnect retry loop keeps running during a Windows session-end sequence. Its next step is ReconnectAuthorizationAsync, which routes through endpoint provenance and can reach the managed-local port probe — the code path that starts wsl.exe. Creating that process at teardown fails with STATUS_DLL_INIT_FAILED (0xc0000142) and produces the shutdown "Application Error" dialog recorded as Application Popup, Event ID 26.

This issue covers one production file. It is the third of three spawn paths described in #1571; read #1571 for the evidence trail (the 16-day Event 26 burst census, the tray log excerpts, and why the unrelated XLGuard.sys boot popup must be counted separately).

Where

src/OpenClaw.Shared/WebSocketClientBase.cs

  • The reconnect retry loop sits around :594. It checks disposal, its cancellation token, the reconnect policy and the socket generation, then continues into authorization.
  • ReconnectAuthorizationAsync is declared at :156–:157 and invoked at :618–:621:
    await ReconnectAuthorizationAsync(_cts.Token).ConfigureAwait(false);
  • _cts is the client's own token source (:102, created at :228); it is cancelled by the client's teardown, but that teardown is order-dependent and does not observe a Windows session-end sequence.
  • Neither this loop nor the authorization path consults a session-ending signal.

Scope — deliberately one file

  • Change only src/OpenClaw.Shared/WebSocketClientBase.cs.
  • Do not change src/OpenClaw.Connection/ManagedLocalGatewayPortProvenanceService.cs (separate issue), src/OpenClaw.Tray.WinUI/App.xaml.cs (separate issue), or any document/config/schema.
  • Do not change reconnect backoff, the reconnect policy, or the disposal ordering.
  • Do not add a new user-facing setting.

A previous single issue covering all three spawn paths produced an autonomous fix artifact that spanned three subsystems and was rejected upstream as too broad for autonomous execution. Keeping this to one file is the point of the split.

Required behaviour

  1. Once the process has observed that the Windows session is ending, the reconnect loop must exit before invoking ReconnectAuthorizationAsync — the call at :621 must not be reached.
  2. Normal reconnects are unchanged: with no session end in progress, the loop must behave exactly as today, including its existing token/policy/generation checks.
  3. The check must not depend on the client's own _cts being cancelled at the right moment; that race is the current gap.
  4. The session-ending signal must come from the same injected abstraction used by the other two call sites, so there is one source of truth. If that abstraction is not yet available, code the call site against it rather than re-deriving the state locally.
  5. Declining must be logged at the point of refusal.
  6. WebSocketClientBase lives in a shared library with no window; do not add a Win32/tray dependency to it. Take the signal as an abstraction.

Acceptance

./build.ps1
dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore

Required regression test

In tests/OpenClaw.Shared.Tests, a test that:

  • substitutes a session-ending signal that reports "ending",
  • drives the reconnect path,
  • asserts that ReconnectAuthorizationAsync is not invoked,
  • and that with the signal reporting "not ending" it is invoked.

Assert on a substituted ReconnectAuthorizationAsync delegate (it is already settable at :156), not on a real socket or a real wsl.exe.

What I can and cannot contribute

  • I can confirm the reported behaviour on Windows 11 Home China build 10.0.26300 with OpenClaw Companion 2026.9.4.0, including tray-log lines showing Connection closed prematurely followed by reconnecting in … during teardown, and the matching Event 1074 → Event 26 ordering.
  • I do not have a working build environment for this repository, so I cannot run ./build.ps1 or the test projects. Someone else needs to verify.
Dominant language
C#
Stars
2.1k
Forks
315
Avg merge
2d 7h
Merged PRs (30d)
135

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openclaw/openclaw-windows-node

All issues in openclaw/openclaw-windows-node

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.