Skip to content

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

TypeScript

fix(desktop): remove dead reconcile persistence option

Josué3e4fb656fc3c
diff --git a/desktop-app/src/__tests__/chatStore.test.ts b/desktop-app/src/__tests__/chatStore.test.ts
index a7931c689..d37b23843 100644
--- a/desktop-app/src/__tests__/chatStore.test.ts
+++ b/desktop-app/src/__tests__/chatStore.test.ts
@@ -880,20 +880,15 @@ describe('messages', () => {
},
])
- await store.replaceMessages(
- 'agent-1',
- 'bounded-window',
- [
- {
- id: 'turn-999-user',
- role: 'user',
- content: 'newest',
- timestamp: 999,
- serverTurnNumber: 999,
- },
- ],
- { replaceLocalWindow: true }
- )
+ await store.replaceMessages('agent-1', 'bounded-window', [
+ {
+ id: 'turn-999-user',
+ role: 'user',
+ content: 'newest',
+ timestamp: 999,
+ serverTurnNumber: 999,
+ },
+ ])
expect(
(await store.loadMessages('agent-1', 'bounded-window')).map(message => message.id)
diff --git a/desktop-app/src/ipc.ts b/desktop-app/src/ipc.ts
index ed42601c5..f1c7e888a 100644
--- a/desktop-app/src/ipc.ts
+++ b/desktop-app/src/ipc.ts
@@ -1180,7 +1180,6 @@ export function registerIpcHandlers(service: AppService): void {
messages as import('./types.js').ChatMessage[],
{
activeTaskIds,
- replaceLocalWindow: payload?.options?.replaceLocalWindow === true,
}
)
}
diff --git a/desktop-app/src/types.ts b/desktop-app/src/types.ts
index ff409cef0..e1cc88033 100644
--- a/desktop-app/src/types.ts
+++ b/desktop-app/src/types.ts
@@ -1046,12 +1046,10 @@ export interface ChatMessage {
* Controls how an authoritative server page is persisted locally.
*
* `activeTaskIds` lets the main process protect the same optimistic slots as
- * the renderer. `replaceLocalWindow` marks the bounded latest-page fallback;
- * it still merges into local history rather than truncating the whole chat.
+ * the renderer while merging the authoritative window into local history.
*/
export interface ReplaceChatMessagesOptions {
activeTaskIds?: string[]
- replaceLocalWindow?: boolean
}
/**
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/switchToChat.unified.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/switchToChat.unified.test.tsx
index 61746683d..6a622f4cd 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/switchToChat.unified.test.tsx
+++ b/desktop-app/ui/src/hooks/domain/__tests__/switchToChat.unified.test.tsx
@@ -403,11 +403,7 @@ describe('switchToChat (unified, D.4)', () => {
expect.arrayContaining([
expect.objectContaining({ id: 'turn-2-user' }),
expect.objectContaining({ id: 'turn-999-assistant' }),
- ]),
- {
- activeTaskIds: undefined,
- replaceLocalWindow: true,
- }
+ ])
)
})
@@ -1111,7 +1107,6 @@ describe('switchToChat (unified, D.4)', () => {
expect.arrayContaining([expect.objectContaining({ id: 'turn-1-user' })]),
{
activeTaskIds: ['task-p1a'],
- replaceLocalWindow: false,
}
)
})
diff --git a/desktop-app/ui/src/hooks/domain/useAgentChatController.ts b/desktop-app/ui/src/hooks/domain/useAgentChatController.ts
index dc3c97bb8..b7bcdf3a6 100644
--- a/desktop-app/ui/src/hooks/domain/useAgentChatController.ts
+++ b/desktop-app/ui/src/hooks/domain/useAgentChatController.ts
@@ -106,10 +106,10 @@ const MAX_MESSAGES_WITH_ACTIVITY_PER_AGENT = 50
const LOCAL_MESSAGE_PAGE_SIZE = 80
const SERVER_TURN_PAGE_SIZE = 40
const MAX_RECONCILE_DELTA_PAGES = 5
-const REPLACE_LOCAL_RECONCILIATION_WINDOW = Symbol('replace-local-reconciliation-window')
+const LATEST_PAGE_FALLBACK_WINDOW = Symbol('latest-page-fallback-window')
const DELTA_RECONCILIATION_WINDOW = Symbol('delta-reconciliation-window')
type ReconciliationMessagesResult = SessionMessagesResult & {
- [REPLACE_LOCAL_RECONCILIATION_WINDOW]?: true
+ [LATEST_PAGE_FALLBACK_WINDOW]?: true
[DELTA_RECONCILIATION_WINDOW]?: true
}
@@ -1432,8 +1432,8 @@ export function useAgentChatController({
return []
})) as AgentChatMessage[]
const visible = isActive() ? chatMessagesRef.current : []
- const replaceLocalWindow =
- (resp as ReconciliationMessagesResult)[REPLACE_LOCAL_RECONCILIATION_WINDOW] === true
+ const latestPageFallback =
+ (resp as ReconciliationMessagesResult)[LATEST_PAGE_FALLBACK_WINDOW] === true
const deltaWindow =
(resp as ReconciliationMessagesResult)[DELTA_RECONCILIATION_WINDOW] === true
const hasOlderFromServer = !deltaWindow && Boolean(resp.hasMoreBefore)
@@ -1471,7 +1471,7 @@ export function useAgentChatController({
: hydratedWithAttachments
const hasOlderAfterMerge =
hasOlderFromServer || nextServerBackfillBeforeTurn(rendered) !== undefined
- if (replaceLocalWindow) {
+ if (latestPageFallback) {
setHasOlderMessages(hasOlderAfterMerge)
} else {
setHasOlderMessages(previous => previous || hasOlderAfterMerge)
@@ -1482,10 +1482,9 @@ export function useAgentChatController({
chatMessagesRef.current = rendered
setChatMessages(rendered)
const meta = await chatStore.createChat(agentRef, chatId)
- if (resp.activeTaskId || replaceLocalWindow) {
+ if (resp.activeTaskId) {
await chatStore.replaceMessages(agentRef, chatId, rendered, {
- activeTaskIds: resp.activeTaskId ? [resp.activeTaskId] : undefined,
- replaceLocalWindow,
+ activeTaskIds: [resp.activeTaskId],
})
} else {
await chatStore.replaceMessages(agentRef, chatId, rendered)
@@ -1788,7 +1787,7 @@ export function useAgentChatController({
turns: combinedTurns,
oldestTurnNumber: combinedTurns[0]?.number ?? latest.oldestTurnNumber,
latestTurnNumber: combinedTurns.at(-1)?.number ?? latest.latestTurnNumber,
- [REPLACE_LOCAL_RECONCILIATION_WINDOW]: true,
+ [LATEST_PAGE_FALLBACK_WINDOW]: true,
} satisfies ReconciliationMessagesResult
}
return {