Skip to content

Commit 79ae814

Browse files
committed
fix(ui): stop reconnect loop on auth failure, surface login gate
1 parent e80c803 commit 79ae814

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎ui/src/ui/app-gateway.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ export function connectGateway(host: GatewayHost) {
170170
return;
171171
}
172172
host.connected = false;
173+
// Code 1008 = Policy Violation (auth failure) — show the gateway's reason directly
174+
if (code === 1008) {
175+
host.lastError = reason || "Authentication failed. Check your gateway token.";
176+
return;
177+
}
173178
// Code 1012 = Service Restart (expected during config saves, don't show as error)
174179
if (code !== 1012) {
175180
host.lastError = `disconnected (${code}): ${reason || "no reason"}`;

‎ui/src/ui/gateway.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ export class GatewayBrowserClient {
109109
this.ws = null;
110110
this.flushPending(new Error(`gateway closed (${ev.code}): ${reason}`));
111111
this.opts.onClose?.({ code: ev.code, reason });
112+
// 1008 = Policy Violation (gateway auth rejection).
113+
// Don't auto-reconnect on auth failures — surface the login gate
114+
// so the user can fix their token/password instead of looping.
115+
if (ev.code === 1008) {
116+
this.closed = true;
117+
return;
118+
}
112119
this.scheduleReconnect();
113120
});
114121
this.ws.addEventListener("error", () => {

0 commit comments

Comments
 (0)