Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(group): one skip per click, no regenerate for a member who left, a removed member stops speaking

purple8634bd78bff0
diff --git a/src/components/chat/GroupRoundBar.tsx b/src/components/chat/GroupRoundBar.tsx
index 052fb69b..a551d4c0 100644
--- a/src/components/chat/GroupRoundBar.tsx
+++ b/src/components/chat/GroupRoundBar.tsx
@@ -52,7 +52,7 @@ export function GroupRoundBar({ onStop }: { onStop: () => void }) {
<span className="truncate">{memberLabel(live.speaker, speakers)}</span>
</span>
<button
- onClick={() => skipGroupSpeaker(convId)}
+ onClick={() => skipGroupSpeaker(convId, live.index)}
disabled={live.index + 1 >= live.total}
data-testid="group-skip-speaker"
title={live.index + 1 >= live.total ? 'This is the last speaker of the round' : 'Stop this speaker and go on with the next one'}
diff --git a/src/components/chat/MessageList.tsx b/src/components/chat/MessageList.tsx
index a9ceb21c..d6abb771 100644
--- a/src/components/chat/MessageList.tsx
+++ b/src/components/chat/MessageList.tsx
@@ -106,6 +106,14 @@ export function MessageList({ isGenerating, isThisChatGenerating, isLoadingModel
[groupModels, groupPersonas, personas, listedModels, inventoryLoaded],
)
const authors = useMemo(() => ({ groupPersonas, personas }), [groupPersonas, personas])
+ // Who can be asked again: a speaker's own Regenerate asks only that member,
+ // so it is not offered on the turn of one who left the group or whose model
+ // is not listed now. It used to stand there and do nothing (T1 2026-10-29,
+ // A9). "Regenerate whole round" stays: it runs the members who are here.
+ const atTable = useMemo(
+ () => new Set(availableGroupMembers(groupModels ?? [], listedModels, inventoryLoaded)),
+ [groupModels, listedModels, inventoryLoaded],
+ )
// Agent mode of THIS chat: a short "I can't ..." there is usually about a
// file or a command, so the refusal notice stays out (lib/refusal-detect).
@@ -302,6 +310,7 @@ export function MessageList({ isGenerating, isThisChatGenerating, isLoadingModel
// never reports usage would lose the action bar for good.
isStreaming={showTyping && message.id === lastVisibleId && message.role === 'assistant'}
onRegenerate={message.role === 'assistant' && onRegenerate && !isGenerating && !message.greetings
+ && !(groupOn && message.modelId && !atTable.has(message.modelId))
? handleRegenerate
: undefined}
onRegenerateRound={groupOn && message.role === 'assistant' && onRegenerate && !isGenerating && message.modelId
diff --git a/src/components/chat/__tests__/group-order-and-round-controls.test.tsx b/src/components/chat/__tests__/group-order-and-round-controls.test.tsx
index 68cc8dca..45735134 100644
--- a/src/components/chat/__tests__/group-order-and-round-controls.test.tsx
+++ b/src/components/chat/__tests__/group-order-and-round-controls.test.tsx
@@ -109,6 +109,9 @@ describe('GH #200: the round bar', () => {
expect(screen.getByTestId('group-round-speaker').textContent).toBe('2/3baron')
fireEvent.click(screen.getByTestId('group-skip-speaker'))
expect(skip).toHaveBeenCalledTimes(1)
+ // A double click is one skip (T1 A8): it used to end the next turn too.
+ fireEvent.click(screen.getByTestId('group-skip-speaker'))
+ expect(skip).toHaveBeenCalledTimes(1)
fireEvent.click(screen.getByTestId('group-stop-round'))
expect(stop).toHaveBeenCalledTimes(1)
groupRoundEnded(convId)
@@ -171,6 +174,16 @@ describe('GH #199: regenerate in a group', () => {
expect(one).toHaveBeenCalledWith(convId, 'c1', 'only')
})
+ it('a member who left the group is not offered to be asked again, the round still is (T1 A9)', () => {
+ seedRound()
+ useChatStore.getState().setGroupModels(convId, [A, B])
+ const one = vi.fn(async () => true)
+ render(<MessageList isGenerating={false} onRegenerate={() => {}} onRegenerateSpeaker={one} />)
+ // walt and baron keep theirs; clara's answer has none any more.
+ expect(screen.getAllByRole('button', { name: 'Regenerate response' })).toHaveLength(2)
+ expect(screen.getAllByTestId('regenerate-round')).toHaveLength(3)
+ })
+
it('"Regenerate whole round" is its own action', () => {
seedRound()
const one = vi.fn(async () => true)
diff --git a/src/hooks/__tests__/group-round-control.test.ts b/src/hooks/__tests__/group-round-control.test.ts
index 044d78c9..f7f8345b 100644
--- a/src/hooks/__tests__/group-round-control.test.ts
+++ b/src/hooks/__tests__/group-round-control.test.ts
@@ -219,6 +219,43 @@ describe('GH #200: order, who answers, skip', () => {
expect(skipGroupSpeaker(id)).toBe(false)
})
+ it('a double click on "Skip speaker" skips one speaker, not two (T1 A8)', async () => {
+ const id = openGroup()
+ hang.add('walt')
+ hang.add('baron')
+ const { result } = renderHook(() => useChat())
+ let round!: Promise<void>
+ act(() => { round = result.current.sendMessage('go') })
+ await vi.waitFor(() => expect(asked()).toEqual(['walt']))
+ const t = Date.now()
+ expect(skipGroupSpeaker(id, 0, t)).toBe(true)
+ await vi.waitFor(() => expect(useGroupRoundStore.getState().live[id]?.index).toBe(1))
+ // The second click of the pair: once as the button showed it (walt's
+ // place), once after the bar had already moved on to baron.
+ expect(skipGroupSpeaker(id, 0, t + 60)).toBe(false)
+ expect(skipGroupSpeaker(id, 1, t + 60)).toBe(false)
+ await vi.waitFor(() => expect(asked()).toEqual(['walt', 'baron']))
+ // baron is still speaking; a later, separate click skips him.
+ expect(useGroupRoundStore.getState().live[id]).toMatchObject({ speaker: B, index: 1 })
+ expect(skipGroupSpeaker(id, 1, t + 2000)).toBe(true)
+ await act(async () => { await round })
+ expect(asked()).toEqual(['walt', 'baron', 'clara'])
+ })
+
+ it('a member taken out of the group while the round runs does not speak in it (T1 A10)', async () => {
+ const id = openGroup()
+ hang.add('walt')
+ const { result } = renderHook(() => useChat())
+ let round!: Promise<void>
+ act(() => { round = result.current.sendMessage('go') })
+ await vi.waitFor(() => expect(asked()).toEqual(['walt']))
+ useChatStore.getState().setGroupModels(id, [A, B])
+ expect(skipGroupSpeaker(id, 0)).toBe(true)
+ await act(async () => { await round })
+ expect(asked()).toEqual(['walt', 'baron'])
+ expect(said(id)).toEqual(['baron 1'])
+ })
+
it('what a skipped speaker had already written stays in the chat', async () => {
// Found on the Mac build: a window in the background paints no frames, so
// the streamed words had never reached the store when the skip came, and
diff --git a/src/hooks/useChat.ts b/src/hooks/useChat.ts
index 93938747..a267547e 100644
--- a/src/hooks/useChat.ts
+++ b/src/hooks/useChat.ts
@@ -732,6 +732,13 @@ export function useChat() {
try {
for (const [index, model] of models.entries()) {
if (abort.signal.aborted) break
+ // Taken out of the group while the round ran: it does not speak
+ // in it any more, like a member set to sit out (T1 2026-10-29,
+ // A10: one wrote 63 623 characters after it was removed).
+ if (!(useChatStore.getState().conversations.find((c) => c.id === convId)?.groupModels ?? []).includes(model)) {
+ log.info('chat.group_speaker_left_mid_round', { convId, index })
+ continue
+ }
// Each turn has a controller of its own under the round's: Stop
// ends the round, "Skip speaker" (GH #200) ends this turn only and
// the next speaker takes over.
diff --git a/src/stores/groupRoundStore.ts b/src/stores/groupRoundStore.ts
index e57e201d..0cc300a5 100644
--- a/src/stores/groupRoundStore.ts
+++ b/src/stores/groupRoundStore.ts
@@ -19,17 +19,25 @@ export interface GroupRoundLive {
export const useGroupRoundStore = create<{ live: Record<string, GroupRoundLive> }>(() => ({ live: {} }))
-const skippers = new Map<string, () => void>()
+const skippers = new Map<string, { index: number; skip: () => void }>()
+/** When the last skip of a chat's round went through. */
+const lastSkip = new Map<string, number>()
+
+/** A second "Skip speaker" this soon after one is the same click twice. A
+ * double click used to skip the next speaker too, before a word of it showed
+ * (T1 2026-10-29, A8). */
+export const SKIP_REPEAT_MS = 600
/** The round of `convId` has moved on to `live.speaker`; `skip` ends that turn only. */
export function groupTurnStarted(convId: string, live: GroupRoundLive, skip: () => void): void {
- skippers.set(convId, skip)
+ skippers.set(convId, { index: live.index, skip })
useGroupRoundStore.setState((s) => ({ live: { ...s.live, [convId]: live } }))
}
/** The round of `convId` is over. */
export function groupRoundEnded(convId: string): void {
skippers.delete(convId)
+ lastSkip.delete(convId)
useGroupRoundStore.setState((s) => {
if (!(convId in s.live)) return s
const { [convId]: _gone, ...rest } = s.live
@@ -39,10 +47,15 @@ export function groupRoundEnded(convId: string): void {
}
/** "Skip speaker": end the turn that runs and go on with the next speaker.
- * False when no round of this chat is running. */
-export function skipGroupSpeaker(convId: string): boolean {
- const skip = skippers.get(convId)
- if (!skip) return false
- skip()
+ * `index` is the place the button showed when it was clicked: a click meant
+ * for a speaker who is already gone ends nobody else's turn. False when no
+ * round of this chat is running, or the click was not taken. */
+export function skipGroupSpeaker(convId: string, index?: number, now: number = Date.now()): boolean {
+ const turn = skippers.get(convId)
+ if (!turn) return false
+ if (index !== undefined && index !== turn.index) return false
+ if (now - (lastSkip.get(convId) ?? -Infinity) < SKIP_REPEAT_MS) return false
+ lastSkip.set(convId, now)
+ turn.skip()
return true
}