Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
fix(console): stop a stale sign-in-options failure from outliving a check
Wojciech Wojtyniak8d3fd70e8dd8
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-sign-in.tsx b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-sign-in.tsxindex 06b036be2..a96e27e57 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-sign-in.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/server-sign-in.tsx@@ -24,6 +24,10 @@ export type ServerSignIn = {* this is the only place that failure is visible — `config` may be a stale* answer from before the endpoint broke, or null if it never succeeded. */configCheckFailed: boolean;+ /** Whether a sign-in-options read is in flight right now — checked before+ * `configCheckFailed` so a fresh retry after a failure is not reported as+ * still failing while it is still running. */+ configChecking: boolean;email: string;password: string;setEmail: (value: string) => void;@@ -63,6 +67,7 @@ export function useServerSignIn(serverId: string): ServerSignIn {return {config: switchServersStore.authConfigFor(serverId),configCheckFailed: switchServersStore.authConfigCheckFailed(serverId),+ configChecking: switchServersStore.authConfigChecking(serverId),email,password,setEmail,@@ -116,7 +121,7 @@ export const ServerSignInFields = observer(function ServerSignInFields({if (!config) {return (<p className="text-sm text-foreground-muted">- {signIn.configCheckFailed+ {signIn.configCheckFailed && !signIn.configChecking? 'Could not check sign-in options.': 'Checking sign-in options…'}</p>diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.test.tsindex 06046cc9e..7a6539c7a 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.test.ts@@ -131,6 +131,30 @@ describe('fetching sign-in options', () => {expect(getAuthConfig).toHaveBeenCalledTimes(1);expect(store.authConfigFor('srv-a')).toEqual(authConfig);});++ it('reports a retry as checking rather than still failed while it runs', async () => {+ // The panel picks its message from configCheckFailed and configChecking+ // together: without this signal, a retry after a failure would claim the+ // check failed right up until the moment it actually succeeds or fails+ // again, even while it is genuinely in flight.+ const store = newStore([server('srv-a')]);+ getAuthConfig.mockRejectedValueOnce(new Error('fetch failed'));+ await store.ensureAuthConfig('srv-a');+ expect(store.authConfigCheckFailed('srv-a')).toBe(true);+ expect(store.authConfigChecking('srv-a')).toBe(false);++ const retryPending = deferred<typeof authConfig>();+ getAuthConfig.mockReturnValueOnce(retryPending.promise);+ const retrying = store.ensureAuthConfig('srv-a');+ await flush();+ expect(store.authConfigChecking('srv-a')).toBe(true);++ retryPending.resolve(authConfig);+ await retrying;++ expect(store.authConfigChecking('srv-a')).toBe(false);+ expect(store.authConfigCheckFailed('srv-a')).toBe(false);+ });});describe('recovering when connectivity returns', () => {@@ -231,6 +255,23 @@ describe('a server on an unreachable host', () => {expect(store.authConfigFor('srv-a')).toEqual(authConfig);});++ it('does not carry a pre-outage sign-in-options failure past the skip', async () => {+ // The failure recorded before the host went down belongs to a check that+ // is no longer running — the skip must not let it sit there as if it+ // were still current, or unblocking would show it "once more" for a+ // check that never actually happened during the outage.+ const store = newStore([remoteServer('srv-a', 'host-1')]);+ getAuthConfig.mockRejectedValueOnce(new Error('fetch failed'));+ await store.ensureAuthConfig('srv-a');+ expect(store.authConfigCheckFailed('srv-a')).toBe(true);++ blockedHosts.add('host-1');+ await store.ensureAuthConfig('srv-a');++ expect(store.authConfigCheckFailed('srv-a')).toBe(false);+ expect(getAuthConfig).toHaveBeenCalledTimes(1);+ });});describe('the manual refresh button', () => {diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.tsindex 2108cb84a..053bb39aa 100644--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/switch-servers-store.ts@@ -123,6 +123,13 @@ export class SwitchServersStore {return this.authConfigUnreachable.has(serverId);}+ /** Whether a sign-in-options read is in flight right now. The sign-in panel+ * reads this alongside {@link authConfigCheckFailed} so a fresh retry does+ * not get reported as a failure while it is still running. */+ authConfigChecking(serverId: string): boolean {+ return this.authConfigInFlight.has(serverId);+ }+async init(): Promise<void> {runInAction(() => {this.loadingServers = true;@@ -283,8 +290,15 @@ export class SwitchServersStore {// The gateway of a server on an unreachable host cannot answer, and the// host-unreachable surface already states why — don't paint the global// error banner with a doomed fetch (CHOO-1780). The host un-blocking is- // itself a recovery signal, so this is a skip, not a giving up.- if (this.isHostBlocked(serverId)) return;+ // itself a recovery signal, so this is a skip, not a giving up — and a+ // failure recorded before the host went down does not belong to this+ // skip, so it does not survive it either.+ if (this.isHostBlocked(serverId)) {+ runInAction(() => {+ this.authConfigUnreachable.delete(serverId);+ });+ return;+ }runInAction(() => {this.authConfigInFlight.add(serverId);});