From e9e79d2ff87dcc7cc19c2ca97f70f2a95a855fa9 Mon Sep 17 00:00:00 2001 From: brennanb2025 Date: Thu, 30 Apr 2026 18:37:15 -0700 Subject: [PATCH] fix(persistence): tighten inline-agents migration narrowing + document flag stamp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Drop unreachable `?? []` fallback; gate the migratedCardProps ternary on Array.isArray so the spread narrows cleanly. - Extend the Why: block to call out that the flag is stamped on every successful load, including when the experiment is off — future opt-ins are handled by the ExperimentalPane handler rather than re-firing here. Co-authored-by: Orca --- src/main/persistence.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/persistence.ts b/src/main/persistence.ts index 8f0ae99f8a0..0e9f89b8dc8 100644 --- a/src/main/persistence.ts +++ b/src/main/persistence.ts @@ -166,6 +166,10 @@ export class Store { // array when the experimental toggle is true; the flag prevents // re-firing so a deliberate uncheck from the Workspaces view // options menu sticks across restarts. + // The flag is stamped on every successful load — including when + // the experiment is off — so that a later flip-on is handled by + // the renderer's ExperimentalPane handler rather than re-firing + // this migration. const rawCardProps = parsed.ui?.worktreeCardProperties const inlineAgentsMigrated = parsed.ui?._inlineAgentsDefaultedForExperiment === true const experimentOn = parsed.settings?.experimentalAgentDashboard === true @@ -174,9 +178,10 @@ export class Store { experimentOn && Array.isArray(rawCardProps) && !rawCardProps.includes('inline-agents') - const migratedCardProps = needsInlineAgentsMigration - ? [...(rawCardProps ?? []), 'inline-agents' as const] - : undefined + const migratedCardProps = + needsInlineAgentsMigration && Array.isArray(rawCardProps) + ? [...rawCardProps, 'inline-agents' as const] + : undefined return { ...defaults.ui, ...parsed.ui,