Skip to content

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

test: the room gets the !reset notice for a size refusal, and Console still reads it

raullopez-sandbox2ae9ec8681ea
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-session-starting.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-session-starting.test.ts
index 8d6dbee98..86244ec28 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chat-session-starting.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-session-starting.test.ts
@@ -92,6 +92,15 @@ describe('turn-end notices', () => {
reason: null,
});
expect(read('I finished without replying.')).toEqual({ outcome: 'completed', reason: null });
+ expect(
+ read(
+ 'I finished without replying. The turn failed: exceeds 30.000MB limit.\n\nUse !reset to start a fresh session, then send your message again.'
+ )
+ ).toEqual({
+ outcome: 'failed',
+ reason:
+ 'exceeds 30.000MB limit.\n\nUse !reset to start a fresh session, then send your message again.',
+ });
});
it('leaves other messages alone', () => {
diff --git a/console/packages/agent-providers/src/host/session-host.test.ts b/console/packages/agent-providers/src/host/session-host.test.ts
index 9a9dcbf31..8b1d02035 100644
--- a/console/packages/agent-providers/src/host/session-host.test.ts
+++ b/console/packages/agent-providers/src/host/session-host.test.ts
@@ -1365,6 +1365,22 @@ it('tells the room once, in its thread, that a turn failed without posting', asy
expect(await roomReplyRecords(root)).toHaveLength(1);
});
+it('tells the room to !reset when the provider refused the turn for size', async () => {
+ const reply = vi.fn(async (_reply: RoomReply) => {});
+ const { host, emit, adapter } = await startReplying(reply);
+ await host.command(roomMessage('turn', 'thread'));
+ await until(() => expect(adapter.sendTurn).toHaveBeenCalledOnce());
+ const error = 'API Error: 400 The message size (30296644 bytes) exceeds 30.000MB limit.';
+ emit({ type: 'turn.completed', turnId: 'turn', outcome: 'error', message: error, usage: [] });
+ await until(() => expect(reply).toHaveBeenCalledOnce());
+ expect(reply).toHaveBeenCalledWith({
+ roomId: 'room',
+ threadId: 'thread',
+ body: `I finished without replying. The turn failed: ${error}\n\nUse !reset to start a fresh session, then send your message again.`,
+ });
+ await host.shutdown();
+});
+
it('leaves a room turn alone when the agent posted to the room during it', async () => {
const reply = vi.fn(async (_reply: RoomReply) => {});
const { host, emit, adapter } = await startReplying(reply);