Skip to content

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

TypeScript

fix: close desktop review and CodeQL gaps

Josué10f14d6c5e30
diff --git a/desktop-app/package-lock.json b/desktop-app/package-lock.json
index d78d2a0a9..ad1629d86 100644
--- a/desktop-app/package-lock.json
+++ b/desktop-app/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "evenfire",
- "version": "0.1.329",
+ "version": "0.1.330",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "evenfire",
- "version": "0.1.329",
+ "version": "0.1.330",
"license": "MPL-2.0",
"dependencies": {
"@tanstack/react-query": "5.100.10",
diff --git a/desktop-app/package.json b/desktop-app/package.json
index e25374665..e7643c29a 100644
--- a/desktop-app/package.json
+++ b/desktop-app/package.json
@@ -1,7 +1,7 @@
{
"name": "evenfire",
"productName": "Evenfire",
- "version": "0.1.329",
+ "version": "0.1.330",
"private": true,
"license": "MPL-2.0",
"description": "Evenfire desktop client for secure agent and workflow access",
diff --git a/desktop-app/src/__tests__/chatStore.test.ts b/desktop-app/src/__tests__/chatStore.test.ts
index eb4f11dc1..21a91732e 100644
--- a/desktop-app/src/__tests__/chatStore.test.ts
+++ b/desktop-app/src/__tests__/chatStore.test.ts
@@ -907,6 +907,8 @@ describe('messages', () => {
errorCount: 1,
toolCallCount: 1,
})
+ const migratedIndex = await readJsonFile<{ version: number }>(agentPath('index.json'))
+ expect(migratedIndex.version).toBe(3)
})
it('does not hide a failed legacy migration as an empty chat', async () => {
diff --git a/desktop-app/src/appService.ts b/desktop-app/src/appService.ts
index dd9436764..d4d25f0bb 100644
--- a/desktop-app/src/appService.ts
+++ b/desktop-app/src/appService.ts
@@ -533,15 +533,17 @@ export class AppService {
}
private async restoreSavedSession(options: { runLaunchMaintenance?: boolean } = {}) {
- if (this.restoreSavedSessionInFlight) return this.restoreSavedSessionInFlight
+ if (this.restoreSavedSessionInFlight) {
+ return await this.restoreSavedSessionInFlight
+ }
const restore = this.restoreSavedSessionOnce(options)
this.restoreSavedSessionInFlight = restore
try {
return await restore
} finally {
- if (this.restoreSavedSessionInFlight === restore) {
- this.restoreSavedSessionInFlight = null
- }
+ // No newer restore can start while this promise is installed, so the
+ // single-flight slot can be cleared unconditionally after it settles.
+ this.restoreSavedSessionInFlight = null
}
}
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/pendingChatSelection.characterization.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/pendingChatSelection.characterization.test.tsx
index 74337d62b..5fc51acfc 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/pendingChatSelection.characterization.test.tsx
+++ b/desktop-app/ui/src/hooks/domain/__tests__/pendingChatSelection.characterization.test.tsx
@@ -76,6 +76,39 @@ describe('pendingChatSelection effect', () => {
await waitFor(() => expect(result.current.activeChatId).toBe('server-latest'))
})
+ it('does not fabricate message totals for summaries from older servers', async () => {
+ clerum.chat.getIndex.mockResolvedValue({
+ version: 3,
+ lastActiveChatId: null,
+ onboardingDismissed: false,
+ chats: [],
+ })
+ clerum.rpc.listSessions.mockResolvedValue({
+ items: [
+ {
+ agent: 'agent-x',
+ chatId: 'legacy-summary',
+ turnCount: 7,
+ lastActivityAt: '2026-05-01T00:00:00Z',
+ },
+ ],
+ })
+
+ const { result } = renderController({ navItem: 'chat' })
+
+ await waitFor(() =>
+ expect(result.current.chatList).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({
+ id: 'legacy-summary',
+ messageCount: 0,
+ turnCount: 7,
+ }),
+ ])
+ )
+ )
+ })
+
it('latest → switches to the most recent chat', async () => {
clerum.chat.getIndex.mockResolvedValue({
version: 1,
diff --git a/desktop-app/ui/src/hooks/domain/useChatListController.ts b/desktop-app/ui/src/hooks/domain/useChatListController.ts
index f235e4400..ffc2bd452 100644
--- a/desktop-app/ui/src/hooks/domain/useChatListController.ts
+++ b/desktop-app/ui/src/hooks/domain/useChatListController.ts
@@ -83,6 +83,11 @@ function dedupeSidebarChats<T extends SidebarChatEntry>(chats: T[]): T[] {
})
}
+function knownServerMessageCount(session: SessionsListResult['items'][number]): number {
+ const count = session.messageCount
+ return typeof count === 'number' && Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0
+}
+
export function useChatListController({
selectedAgent,
agentNames,
@@ -186,7 +191,10 @@ export function useChatListController({
title: `Chat ${s.chatId.slice(0, 8)}`,
createdAt: s.lastActivityAt,
updatedAt: s.lastActivityAt,
- messageCount: s.messageCount ?? s.turnCount * 2,
+ // Older hosts omit messageCount. Keep that unknown value at zero
+ // instead of fabricating two messages per turn and overstating
+ // Activity totals when tool/system messages vary by session.
+ messageCount: knownServerMessageCount(s),
turnCount: s.turnCount,
}))
return [...dedupedPrevious, ...fromServerOnly].sort(byUpdatedDesc)
@@ -257,7 +265,7 @@ export function useChatListController({
title: `Chat ${s.chatId.slice(0, 8)}`,
createdAt: s.lastActivityAt,
updatedAt: s.lastActivityAt,
- messageCount: s.messageCount ?? s.turnCount * 2,
+ messageCount: knownServerMessageCount(s),
turnCount: s.turnCount,
}))
return [...dedupedPrevious, ...fromServerOnly].sort(byUpdatedDesc)
@@ -598,7 +606,7 @@ export function useChatListController({
title: `Remote · ${session.chatId.slice(0, 8)}`,
createdAt: session.lastActivityAt,
updatedAt: session.lastActivityAt,
- messageCount: session.messageCount ?? session.turnCount * 2,
+ messageCount: knownServerMessageCount(session),
remote: true,
turnCount: session.turnCount,
agentRef: group.agentRef,