Repository navigation
fix: setup flow, connection page, and chat token bugs - #305
Conversation
- Fix wizard RadioButtons selection not sticking (FunctionalUI) - Validate SSH config before direct connect; revert registry on failure - Log identity file errors instead of silent catch blocks - Unsubscribe ConnectionPage from StateChanged on Unloaded - Fix ReconnectAsync/SwitchGatewayAsync race condition (atomic semaphore) - Fix sync-over-async deadlock risk in DisposeActiveClient - Add timeout to tunnel stop in Dispose - Persist Cancelled status on setup cancellation - Classify permanent setup failures as non-retryable - Handle corrupt setup-state.json gracefully - Fix chat using DeviceToken instead of SharedGatewayToken for HTTP auth Co-authored-by: Copilot <[email protected]>
199f59a to
eed21c3
Compare
|
Thanks for the broad setup/connection cleanup here. I did a deep adversarial review of #305 against the claimed fixes. Overall this looks like a strong bug-fix PR and CI is green, but I think a small follow-up pass would make it safer before merge. SummaryThe good parts look valid:
Please address before merge1. Direct Connect rollback/success semantics are only partially fixed
In _ = Task.Run(async () =>
{
try
{
await lifecycle.ConnectAsync(ct);
}
catch (OperationCanceledException) { }
catch (Exception ex)
{
_logger.Error($"[ConnMgr] Connect failed: {ex.Message}");
}
}, ct);That means bad token, unreachable gateway, handshake/auth failure, etc. will generally flow through connection manager state/events later, not through the DirectConnectResultText.Text = $"✓ Connected to {GatewayUrlHelper.SanitizeForDisplay(url)}";immediately after starting the attempt, not after a successful connection. The rollback is also incomplete when the
Suggested fix plan:
This is the main correctness issue I would fix before merging because it can leave users thinking Direct Connect succeeded while the async connection is still failing. 2. Rename the updated credential resolver testThe test Suggested fix: Rename it to something like: TryResolve_PrefersSharedGatewayTokenOverDeviceTokenForInteractiveHttpSurfacesThat will prevent future agents/maintainers from “fixing” the test back to the old behavior based on the misleading name. 3. Use the existing source constant for shared-token resolution
"record.SharedGatewayToken"Please use the existing constant instead: CredentialResolver.SourceSharedGatewayTokenThis keeps production behavior and tests tied to the same source label. Worth considering while you are in
|
…tants, timeouts - Direct connect now polls connection state before reporting success - Full rollback on failure: removes new records, restores existing ones, reverts settings - Pairing-required state handled without rollback - Renamed test to TryResolve_PrefersSharedGatewayTokenOverDeviceTokenForHttpSurfaces - Use CredentialResolver.SourceSharedGatewayToken constant instead of hardcoded string - SwitchGatewayAsync tunnel stop bounded to 5s timeout - Dispose acquires semaphore briefly before disposal to avoid race with in-flight operations Co-authored-by: Copilot <[email protected]>
Summary
Fixes 12 bugs across setup flow, connection page, connection manager, and chat token resolution.
Wizard RadioButtons (user-reported)
ConnectionPage — Direct Connect
GatewayConnectionManager
Setup Flow
Chat Token
Testing