Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
fix(agent-providers): lead the failed-turn reason with the !reset hint
raullopez-sandboxb5e8bc63d32e
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.tsindex 86244ec28..db07138fa 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@@ -94,12 +94,12 @@ describe('turn-end notices', () => {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.'+ 'I finished without replying. The turn failed: Use !reset to start a fresh session, then send your message again. exceeds 30.000MB limit.')).toEqual({outcome: 'failed',reason:- 'exceeds 30.000MB limit.\n\nUse !reset to start a fresh session, then send your message again.',+ 'Use !reset to start a fresh session, then send your message again. exceeds 30.000MB limit.',});});@@ -123,6 +123,6 @@ describe('turn-end notices', () => {// The host posts only a failed turn now; the others are still read, for// the notices older hosts left in a chat's history.expect(source).toContain(`\`${UNPOSTED_REPLY_MESSAGE} ${TURN_FAILED_PHRASE}\${reason}\``);- expect(source).toContain("? `: ${cap(detail.trim(), 1000)}` : '.'");+ expect(source).toContain("? `: ${hint}${cap(detail.trim(), 1000)}` : '.'");});});diff --git a/console/packages/agent-providers/src/host/session-host.test.ts b/console/packages/agent-providers/src/host/session-host.test.tsindex 8b1d02035..2fa386655 100644--- a/console/packages/agent-providers/src/host/session-host.test.ts+++ b/console/packages/agent-providers/src/host/session-host.test.ts@@ -1376,7 +1376,7 @@ it('tells the room to !reset when the provider refused the turn for size', asyncexpect(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.`,+ body: `I finished without replying. The turn failed: Use !reset to start a fresh session, then send your message again. ${error}`,});await host.shutdown();});@@ -1495,11 +1495,11 @@ it('says only that a turn failed, and why; nothing for one that finished or was);});-it('adds a !reset hint when the provider refuses the request for size', () => {- const hint = '\n\nUse !reset to start a fresh session, then send your message again.';+it('leads with a !reset hint when the provider refuses the request for size', () => {+ const hint = 'Use !reset to start a fresh session, then send your message again. ';const tooLarge = 'API Error: 400 The message size (30296644 bytes) exceeds 30.000MB limit.';expect(unpostedReply('error', tooLarge)).toBe(- `I finished without replying. The turn failed: ${tooLarge}${hint}`+ `I finished without replying. The turn failed: ${hint}${tooLarge}`);expect(unpostedReply('error', 'Prompt is too long')).toContain(hint);expect(unpostedReply('error', 'Other error')).toBe(diff --git a/console/packages/agent-providers/src/host/session-host.ts b/console/packages/agent-providers/src/host/session-host.tsindex 492b89c5d..003d394fa 100644--- a/console/packages/agent-providers/src/host/session-host.ts+++ b/console/packages/agent-providers/src/host/session-host.ts@@ -1393,11 +1393,11 @@ export class HostedSession {*/export function unpostedReply(outcome: TurnOutcome, detail: string | null): string | null {if (outcome !== 'error') return null;- const reason = detail?.trim() ? `: ${cap(detail.trim(), 1000)}` : '.';- const message = `I finished without replying. The turn failed${reason}`;- return REQUEST_TOO_LARGE.test(detail ?? '')- ? `${message}\n\nUse !reset to start a fresh session, then send your message again.`- : message;+ const hint = REQUEST_TOO_LARGE.test(detail ?? '')+ ? 'Use !reset to start a fresh session, then send your message again. '+ : '';+ const reason = detail?.trim() ? `: ${hint}${cap(detail.trim(), 1000)}` : '.';+ return `I finished without replying. The turn failed${reason}`;}const REQUEST_TOO_LARGE =