Skip to content

fix: stop aggressive retry on auth failures, show setup nudge#206

Merged
shanselman merged 1 commit intomasterfrom
fix/auth-retry-and-setup-nudge
Apr 23, 2026
Merged

fix: stop aggressive retry on auth failures, show setup nudge#206
shanselman merged 1 commit intomasterfrom
fix/auth-retry-and-setup-nudge

Conversation

@shanselman
Copy link
Copy Markdown
Collaborator

Fixes two related issues:

#198 — Aggressive retry loop: The reconnect counter was reset to 0 on every TCP connect, so auth failures (token mismatch, origin rejected) never progressed past 1-second backoff. Now resets only on successful hello-ok handshake.

#199 — Setup nudge: Terminal auth errors (token mismatch, origin not allowed, rate limited) now stop retrying entirely and show '⚠️ Auth failed — Run Setup' in the tray menu, linking directly to the Setup Wizard.

4 files, +54/-2. All 794 tests pass.

Fixes #198
Closes #199

Part 1 (fixes #198): Move reconnect attempt counter reset from TCP
connect to application-level hello-ok handshake. Auth failures now
properly progress through backoff (1s→2s→4s→8s→15s→30s→60s) instead
of resetting to 1s on every attempt.

Part 2 (closes #199): Detect terminal auth errors (token mismatch,
origin not allowed, rate limited, signature exhausted) and stop
retrying entirely. Fire AuthenticationFailed event so the UI shows
a setup nudge in the tray menu.

Security: exhausted device signature modes (all 4 rejected) are now
treated as terminal — no infinite cycling. Error messages stay local
(log file + tray menu only, never sent externally).

Pairing success already sends a toast notification (Toast_NodePaired)
in all 5 locales.
@shanselman shanselman force-pushed the fix/auth-retry-and-setup-nudge branch from 4f26c17 to ae88d03 Compare April 23, 2026 18:54
@shanselman shanselman merged commit 12eb2a4 into master Apr 23, 2026
8 checks passed
@shanselman shanselman deleted the fix/auth-retry-and-setup-nudge branch April 23, 2026 19:10
github-actions Bot added a commit that referenced this pull request Apr 24, 2026
Tests for the auth-failure backoff and terminal error detection added
in PR #206 (fix: stop aggressive retry on auth failures):

- HandleRequestError_TerminalAuthError_SetsAuthFailedFlag (theory):
  token mismatch / origin not allowed / too many failed → _authFailed set
- HandleRequestError_TerminalAuthError_RaisesAuthenticationFailedEvent:
  AuthenticationFailed event fired with message text
- HandleRequestError_TerminalAuthError_RaisesErrorStatus:
  ConnectionStatus.Error raised on terminal auth error
- HandleRequestError_TerminalAuthError_OnNonConnectMethod_DoesNotSetAuthFailed:
  terminal-auth guard is scoped to 'connect' method only
- HandleHelloOk_AfterAuthFailed_ClearsAuthFailedFlag:
  hello-ok response resets the flag so reconnect is re-enabled
- HandleRequestError_AllDeviceSignatureModesExhausted_SetsAuthFailed:
  cycling through all 4 signature modes fires AuthenticationFailed once

660 Shared pass (+8), 20 skipped.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant