Skip to content

Commit 6ee73fa

Browse files
committed
update change detection to account for synthetic tool ids
1 parent b1cde02 commit 6ee73fa

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

apps/sim/lib/workflows/comparison/normalize.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,18 @@ describe('Workflow Normalization Utilities', () => {
645645
const result = filterSubBlockIds(ids)
646646
expect(result).toEqual(['signingSecret'])
647647
})
648+
649+
it.concurrent('should exclude synthetic tool-input subBlock IDs', () => {
650+
const ids = [
651+
'toolConfig',
652+
'toolConfig-tool-0-query',
653+
'toolConfig-tool-0-url',
654+
'toolConfig-tool-1-status',
655+
'systemPrompt',
656+
]
657+
const result = filterSubBlockIds(ids)
658+
expect(result).toEqual(['systemPrompt', 'toolConfig'])
659+
})
648660
})
649661

650662
describe('normalizeTriggerConfigValues', () => {

apps/sim/lib/workflows/comparison/normalize.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,14 @@ export function extractBlockFieldsForComparison(block: BlockState): ExtractedBlo
411411
}
412412

413413
/**
414-
* Filters subBlock IDs to exclude system and trigger runtime subBlocks.
414+
* Pattern matching synthetic subBlock IDs created by ToolSubBlockRenderer.
415+
* These IDs follow the format `{subBlockId}-tool-{index}-{paramId}` and are
416+
* mirrors of values already stored in toolConfig.value.tools[N].params.
417+
*/
418+
const SYNTHETIC_TOOL_SUBBLOCK_RE = /-tool-\d+-/
419+
420+
/**
421+
* Filters subBlock IDs to exclude system, trigger runtime, and synthetic tool subBlocks.
415422
*
416423
* @param subBlockIds - Array of subBlock IDs to filter
417424
* @returns Filtered and sorted array of subBlock IDs
@@ -422,6 +429,7 @@ export function filterSubBlockIds(subBlockIds: string[]): string[] {
422429
if (TRIGGER_RUNTIME_SUBBLOCK_IDS.includes(id)) return false
423430
if (SYSTEM_SUBBLOCK_IDS.some((sysId) => id === sysId || id.startsWith(`${sysId}_`)))
424431
return false
432+
if (SYNTHETIC_TOOL_SUBBLOCK_RE.test(id)) return false
425433
return true
426434
})
427435
.sort()

0 commit comments

Comments
 (0)