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(console): a retried turn that fails shows, with Retry, under its message
raullopez-sandbox95512ad8fdf1
diff --git a/console/apps/switch-console-desktop/src/renderer/features/chats/activity-join.ts b/console/apps/switch-console-desktop/src/renderer/features/chats/activity-join.tsindex b63109d6f..304d96afc 100644--- a/console/apps/switch-console-desktop/src/renderer/features/chats/activity-join.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/chats/activity-join.ts@@ -4,6 +4,7 @@ import {TURN_ITEM_ID,} from '@shared/core/chats/activity';import { type ChatMessage, isSessionStartingNotice, turnEndNotice } from '@shared/core/chats/chats';+import { isControlAck } from './stop-rows';/*** Joining an agent's turns, as Switch's activity feed stores them, to the@@ -124,7 +125,8 @@ export function placeTurns(each.sender.kind === 'agent' &&each.sender.agentId === agentId &&!isSessionStartingNotice(each) &&- !turnEndNotice(each);+ !turnEndNotice(each) &&+ !isControlAck(each);messages.forEach((message, at) => {const turn = bound.get(message.messageId);if (!turn) return;@@ -168,7 +170,14 @@ export function foldTurnEndNotices(const turn = messages.slice(0, at).map((each) => bound.get(each.messageId))- .findLast((each) => each?.status === status && !claimed.has(each.turnId));+ .findLast(+ (each) =>+ each?.status === status &&+ !claimed.has(each.turnId) &&+ // A notice from before the turn started is about an earlier run of its+ // message (the one a retry ran again), not this one.+ !(each.items[0] && Date.parse(each.items[0].createdAt) > Date.parse(message.sentAt))+ );if (!turn) return;claimed.add(turn.turnId);folded.set(message.messageId, turn.turnId);diff --git a/console/apps/switch-console-desktop/src/renderer/features/chats/stop-rows.ts b/console/apps/switch-console-desktop/src/renderer/features/chats/stop-rows.tsindex f8f339d83..93cfd31b2 100644--- a/console/apps/switch-console-desktop/src/renderer/features/chats/stop-rows.ts+++ b/console/apps/switch-console-desktop/src/renderer/features/chats/stop-rows.ts@@ -45,3 +45,11 @@ export function hiddenStopRows(messages: readonly Row[]): Set<string> {}return hidden;}++/** An agent's acknowledgement of a Stop or Retry, which the chat leaves out: never where a turn shows. */+export function isControlAck(message: Pick<ChatMessage, 'body' | 'sender'>): boolean {+ return (+ message.sender.kind !== 'human' &&+ HIDDEN_COMMANDS.some(([, ack]) => message.body.startsWith(ack))+ );+}diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-activity.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-activity.test.tsindex a2135c71e..c99cf0740 100644--- a/console/apps/switch-console-desktop/src/renderer/tests/chat-activity.test.ts+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-activity.test.ts@@ -172,6 +172,32 @@ describe('placeTurns', () => {});});+ it('never shows a turn under a Retry’s acknowledgement, which the chat leaves out', () => {+ const at = (second: number) => new Date(Date.UTC(2026, 0, 1, 0, 0, second)).toISOString();+ const messages = [+ { ...said('q1', null), sentAt: at(0) },+ {+ ...said('failed', 'helper'),+ body: 'I finished without replying. The turn failed: model',+ sentAt: at(2),+ },+ { ...said('retry', null), body: '!retry @helper q1', sentAt: at(3) },+ {+ ...said('ack', 'helper'),+ body: 'Trying that message again.',+ threadRootId: 'retry',+ sentAt: at(4),+ },+ ] as ChatMessage[];+ const retried = {+ ...turn('t2', 'error'),+ items: [row('t2', 'tool', { createdAt: at(5) })],+ };+ expect(ids(placeTurns(messages, 'helper', new Map([['q1', retried]])))).toEqual({+ q1: ['t2'],+ });+ });+it('does not wait on a reply from a turn that ended with an error', () => {const messages = [said('q1', null), said('q2', null), said('r2', 'helper')];const bound = new Map([@@ -247,6 +273,19 @@ describe('foldTurnEndNotices', () => {);});+ it('folds the last failure into a turn run again for the same message, leaving the first shown', () => {+ const failed = 'I finished without replying. The turn failed: model not supported';+ const at = (second: number) => new Date(Date.UTC(2026, 0, 1, 0, 0, second)).toISOString();+ const messages = [+ { ...said('q1', null), sentAt: at(0) },+ { ...said('n1', 'helper', failed), sentAt: at(2) },+ { ...said('n2', 'helper', failed), sentAt: at(9) },+ ] as ChatMessage[];+ const retried = { ...turn('t2', 'error'), items: [row('t2', 'tool', { createdAt: at(5) })] };+ const bound = new Map([['q1', retried]]);+ expect(foldTurnEndNotices(messages, 'helper', bound)).toEqual(new Map([['n2', 't2']]));+ });+it('keeps a notice whose turn shows no such ending, or is not known', () => {const messages = [said('q1', null), said('n1', 'helper', interrupted)];expect(