From 7f4f999172a27d18be7075d34afba94e11ff7b4c Mon Sep 17 00:00:00 2001 From: "mux-bot[bot]" <264182336+mux-bot[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 05:08:09 +0000 Subject: [PATCH 1/2] refactor: remove dead toLiveBashOutputView function toLiveBashOutputView was exported but never imported or called anywhere. Since LiveBashOutputInternal extends LiveBashOutputView, the WorkspaceStore returns the internal object directly (for reference stability with useSyncExternalStore), making this converter unnecessary. --- src/browser/utils/messages/liveBashOutputBuffer.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/browser/utils/messages/liveBashOutputBuffer.ts b/src/browser/utils/messages/liveBashOutputBuffer.ts index 9ff0abaf74..efe26f927e 100644 --- a/src/browser/utils/messages/liveBashOutputBuffer.ts +++ b/src/browser/utils/messages/liveBashOutputBuffer.ts @@ -143,13 +143,3 @@ export function appendLiveBashOutputChunk( return next; } - -export function toLiveBashOutputView(state: LiveBashOutputInternal): LiveBashOutputView { - return { - stdout: state.stdout, - stderr: state.stderr, - combined: state.combined, - truncated: state.truncated, - phase: state.phase, - }; -} From 5b6745513a7db00dc24ab1f729d661ec0725974c Mon Sep 17 00:00:00 2001 From: "mux-bot[bot]" <264182336+mux-bot[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 12:24:37 +0000 Subject: [PATCH 2/2] refactor: deduplicate identical normalizeAdvisor* helpers into normalizePositiveIntOrNull normalizeAdvisorMaxUsesPerTurn and normalizeAdvisorMaxOutputTokens in AdvisorToolExperimentConfig.tsx had byte-for-byte identical bodies. Replace both with a single normalizePositiveIntOrNull helper. --- .../Sections/AdvisorToolExperimentConfig.tsx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/browser/features/Settings/Sections/AdvisorToolExperimentConfig.tsx b/src/browser/features/Settings/Sections/AdvisorToolExperimentConfig.tsx index 247a55430d..cedebfa6c4 100644 --- a/src/browser/features/Settings/Sections/AdvisorToolExperimentConfig.tsx +++ b/src/browser/features/Settings/Sections/AdvisorToolExperimentConfig.tsx @@ -58,15 +58,8 @@ function normalizeAdvisorModelString(value: string | null | undefined): string | return trimmedValue; } -function normalizeAdvisorMaxUsesPerTurn(value: number | null | undefined): number | null { - if (!Number.isInteger(value) || value == null || value <= 0) { - return null; - } - - return value; -} - -function normalizeAdvisorMaxOutputTokens(value: number | null | undefined): number | null { +/** Coerce a nullable number to a positive integer or null. */ +function normalizePositiveIntOrNull(value: number | null | undefined): number | null { if (!Number.isInteger(value) || value == null || value <= 0) { return null; } @@ -198,10 +191,8 @@ export function AdvisorToolExperimentConfig() { const normalizedModelString = normalizeAdvisorModelString(cfg.advisorModelString); const normalizedThinkingLevel = coerceThinkingLevel(cfg.advisorThinkingLevel) ?? THINKING_LEVEL_OFF; - const normalizedMaxUsesPerTurn = normalizeAdvisorMaxUsesPerTurn(cfg.advisorMaxUsesPerTurn); - const normalizedMaxOutputTokens = normalizeAdvisorMaxOutputTokens( - cfg.advisorMaxOutputTokens - ); + const normalizedMaxUsesPerTurn = normalizePositiveIntOrNull(cfg.advisorMaxUsesPerTurn); + const normalizedMaxOutputTokens = normalizePositiveIntOrNull(cfg.advisorMaxOutputTokens); // Match the backend starter cap when the setting is unset; only an explicit null is // the user's Unlimited opt-in. const nextMaxUsesMode: AdvisorMode =