Skip to content

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

TypeScript

fix(desktop): finish superseded reconciles

Josué491692503435
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/reconcileChat.test.ts b/desktop-app/ui/src/hooks/domain/__tests__/reconcileChat.test.ts
index 620df49de..29191d7bf 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/reconcileChat.test.ts
+++ b/desktop-app/ui/src/hooks/domain/__tests__/reconcileChat.test.ts
@@ -215,7 +215,9 @@ describe('reconcileChat — single-flight', () => {
const reconcile = createReconcileChat(deps)
const oldRun = reconcile(chatKey, { reason: 'first-open' })
+ expect(deps.fsm.getState(chatKey)?.syncing).toBe(true)
reconcile.supersede(chatKey)
+ expect(deps.fsm.getState(chatKey)?.syncing).toBe(false)
const freshRun = reconcile(chatKey, { reason: 'second-open' })
await freshRun
diff --git a/desktop-app/ui/src/hooks/domain/reconcileChat.ts b/desktop-app/ui/src/hooks/domain/reconcileChat.ts
index 506361c48..a186fe027 100644
--- a/desktop-app/ui/src/hooks/domain/reconcileChat.ts
+++ b/desktop-app/ui/src/hooks/domain/reconcileChat.ts
@@ -278,6 +278,9 @@ export function createReconcileChat(deps: ReconcileChatDeps): ReconcileChat {
}) as ReconcileChat
reconcile.isInFlight = (chatKey: string) => inFlight.has(chatKey)
reconcile.supersede = (chatKey: string) => {
+ if (inFlight.has(chatKey)) {
+ deps.fsm.dispatch(chatKey, { type: 'RECONCILE_FINISHED' })
+ }
chatGenerations.set(chatKey, (chatGenerations.get(chatKey) ?? 0) + 1)
inFlight.delete(chatKey)
inFlightHint.delete(chatKey)