From 6ee73fa22f71e038d4547a58d2096be7ac7a75c4 Mon Sep 17 00:00:00 2001 From: waleed Date: Thu, 12 Feb 2026 12:28:47 -0800 Subject: [PATCH] update change detection to account for synthetic tool ids --- apps/sim/lib/workflows/comparison/normalize.test.ts | 12 ++++++++++++ apps/sim/lib/workflows/comparison/normalize.ts | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/sim/lib/workflows/comparison/normalize.test.ts b/apps/sim/lib/workflows/comparison/normalize.test.ts index 2cf9b925a..9aa6c9b12 100644 --- a/apps/sim/lib/workflows/comparison/normalize.test.ts +++ b/apps/sim/lib/workflows/comparison/normalize.test.ts @@ -645,6 +645,18 @@ describe('Workflow Normalization Utilities', () => { const result = filterSubBlockIds(ids) expect(result).toEqual(['signingSecret']) }) + + it.concurrent('should exclude synthetic tool-input subBlock IDs', () => { + const ids = [ + 'toolConfig', + 'toolConfig-tool-0-query', + 'toolConfig-tool-0-url', + 'toolConfig-tool-1-status', + 'systemPrompt', + ] + const result = filterSubBlockIds(ids) + expect(result).toEqual(['systemPrompt', 'toolConfig']) + }) }) describe('normalizeTriggerConfigValues', () => { diff --git a/apps/sim/lib/workflows/comparison/normalize.ts b/apps/sim/lib/workflows/comparison/normalize.ts index 4a8ce18a2..70a584141 100644 --- a/apps/sim/lib/workflows/comparison/normalize.ts +++ b/apps/sim/lib/workflows/comparison/normalize.ts @@ -411,7 +411,14 @@ export function extractBlockFieldsForComparison(block: BlockState): ExtractedBlo } /** - * Filters subBlock IDs to exclude system and trigger runtime subBlocks. + * Pattern matching synthetic subBlock IDs created by ToolSubBlockRenderer. + * These IDs follow the format `{subBlockId}-tool-{index}-{paramId}` and are + * mirrors of values already stored in toolConfig.value.tools[N].params. + */ +const SYNTHETIC_TOOL_SUBBLOCK_RE = /-tool-\d+-/ + +/** + * Filters subBlock IDs to exclude system, trigger runtime, and synthetic tool subBlocks. * * @param subBlockIds - Array of subBlock IDs to filter * @returns Filtered and sorted array of subBlock IDs @@ -422,6 +429,7 @@ export function filterSubBlockIds(subBlockIds: string[]): string[] { if (TRIGGER_RUNTIME_SUBBLOCK_IDS.includes(id)) return false if (SYSTEM_SUBBLOCK_IDS.some((sysId) => id === sysId || id.startsWith(`${sysId}_`))) return false + if (SYNTHETIC_TOOL_SUBBLOCK_RE.test(id)) return false return true }) .sort()