Skip to content

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

TypeScript

fix(desktop-app): r1-l1 keep active REST handoffs idempotent

Josuéf343136b6fc7
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 889e5df46..fb244edd4 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
@@ -213,6 +213,12 @@ describe('Desktop environment handoff', () => {
externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
rpcProxyBaseUrl: `${targetEnvironment.rpcProxyBaseUrl}/rpc`,
})
+ const state = await runtimeConfigModule!.getDesktopRuntimeConfigState()
+ const otherOption = state.options.find(
+ option => option.externalRestApiBaseUrl === otherEnvironment.externalRestApiBaseUrl
+ )
+ if (!otherOption) throw new Error('The runtime config producer did not return the other target')
+ await runtimeConfigModule!.selectDesktopRuntimeConfigOption(otherOption.id)
render(<Probe />)
await waitFor(() => expect(screen.getByTestId('configuration-loaded')).toHaveTextContent('yes'))
diff --git a/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts b/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
index b1e88cf12..e768a193a 100644
--- a/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
+++ b/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
@@ -177,6 +177,12 @@ export function createDesktopEnvironmentSetupHandler({
return
}
+ if (activeRestEndpointMatches) {
+ setPendingDesktopEnvironmentSetup(null)
+ setStatus(`Opening ${linkedConfig.appName} in Evenfire Desktop.`, 'success')
+ return
+ }
+
if (restMatches.saved.length === 1) {
setPendingDesktopEnvironmentSetup(null)
const selectedState = await handleSelectRuntimeConfig(restMatches.saved[0].id)