Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix: distinguish confirmation verification failure from session change

Josuécfdfb565940a
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx
index 44e15a1f3..8adf15c20 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx
+++ b/desktop-app/ui/src/hooks/domain/__tests__/useAuthController.desktopEnvironment.test.tsx
@@ -314,6 +314,34 @@ describe('Desktop environment handoff', () => {
)
})
+ it('reports verification failure after confirmation selects a newly saved profile', async () => {
+ const linked = { externalRestApiBaseUrl: 'https://new-api.example.test', appName: 'New' }
+ render(<Probe />)
+ await waitFor(() => expect(screen.getByTestId('configuration-loaded')).toHaveTextContent('yes'))
+ await dispatchDesktopEnvironmentLink(linked)
+ await runtimeConfigModule!.saveDesktopRuntimeConfig({
+ ...linked,
+ rpcProxyBaseUrl: 'https://rpc-new.example.test',
+ })
+ const other = runtimeConfigModule!
+ .getDesktopRuntimeConfigState()
+ .options.find(
+ option => option.externalRestApiBaseUrl === otherEnvironment.externalRestApiBaseUrl
+ )!
+ await runtimeConfigModule!.selectDesktopRuntimeConfigOption(other.id)
+ mocks.selectRuntimeConfigForHandoff.mockImplementationOnce(async (id, generation) => {
+ const selection = await nativeAppService!.selectRuntimeConfigForHandoff(id, generation)
+ mocks.getSessionGeneration.mockRejectedValueOnce(new Error('fixture IPC unavailable'))
+ return selection
+ })
+ await act(async () => confirmDesktopEnvironmentSetupForTest?.())
+ expect(screen.getByTestId('pending-environment')).toHaveTextContent('none')
+ expect(mocks.setStatus).toHaveBeenLastCalledWith(
+ 'Could not verify the desktop session. Try opening the link again.',
+ 'error'
+ )
+ })
+
it('refuses a confirmation save result for a different REST profile', async () => {
const linked = { externalRestApiBaseUrl: 'https://new-api.example.test', appName: 'New' }
render(<Probe />)
diff --git a/desktop-app/ui/src/hooks/domain/useAuthController.ts b/desktop-app/ui/src/hooks/domain/useAuthController.ts
index cee553a31..c37cc6b3b 100644
--- a/desktop-app/ui/src/hooks/domain/useAuthController.ts
+++ b/desktop-app/ui/src/hooks/domain/useAuthController.ts
@@ -690,7 +690,8 @@ export function useAuthController({
try {
selectedSessionGeneration = await getSessionGeneration()
} catch {
- reportSessionChanged()
+ setPendingDesktopEnvironmentSetup(null)
+ setStatus('Could not verify the desktop session. Try opening the link again.', 'error')
return
}
if (selectedSessionGeneration !== selection.sessionGeneration) {