Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

fix(console): let a failed chat list be retried from the agent page (CHOO-3783)

raullopez-sandboxacbd7cf17059
diff --git a/console/apps/switch-console-desktop/src/renderer/features/managed-agents/agent-chats.tsx b/console/apps/switch-console-desktop/src/renderer/features/managed-agents/agent-chats.tsx
index 6085e8016..ca3a0a079 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/managed-agents/agent-chats.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/managed-agents/agent-chats.tsx
@@ -206,7 +206,17 @@ export const AgentChats = observer(function AgentChats({ agent }: { agent: Manag
onAdd={() => void newChat()}
addChoices={null}
>
- {chatsStore.listError && <Note>{chatsStore.listError}</Note>}
+ {ownServer && chatsStore.listError && (
+ <div
+ role="alert"
+ className="flex items-center justify-between gap-2 px-2 py-1 text-xs text-foreground-muted"
+ >
+ <span>{chatsStore.listError}</span>
+ <Button size="sm" variant="outline" onClick={() => void chatsStore.connect(serverId)}>
+ Try again
+ </Button>
+ </div>
+ )}
{direct.map((chat) => (
<ChatRow
key={chat.roomId}
@@ -216,7 +226,7 @@ export const AgentChats = observer(function AgentChats({ agent }: { agent: Manag
onOpen={() => open(chat.roomId)}
/>
))}
- {direct.length === 0 && <Note>No direct chats yet.</Note>}
+ {direct.length === 0 && !chatsStore.listError && <Note>No direct chats yet.</Note>}
</Section>
<Section
title="Rooms"
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts
index d2d472605..c36f8b51e 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts
@@ -308,6 +308,21 @@ describe('ChatsStore', () => {
expect(timeline.loadError).toBeNull();
});
+ it('lists again and clears the error when retried on the same server', async () => {
+ let up = false;
+ const { store, api } = setup(async () =>
+ up ? [summary('r1', 1)] : Promise.reject(new Error('Could not reach the server'))
+ );
+ await store.connect('s1');
+ expect(store.listError).not.toBeNull();
+
+ up = true;
+ await store.connect('s1');
+ expect(api.list).toHaveBeenCalledTimes(2);
+ expect(store.listError).toBeNull();
+ expect(store.chat('r1')?.name).toBe('r1');
+ });
+
it('reads a chat once the person is let into it after a refused first load', async () => {
const { store } = setup(async () => []);
await store.connect('s1');