Skip to content

Commit e00bf14

Browse files
committed
fix(update): preserve fallback while gateway pairing
1 parent 7f03dff commit e00bf14

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎src/OpenClaw.Tray.WinUI/App.xaml.cs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,10 @@ private void OnManagerStateChanged(object? sender, GatewayConnectionSnapshot sna
22632263
_lastManagerConnectedSideEffectsKey = null;
22642264
}
22652265

2266-
if (snap.OperatorState == RoleConnectionState.Error)
2266+
// Only a successful operator handshake can identify the Gateway's release track.
2267+
// PairingRequired intentionally persists after its socket closes, so preserve the
2268+
// pre-existing standalone updater instead of silently losing automatic checks.
2269+
if (snap.OperatorState is RoleConnectionState.Error or RoleConnectionState.PairingRequired)
22672270
StartAutomaticUpdateCheckWithoutGateway();
22682271
}
22692272

‎tests/OpenClaw.Tray.Tests/AppRefactorContractTests.cs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public void AutomaticUpdateCheck_WaitsForAuthenticatedGatewayHandshake()
4848
var source = ReadAppSources();
4949
var startup = ExtractMethod(source, "OnLaunchedAsync");
5050
var clientChanged = ExtractMethod(source, "OnOperatorClientChanged");
51+
var managerStateChanged = ExtractMethod(source, "OnManagerStateChanged");
5152

5253
Assert.DoesNotContain("await _updateCoordinator.CheckForUpdatesAsync()", startup);
5354
Assert.Contains("e.NewClient.HandshakeSucceeded += OnGatewayUpdateCheckHandshakeSucceeded", clientChanged);
@@ -65,7 +66,9 @@ public void AutomaticUpdateCheck_WaitsForAuthenticatedGatewayHandshake()
6566
"e.NewClient.HandshakeSucceeded += OnGatewayUpdateCheckHandshakeSucceeded;",
6667
"if (_dispatcherQueue is { HasThreadAccess: false } dispatcher)");
6768
Assert.Contains("StartAutomaticUpdateCheckWithoutGateway();", startup);
68-
Assert.Contains("if (snap.OperatorState == RoleConnectionState.Error)", source);
69+
Assert.Contains(
70+
"if (snap.OperatorState is RoleConnectionState.Error or RoleConnectionState.PairingRequired)",
71+
managerStateChanged);
6972
}
7073

7174
[Fact]

0 commit comments

Comments
 (0)