Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix: allow login when RPC discovery is unavailable
Josué7d3a14c58726
diff --git a/desktop-app/src/__tests__/appService.teamTransitionOwnership.test.ts b/desktop-app/src/__tests__/appService.teamTransitionOwnership.test.tsindex 69f1d9b56..2d731ea47 100644--- a/desktop-app/src/__tests__/appService.teamTransitionOwnership.test.ts+++ b/desktop-app/src/__tests__/appService.teamTransitionOwnership.test.ts@@ -348,6 +348,49 @@ describe('AppService deliberate team transition ownership', () => {expect(app.getSessionGeneration()).toBe(previousGeneration + 1)})+ it.each(['Google', 'password'])(+ '%s login continues when optional RPC discovery fails',+ async loginMethod => {+ const { service, runtimeConfig, restA } = await createNativeCommitTestHarness()+ await runtimeConfig.saveDesktopRuntimeConfig({+ externalRestApiBaseUrl: restA,+ rpcProxyBaseUrl: '',+ appName: 'Environment A',+ })+ const me = {+ id: 'user-a',+ email: '[email protected]',+ name: 'User A',+ picture: null,+ teamId: 'team-a',+ teamName: 'Team A',+ role: 'member',+ }+ const getDesktopEnvironment = vi+ .fn()+ .mockRejectedValue(new Error('RPC discovery unavailable'))+ const googleLogin = vi.fn().mockResolvedValue({ token: 'google-session-a', me })+ const passwordLogin = vi.fn().mockResolvedValue({ token: 'password-session-a', me })+ const app = service as unknown as { authClient: unknown }+ app.authClient = { getDesktopEnvironment, googleLogin, passwordLogin }++ const result =+ loginMethod === 'Google'+ ? await service.googleLogin('synthetic-google-token')+ : await service.passwordLogin('[email protected]', 'synthetic-password')++ expect(result).toMatchObject({ authenticated: true, me })+ expect(getDesktopEnvironment).toHaveBeenCalledOnce()+ if (loginMethod === 'Google') {+ expect(googleLogin).toHaveBeenCalledWith('synthetic-google-token')+ expect(passwordLogin).not.toHaveBeenCalled()+ } else {+ expect(passwordLogin).toHaveBeenCalledWith('[email protected]', 'synthetic-password')+ expect(googleLogin).not.toHaveBeenCalled()+ }+ }+ )+it('rejects a stale handoff generation after a public login advances the session', async () => {const { service, runtimeConfig, optionA } = await createNativeCommitTestHarness()const app = service as unknown as {diff --git a/desktop-app/src/appService.ts b/desktop-app/src/appService.tsindex 02a8e432c..37d4290b1 100644--- a/desktop-app/src/appService.ts+++ b/desktop-app/src/appService.ts@@ -2061,7 +2061,7 @@ export class AppService {return sessionGeneration})- await this.resolveRuntimeConfigIfNeeded()+ await this.resolveRuntimeConfigIfNeeded().catch(() => undefined)const binding = await this.withNativeAuthEnvironmentCommit(async () => {this.assertSessionGeneration(sessionGeneration)return this.captureAuthEnvironmentBinding()@@ -2270,7 +2270,7 @@ export class AppService {await this.withNativeAuthEnvironmentCommit(async () => {this.assertSessionGeneration(loginGeneration)})- await this.resolveRuntimeConfigIfNeeded()+ await this.resolveRuntimeConfigIfNeeded().catch(() => undefined)this.assertSessionGeneration(loginGeneration)const normalizedEmail = email.trim().toLowerCase()return await this.completePasswordLogin(normalizedEmail, password, loginGeneration)