From fd55cb98fe29d3df0054d3f3e6e6f15958ea72ab Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Thu, 15 Oct 2026 12:36:06 +0200 Subject: [PATCH] fix(ui): take the agentic turns default from DEFAULT_AGENTIC_CONFIG (#30582) The registry hard-coded 10 for AGENTIC_MAX_TURNS while DEFAULT_AGENTIC_CONFIG said 100. The registry seeds SETTING_CONFIG_DEFAULT, so the loop's `|| DEFAULT_AGENTIC_CONFIG.maxTurns` fallback never fires and users got 10 turns. Reference the shared constant, as the adjacent MCP timeout does. Assisted by: llama-ui (ggml-org/Qwen3.8-Flash-Next:IQ4_NL) --- .../ui/src/lib/constants/settings.constants.ts | 3 ++- .../unit/agentic-max-turns-default.test.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tools/ui/tests/unit/agentic-max-turns-default.test.ts diff --git a/tools/ui/src/lib/constants/settings.constants.ts b/tools/ui/src/lib/constants/settings.constants.ts index f6596bfb6..9d01f3ad0 100644 --- a/tools/ui/src/lib/constants/settings.constants.ts +++ b/tools/ui/src/lib/constants/settings.constants.ts @@ -1,3 +1,4 @@ +import { DEFAULT_AGENTIC_CONFIG } from './agentic.constants'; import { CLI_FLAGS } from './cli-flags.constants'; import { DEFAULT_MCP_CONFIG } from './mcp.constants'; import { SETTINGS_KEYS } from './settings-keys.constants'; @@ -351,7 +352,7 @@ export const SETTINGS_REGISTRY: SettingsSectionEntry[] = [ icon: ListRestart, settings: [ { - defaultValue: 10, + defaultValue: DEFAULT_AGENTIC_CONFIG.maxTurns, help: 'Maximum number of tool execution cycles before stopping (prevents infinite loops).', isPositiveInteger: true, key: SETTINGS_KEYS.AGENTIC_MAX_TURNS, diff --git a/tools/ui/tests/unit/agentic-max-turns-default.test.ts b/tools/ui/tests/unit/agentic-max-turns-default.test.ts new file mode 100644 index 000000000..91475231b --- /dev/null +++ b/tools/ui/tests/unit/agentic-max-turns-default.test.ts @@ -0,0 +1,18 @@ +import { DEFAULT_AGENTIC_CONFIG, SETTINGS_KEYS } from '$lib/constants'; +import { describe, expect, it } from 'vitest'; + +/** + * The registry `defaultValue` is the effective default: the store seeds its + * config from SETTING_CONFIG_DEFAULT, so the loop's + * `Number(setting) || DEFAULT_AGENTIC_CONFIG.maxTurns` fallback never fires. + * Once these disagreed (10 vs 100) and the loop silently stopped early. + */ +describe('AGENTIC_MAX_TURNS default value', () => { + it('sources the settings default from DEFAULT_AGENTIC_CONFIG.maxTurns', async () => { + const { SETTING_CONFIG_DEFAULT } = await import('$lib/constants'); + + expect(SETTING_CONFIG_DEFAULT[SETTINGS_KEYS.AGENTIC_MAX_TURNS]).toBe( + DEFAULT_AGENTIC_CONFIG.maxTurns + ); + }, 15000); +});