Delete the legacy agent loop (#12760)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Douwe Osinga
2026-10-08 18:13:09 +00:00
committed by GitHub
parent a4189ec8c7
commit 3b094d7afe
85 changed files with 1257 additions and 8886 deletions
+1 -26
View File
@@ -7,7 +7,6 @@ vi.mock('../acpConnection', () => ({ getAcpClient: vi.fn() }));
describe('ACP Live voice', () => {
beforeEach(() => {
vi.clearAllMocks();
vi.mocked(window.electron.getSetting).mockResolvedValue(false);
});
it('uses the generated availability client for the displayed session', async () => {
@@ -27,7 +26,6 @@ describe('ACP Live voice', () => {
});
expect(sessionLiveVoiceAvailability).toHaveBeenCalledWith({
sessionId: 'main-session',
_meta: { goose: { unrolledAgentLoop: true } },
});
});
@@ -46,29 +44,7 @@ describe('ACP Live voice', () => {
status: 'unavailable',
message: 'Live voice is disabled',
});
expect(sessionLiveVoiceAvailability).toHaveBeenCalledWith({
_meta: { goose: { unrolledAgentLoop: true } },
});
});
it('passes the legacy loop selection to availability', async () => {
vi.mocked(window.electron.getSetting).mockResolvedValue(true);
const sessionLiveVoiceAvailability = vi.fn().mockResolvedValue({
status: 'unavailable',
message: 'Live voice is unavailable while Use Legacy Agent Loop is enabled',
});
vi.mocked(getAcpClient).mockResolvedValue({
goose: {
sessionLiveVoiceAvailability_unstable: sessionLiveVoiceAvailability,
},
} as unknown as Awaited<ReturnType<typeof getAcpClient>>);
await acpGetLiveVoiceAvailability('main-session');
expect(sessionLiveVoiceAvailability).toHaveBeenCalledWith({
sessionId: 'main-session',
_meta: { goose: { unrolledAgentLoop: false } },
});
expect(sessionLiveVoiceAvailability).toHaveBeenCalledWith({});
});
it('uses generated start and stop clients with the interaction ID', async () => {
@@ -92,7 +68,6 @@ describe('ACP Live voice', () => {
expect(start).toHaveBeenCalledWith({
sessionId: 'main-session',
offerSdp: 'offer',
_meta: { goose: { unrolledAgentLoop: true } },
});
expect(stop).toHaveBeenCalledWith({
sessionId: 'main-session',
+1 -7
View File
@@ -8,11 +8,7 @@ export async function acpGetLiveVoiceAvailability(
sessionId?: string
): Promise<LiveVoiceAvailabilityResponse_unstable> {
const { goose } = await getAcpClient();
const useLegacyAgentLoop = await window.electron.getSetting('useLegacyAgentLoop');
return goose.sessionLiveVoiceAvailability_unstable({
...(sessionId ? { sessionId } : {}),
_meta: { goose: { unrolledAgentLoop: !useLegacyAgentLoop } },
});
return goose.sessionLiveVoiceAvailability_unstable(sessionId ? { sessionId } : {});
}
export async function acpStartLiveVoice(
@@ -20,11 +16,9 @@ export async function acpStartLiveVoice(
offerSdp: string
): Promise<LiveVoiceStartResponse_unstable> {
const { goose } = await getAcpClient();
const useLegacyAgentLoop = await window.electron.getSetting('useLegacyAgentLoop');
return goose.sessionLiveVoiceStart_unstable({
sessionId,
offerSdp,
_meta: { goose: { unrolledAgentLoop: !useLegacyAgentLoop } },
});
}
+4 -3
View File
@@ -1,5 +1,8 @@
import { methods, type ContentBlock, type PromptResponse } from '@agentclientprotocol/sdk';
import type { SteerSessionRequest_unstable, SteerSessionResponse_unstable } from '@aaif/goose-acp-client';
import type {
SteerSessionRequest_unstable,
SteerSessionResponse_unstable,
} from '@aaif/goose-acp-client';
import type { Message } from '../types/message';
import { getAcpClient } from './acpConnection';
@@ -8,11 +11,9 @@ export async function acpPromptSession(
message: Message
): Promise<PromptResponse> {
const client = await getAcpClient();
const useLegacyAgentLoop = await window.electron.getSetting('useLegacyAgentLoop');
return client.connection.agent.request(methods.agent.session.prompt, {
sessionId,
prompt: messageToAcpPromptContent(message),
_meta: { goose: { unrolledAgentLoop: !useLegacyAgentLoop } },
});
}
@@ -1,8 +1,7 @@
import { type ReactNode, useEffect, useState } from 'react';
import { useConfig } from '../ConfigContext';
import { Input } from '../ui/input';
import { Switch } from '../ui/switch';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../ui/card';
import { Card, CardContent, CardHeader, CardTitle } from '../ui/card';
import { defineMessages, useIntl } from '../../i18n';
const i18n = defineMessages({
@@ -10,10 +9,6 @@ const i18n = defineMessages({
id: 'settings.agentLoop.title',
defaultMessage: 'Agent Loop',
},
description: {
id: 'settings.agentLoop.description',
defaultMessage: 'Use the operation-based agent loop. Turn this off to use the legacy loop.',
},
operationsHeading: {
id: 'settings.agentLoop.operations.heading',
defaultMessage: 'Configurable operations',
@@ -204,7 +199,6 @@ function NumberInput({
export default function AgentLoopSettings() {
const intl = useIntl();
const { read, remove, upsert } = useConfig();
const [enabled, setEnabled] = useState(true);
const [slashCommandsEnabled, setSlashCommandsEnabled] = useState(true);
const [toolPairCompactionEnabled, setToolPairCompactionEnabled] = useState(false);
const [numbers, setNumbers] = useState(defaultNumberSettings);
@@ -213,7 +207,6 @@ export default function AgentLoopSettings() {
let active = true;
Promise.all([
window.electron.getSetting('useLegacyAgentLoop'),
read('GOOSE_MAX_TURNS', false),
read('GOOSE_AUTO_COMPACT_THRESHOLD', false),
read('GOOSE_SLASH_COMMANDS_ENABLED', false),
@@ -224,7 +217,6 @@ export default function AgentLoopSettings() {
read('GOOSE_STOP_HOOK_BLOCK_CAP', false),
]).then(
([
useLegacyAgentLoop,
maxTurns,
compactionThreshold,
slashCommands,
@@ -236,7 +228,6 @@ export default function AgentLoopSettings() {
]) => {
if (!active) return;
setEnabled(!useLegacyAgentLoop);
setSlashCommandsEnabled(typeof slashCommands === 'boolean' ? slashCommands : true);
setToolPairCompactionEnabled(
typeof toolPairCompaction === 'boolean' ? toolPairCompaction : false
@@ -281,11 +272,6 @@ export default function AgentLoopSettings() {
await upsert(configKey, serialize(value), false);
};
const handleAgentLoopToggle = async (checked: boolean) => {
setEnabled(checked);
await window.electron.setSetting('useLegacyAgentLoop', !checked);
};
const handleToolPairCompactionToggle = async (checked: boolean) => {
setToolPairCompactionEnabled(checked);
await upsert('GOOSE_TOOL_PAIR_SUMMARIZATION', checked, false);
@@ -308,131 +294,121 @@ export default function AgentLoopSettings() {
<section className="pr-4">
<Card className="rounded-xl">
<CardHeader>
<div className="flex items-center justify-between gap-6">
<div>
<CardTitle>{intl.formatMessage(i18n.title)}</CardTitle>
<CardDescription className="mt-1">
{intl.formatMessage(i18n.description)}
</CardDescription>
</div>
<Switch checked={enabled} onCheckedChange={handleAgentLoopToggle} variant="mono" />
</div>
<CardTitle>{intl.formatMessage(i18n.title)}</CardTitle>
</CardHeader>
{enabled && (
<CardContent className="px-4">
<h3 className="mb-1 text-xs font-semibold uppercase tracking-wider text-text-secondary">
{intl.formatMessage(i18n.operationsHeading)}
</h3>
<CardContent className="px-4">
<h3 className="mb-1 text-xs font-semibold uppercase tracking-wider text-text-secondary">
{intl.formatMessage(i18n.operationsHeading)}
</h3>
<OperationRow
title={intl.formatMessage(i18n.slashCommandsTitle)}
description={intl.formatMessage(i18n.slashCommandsDescription)}
enabled={slashCommandsEnabled}
onEnabledChange={handleSlashCommandsToggle}
<OperationRow
title={intl.formatMessage(i18n.slashCommandsTitle)}
description={intl.formatMessage(i18n.slashCommandsDescription)}
enabled={slashCommandsEnabled}
onEnabledChange={handleSlashCommandsToggle}
/>
<OperationRow
title={intl.formatMessage(i18n.maxTurnsTitle)}
description={intl.formatMessage(i18n.maxTurnsDescription)}
>
<NumberInput
label={intl.formatMessage(i18n.turnsLabel)}
value={numbers.maxTurns}
min={1}
max={10000}
onChange={(value) => setNumber('maxTurns', value)}
onBlur={() => saveNumber('maxTurns', 'GOOSE_MAX_TURNS', 1, 10000)}
/>
</OperationRow>
<OperationRow
title={intl.formatMessage(i18n.maxTurnsTitle)}
description={intl.formatMessage(i18n.maxTurnsDescription)}
>
<OperationRow
title={intl.formatMessage(i18n.contextCompactionTitle)}
description={intl.formatMessage(i18n.contextCompactionDescription)}
>
<NumberInput
label={intl.formatMessage(i18n.thresholdLabel)}
value={numbers.compactionThreshold}
min={1}
max={99}
step={0.1}
onChange={(value) => setNumber('compactionThreshold', value)}
onBlur={() =>
saveNumber(
'compactionThreshold',
'GOOSE_AUTO_COMPACT_THRESHOLD',
1,
99,
(value) => value / 100,
false
)
}
/>
</OperationRow>
<OperationRow
title={intl.formatMessage(i18n.toolPairCompactionTitle)}
description={intl.formatMessage(i18n.toolPairCompactionDescription)}
enabled={toolPairCompactionEnabled}
onEnabledChange={handleToolPairCompactionToggle}
>
<div className="flex flex-wrap items-center gap-4">
<NumberInput
label={intl.formatMessage(i18n.turnsLabel)}
value={numbers.maxTurns}
label={intl.formatMessage(i18n.cutoffLabel)}
value={numbers.toolCallCutoff}
min={1}
max={10000}
onChange={(value) => setNumber('maxTurns', value)}
onBlur={() => saveNumber('maxTurns', 'GOOSE_MAX_TURNS', 1, 10000)}
max={100000}
placeholder={intl.formatMessage(i18n.autoPlaceholder)}
disabled={!toolPairCompactionEnabled}
onChange={(value) => setNumber('toolCallCutoff', value)}
onBlur={saveToolCallCutoff}
/>
</OperationRow>
</div>
</OperationRow>
<OperationRow
title={intl.formatMessage(i18n.contextCompactionTitle)}
description={intl.formatMessage(i18n.contextCompactionDescription)}
>
<OperationRow
title={intl.formatMessage(i18n.recipeRetryTitle)}
description={intl.formatMessage(i18n.recipeRetryDescription)}
>
<div className="flex flex-col gap-2">
<NumberInput
label={intl.formatMessage(i18n.thresholdLabel)}
value={numbers.compactionThreshold}
label={intl.formatMessage(i18n.retryTimeoutLabel)}
value={numbers.retryTimeout}
min={1}
max={99}
step={0.1}
onChange={(value) => setNumber('compactionThreshold', value)}
max={3600}
onChange={(value) => setNumber('retryTimeout', value)}
onBlur={() =>
saveNumber(
'compactionThreshold',
'GOOSE_AUTO_COMPACT_THRESHOLD',
1,
99,
(value) => value / 100,
false
)
saveNumber('retryTimeout', 'GOOSE_RECIPE_RETRY_TIMEOUT_SECONDS', 1, 3600)
}
/>
</OperationRow>
<OperationRow
title={intl.formatMessage(i18n.toolPairCompactionTitle)}
description={intl.formatMessage(i18n.toolPairCompactionDescription)}
enabled={toolPairCompactionEnabled}
onEnabledChange={handleToolPairCompactionToggle}
>
<div className="flex flex-wrap items-center gap-4">
<NumberInput
label={intl.formatMessage(i18n.cutoffLabel)}
value={numbers.toolCallCutoff}
min={1}
max={100000}
placeholder={intl.formatMessage(i18n.autoPlaceholder)}
disabled={!toolPairCompactionEnabled}
onChange={(value) => setNumber('toolCallCutoff', value)}
onBlur={saveToolCallCutoff}
/>
</div>
</OperationRow>
<OperationRow
title={intl.formatMessage(i18n.recipeRetryTitle)}
description={intl.formatMessage(i18n.recipeRetryDescription)}
>
<div className="flex flex-col gap-2">
<NumberInput
label={intl.formatMessage(i18n.retryTimeoutLabel)}
value={numbers.retryTimeout}
min={1}
max={3600}
onChange={(value) => setNumber('retryTimeout', value)}
onBlur={() =>
saveNumber('retryTimeout', 'GOOSE_RECIPE_RETRY_TIMEOUT_SECONDS', 1, 3600)
}
/>
<NumberInput
label={intl.formatMessage(i18n.failureTimeoutLabel)}
value={numbers.failureTimeout}
min={1}
max={3600}
onChange={(value) => setNumber('failureTimeout', value)}
onBlur={() =>
saveNumber('failureTimeout', 'GOOSE_RECIPE_ON_FAILURE_TIMEOUT_SECONDS', 1, 3600)
}
/>
</div>
</OperationRow>
<OperationRow
title={intl.formatMessage(i18n.stopHooksTitle)}
description={intl.formatMessage(i18n.stopHooksDescription)}
>
<NumberInput
label={intl.formatMessage(i18n.blockLimitLabel)}
value={numbers.stopHookBlockCap}
label={intl.formatMessage(i18n.failureTimeoutLabel)}
value={numbers.failureTimeout}
min={1}
max={100}
onChange={(value) => setNumber('stopHookBlockCap', value)}
onBlur={() => saveNumber('stopHookBlockCap', 'GOOSE_STOP_HOOK_BLOCK_CAP', 1, 100)}
max={3600}
onChange={(value) => setNumber('failureTimeout', value)}
onBlur={() =>
saveNumber('failureTimeout', 'GOOSE_RECIPE_ON_FAILURE_TIMEOUT_SECONDS', 1, 3600)
}
/>
</OperationRow>
</CardContent>
)}
</div>
</OperationRow>
<OperationRow
title={intl.formatMessage(i18n.stopHooksTitle)}
description={intl.formatMessage(i18n.stopHooksDescription)}
>
<NumberInput
label={intl.formatMessage(i18n.blockLimitLabel)}
value={numbers.stopHookBlockCap}
min={1}
max={100}
onChange={(value) => setNumber('stopHookBlockCap', value)}
onBlur={() => saveNumber('stopHookBlockCap', 'GOOSE_STOP_HOOK_BLOCK_CAP', 1, 100)}
/>
</OperationRow>
</CardContent>
</Card>
</section>
);
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Besuchen Sie"
},
"settings.agentLoop.description": {
"defaultMessage": "Verwende die operationsbasierte Agentenschleife. Deaktiviere sie, um die Legacy-Schleife zu verwenden."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Automatisch"
},
-3
View File
@@ -3977,9 +3977,6 @@
"sessions.toast.updated": {
"defaultMessage": "Session description updated successfully"
},
"settings.agentLoop.description": {
"defaultMessage": "Use the operation-based agent loop. Turn this off to use the legacy loop."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Auto"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Visita"
},
"settings.agentLoop.description": {
"defaultMessage": "Usa el bucle del agente basado en operaciones. Desactívalo para usar el bucle heredado."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Automático"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Visitez"
},
"settings.agentLoop.description": {
"defaultMessage": "Utilise la boucle d’agent basée sur les opérations. Désactivez-la pour utiliser la boucle héritée."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Automatique"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "जाएं"
},
"settings.agentLoop.description": {
"defaultMessage": "ऑपरेशन-आधारित एजेंट लूप का उपयोग करें। लेगेसी लूप का उपयोग करने के लिए इसे बंद करें।"
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "स्वचालित"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Kunjungi"
},
"settings.agentLoop.description": {
"defaultMessage": "Gunakan loop agen berbasis operasi. Matikan untuk menggunakan loop lama."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Otomatis"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Visita"
},
"settings.agentLoop.description": {
"defaultMessage": "Usa il ciclo agente basato sulle operazioni. Disattivalo per usare il ciclo legacy."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Automatico"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "次のURLにアクセスし、"
},
"settings.agentLoop.description": {
"defaultMessage": "オペレーションベースのエージェントループを使用します。オフにすると従来のループを使用します。"
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "自動"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "방문하여"
},
"settings.agentLoop.description": {
"defaultMessage": "작업 기반 에이전트 루프를 사용합니다. 기존 루프를 사용하려면 끄세요."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "자동"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Lawati"
},
"settings.agentLoop.description": {
"defaultMessage": "Gunakan gelung ejen berasaskan operasi. Matikan untuk menggunakan gelung legasi."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Automatik"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Acesse"
},
"settings.agentLoop.description": {
"defaultMessage": "Use o loop do agente baseado em operações. Desative-o para usar o loop legado."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Automático"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Перейдите на"
},
"settings.agentLoop.description": {
"defaultMessage": "Использовать цикл агента на основе операций. Отключите, чтобы использовать прежний цикл."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Автоматически"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Ziyaret edin"
},
"settings.agentLoop.description": {
"defaultMessage": "İşlem tabanlı ajan döngüsünü kullanır. Eski döngüyü kullanmak için kapatın."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Otomatik"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "Truy cập"
},
"settings.agentLoop.description": {
"defaultMessage": "Sử dụng vòng lặp tác nhân dựa trên thao tác. Tắt tùy chọn này để dùng vòng lặp cũ."
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "Tự động"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "访问"
},
"settings.agentLoop.description": {
"defaultMessage": "使用基于操作的代理循环。关闭后将使用旧版循环。"
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "自动"
},
-3
View File
@@ -4676,9 +4676,6 @@
"providerConfigurationModal.deviceCodeVisit": {
"defaultMessage": "前往"
},
"settings.agentLoop.description": {
"defaultMessage": "使用以操作為基礎的代理程式迴圈。關閉後將使用舊版迴圈。"
},
"settings.agentLoop.operations.auto.placeholder": {
"defaultMessage": "自動"
},
-1
View File
@@ -1930,7 +1930,6 @@ const validSettingKeys: Set<string> = new Set([
'seenAnnouncementIds',
'disableAutoDownload',
'recentModels',
'useLegacyAgentLoop',
]);
ipcMain.handle('set-setting', (_event, key: SettingKey, value: unknown) => {
-2
View File
@@ -55,7 +55,6 @@ export interface Settings {
showPricing: boolean;
seenAnnouncementIds: string[];
recentModels: RecentModel[];
useLegacyAgentLoop: boolean;
}
export type SettingKey = keyof Settings;
@@ -97,7 +96,6 @@ export const defaultSettings: Settings = {
showPricing: true,
seenAnnouncementIds: [],
recentModels: [],
useLegacyAgentLoop: false,
};
export function getKeyboardShortcuts(settings: Settings): KeyboardShortcuts {