Skip to content

fix: Bindings keeps spinning when the gateway is disconnected - #1809

Merged
shanselman merged 4 commits into
openclaw:mainfrom
SebTardif:fix/f039-bindings-disconnected-spinner
Oct 23, 2026
Merged

shanselman merged 4 commits into
openclaw:mainfrom
SebTardif:fix/f039-bindings-disconnected-spinner

Conversation

@SebTardif

@SebTardif SebTardif commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Recovery proof

Head 5c8748c. Same isolated tray. A loopback Gateway, OpenClaw 2026.10.5, listened on 127.0.0.1:18799. The tray paired once, then stayed on the Bindings page.

UI Automation on OpenClaw Settings:

  1. Connected. RefreshButton enabled true. Text: Single-agent mode. All messages route to the default agent. The disconnected bar was absent. The Gateway log recorded config.get success.
  2. Gateway process stopped. Bindings still open. Text: Gateway disconnected. Connect to a gateway to load bindings. RefreshButton enabled false.
  3. Gateway started again. No new navigation. app.status returned operatorState Connected and gatewayVersion 2026.10.5. Bindings showed Single-agent mode again. RefreshButton enabled true. The disconnected bar was absent.

The earlier disconnected opening, with no Gateway configured, is in the section above. PrintWindow still returned a black frame, so this record is the live UI Automation tree.

Disconnected page proof

Head 5c8748c. Isolated tray data dir C:\Users\sebta\AppData\Local\Temp\pr1809-proof. MCP port 8779. No gateway configured.

app.status returned connectionStatus Disconnected, overallState Idle, operatorState Idle, gatewayVersion null.

app.navigate page bindings returned navigated true.

UI Automation on the OpenClaw Settings window, process 3008, then showed:

  • Page title Bindings
  • Message routing rules
  • Warning: Gateway disconnected
  • Connect to a gateway to load bindings.
  • Open Connection
  • Button AutomationId RefreshButton, IsEnabled false
  • No loading progress element was in the tree

PrintWindow of that WinUI window returned a black frame, so this record is the live UI Automation tree rather than a bitmap.

Not in this capture: the page after a later successful gateway connection. This isolated profile has no gateway, so recovery was not shown.

Latest head

Head 5c8748c rechecks the page and the gateway connection when a queued Bindings callback runs. If the page has unloaded, the callback does not reattach the client. If the handshake dropped, the page keeps the disconnected bar instead of starting a load that config.get will suppress.

BindingsPageConnectionTests passed 5. WinUI x64 build succeeded. Tray tests passed 4466. A live tray screenshot of the disconnected bar and the later recovery is still not captured.

What Problem This Solves

Fixes: the Bindings page keeps its spinner up when the gateway client exists but is not connected.

User Impact

User impact: opening Bindings while the gateway is disconnected shows the disconnected bar and leaves Refresh disabled. When the gateway connects, the page requests the config again.

Why This Change Was Made

RequestConfigAsync returns without a config event until the handshake is ready. The page treated any non-null client as connected, so the loading state never finished. It now uses the same connected check as Usage, and it listens for the client to become connected.

Evidence

BindingsPageConnectionTests passed. The page source requires IsConnectedToGateway before RequestConfigAsync on open and on Refresh.

./build.ps1 succeeded.

dotnet test tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj passed 4638, skipped 24, total 4662.

dotnet test tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore passed 4462, skipped 0, total 4462.

No screenshot. The disconnected bar was not captured from a running tray.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • none: the change is the Bindings loading state when the gateway socket is down. It does not change installer, gateway setup, MXC, or a new window.

Validation

  • ./build.ps1 succeeded in C:\Users\sebta\wt-wn-f039.
  • Shared tests: passed 4638, skipped 24, total 4662.
  • Tray tests: passed 4462, skipped 0, total 4462.
  • Focused: BindingsPageConnectionTests passed 1.

Real Behavior Proof

  • Environment tested: Windows, worktree C:\Users\sebta\wt-wn-f039.
  • PR head or commit tested: b8145e2
  • Exact steps or command run: dotnet test tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --filter FullyQualifiedName~BindingsPageConnectionTests
  • Evidence after fix: Passed 1. Initialize and Refresh require IsConnectedToGateway before RequestConfigAsync.
  • Observed result: a disconnected client no longer leaves the loading state waiting for a config event that will not arrive.
  • Screenshot or artifact links verified? N/A
  • Not verified or blocked: a live tray screenshot of the disconnected Bindings bar.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No

Opening Bindings treated a non-null client as connected. RequestConfigAsync
returns before the handshake, so the loading state never finished. Fail that
state and show the disconnected bar, and request config again when the
client connects.

BindingsPageConnectionTests passed. ./build.ps1 exit 0. Shared 4638 passed,
24 skipped. Tray 4462 passed.

Signed-off-by: Sebastien Tardif <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

Bindings checks gateway readiness before loading and reloads configuration when the connection returns.

Example: Open Bindings while its gateway client has not completed the handshake.

  • Before: The spinner waits indefinitely for a configuration response that was never requested.
  • After: The page shows Gateway disconnected, disables Refresh, and loads configuration after connection.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, scoped repair with current-head live UI diagnostics and resolved earlier findings; helper-only tests provide limited lifecycle assurance.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Current-head copied UI Automation diagnostics exercise the shipped Windows Bindings page in an isolated tray: disconnected opening removes loading and disables Refresh, and a real OpenClaw 2026.10.5 Gateway restart restores loaded content and enabled Refresh without navigation; the unrelated Usage screenshot adds no proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Opening Bindings while the gateway client is disconnected leaves a spinner instead of a useful connection state.
Reason: The change restores the established disconnected-page contract and automatic recovery without introducing a setting or changing designed defaults.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main loading bug, and both earlier callback findings are resolved; no blocking introduced defect remains.

Priority: P2
Reviewed head: 5c8748cf9caa1870a7a8f13dac072bfc2dedd69f

Before merge

None.

Findings

None.

Tests

  • Low-value test tests/OpenClaw.Tray.Tests/BindingsPageConnectionTests.cs: The four DecideQueued cases test a trivial helper without exercising queued callbacks or event detachment; replace them with lifecycle coverage or remove them.
  • Missing end-to-end proof: A base-fail/head-pass regression-test run was not supplied; the reported live UI diagnostics cover the changed user behavior.
Agent review details

How this fits together

BindingsPage observes the manager-owned operator client and AppState configuration, sends config.get through the existing client, and renders routing rows or loading and connection states.

flowchart LR
Manager[Connection manager] --> Client[Operator client]
Manager --> Page[Bindings page]
Page --> Client
Client --> Gateway[Gateway config]
Gateway --> State[GatewayService and AppState]
State --> Page
Page --> View[Routing and connection display]
Loading

Technical review

Best possible solution:

Keep the existing configuration and connection owners while gating Bindings requests on readiness and respecting page lifetime during recovery.

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

Current-main source establishes the failure: a non-null unready client starts Bindings loading while config.get is suppressed without a configuration event; this review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Readiness gating and observing the existing manager-owned client address the stated defect without changing routing, configuration storage, or connection ownership.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 20fddaf66846.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Bindings can remain loading during disconnection, with limited scope and an existing in-product Connection route.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-21T19:10:12.771Z sha b8145e2 :: needs real behavior proof before merge. :: [P2] Recheck connectivity inside the queued recovery callback | [P2] Invalidate queued client swaps when the page unloads

Reviewed October 21, 2026, 6:27 PM ET / 22:27 UTC (Revision 2).

A handshake can drop, or the page can unload, before the dispatcher runs
the reconnect callback. Recovery now checks that the page is still
observing and that the client is still connected. Unload clears that
observation first, so a queued swap cannot reattach the page.

BindingsPageConnectionTests passed 5. WinUI x64 build succeeded. Tray
tests passed 4466. Shared sources are unchanged from the 4638 passing
run on this branch.

Signed-off-by: Sebastien Tardif <[email protected]>
@SebTardif

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 21, 2026
@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Oct 23, 2026
shanselman and others added 2 commits October 23, 2026 12:32
OnClientStatusChanged returned early when the tracked client was not connected, so a Disconnected or Error event raised after recovery had started a config request was discarded and the loading state never cleared. Enqueue the event for the tracked client and let the queued callback decide: it already re-checks the observation and client identity.

Adds a headless regression that drives the real BindingsPage owner through recovery followed by a same-client Disconnected or Error.

Co-authored-by: Copilot App <[email protected]>
After the same-client disconnect fix, every status event of the tracked client reaches the UI thread. Queued Connecting and Connected events then both saw the reconnected client and each requested the config. Only the Connected event recovers now; a queued Connecting or Disconnected callback that finds the client already reconnected returns.

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

Copy link
Copy Markdown
Collaborator

Hi @SebTardif, I'm a Copilot triage agent helping the maintainers (a bot, not a person). Thanks for this fix.

While reviewing I found one more corner, so I pushed two small commits on top of your head (maintainer edits were enabled; please pull before pushing again, and feel free to revert or adjust either one). First, a Disconnected or Error event from the same client that arrives after a recovery reload starts was dropped by the connected check at event time, leaving the spinner on and Refresh disabled; the queued callback now decides from the current client state. Second, that made a queued Connecting plus Connected pair request the config twice, so only Connected recovers now. Headless tests that drive the real BindingsPage code-behind fail on the earlier head and pass now. On top of current main: build, Shared 4645 passed, Tray 4502 passed, and an independent review found nothing. Not verified: real native UI behavior. I'll merge once CI is green unless you'd like changes.

@shanselman
shanselman merged commit ae56aa5 into openclaw:main Oct 23, 2026
27 checks passed
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Oct 23, 2026
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. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants