Skip to content

Commit 96207d8

Browse files
authored
fix(subflows): add loops/parallels to accessible list of blocks in the tag dropdown when contained withitn a subflow (#2047)
* fix(subflows): add loops/parallels to accessible list of blocks in the tag dropdown when contained withitn a subflow * remove currentIteration in loop
1 parent a7fe1d3 commit 96207d8

8 files changed

Lines changed: 7 additions & 31 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
721721
if (currentLoop && isLoopBlock) {
722722
containingLoopBlockId = blockId
723723
const loopType = currentLoop.loopType || 'for'
724-
const contextualTags: string[] = ['index', 'currentIteration']
724+
const contextualTags: string[] = ['index']
725725
if (loopType === 'forEach') {
726726
contextualTags.push('currentItem')
727727
contextualTags.push('items')
@@ -743,7 +743,7 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
743743
const [loopId, loop] = containingLoop
744744
containingLoopBlockId = loopId
745745
const loopType = loop.loopType || 'for'
746-
const contextualTags: string[] = ['index', 'currentIteration']
746+
const contextualTags: string[] = ['index']
747747
if (loopType === 'forEach') {
748748
contextualTags.push('currentItem')
749749
contextualTags.push('items')
@@ -1214,10 +1214,7 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
12141214
blockGroup &&
12151215
(blockGroup.blockType === 'loop' || blockGroup.blockType === 'parallel')
12161216
) {
1217-
if (
1218-
!tag.includes('.') &&
1219-
['index', 'currentItem', 'items', 'currentIteration'].includes(tag)
1220-
) {
1217+
if (!tag.includes('.') && ['index', 'currentItem', 'items'].includes(tag)) {
12211218
processedTag = `${blockGroup.blockType}.${tag}`
12221219
} else {
12231220
processedTag = tag
@@ -1500,9 +1497,6 @@ export const TagDropdown: React.FC<TagDropdownProps> = ({
15001497
} else if (nestedTag.key === 'items') {
15011498
displayIcon = 'I'
15021499
tagDescription = 'array'
1503-
} else if (nestedTag.key === 'currentIteration') {
1504-
displayIcon = '#'
1505-
tagDescription = 'number'
15061500
}
15071501
} else if (nestedTag.fullTag) {
15081502
const tagParts = nestedTag.fullTag.split('.')

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-accessible-reference-prefixes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export function useAccessibleReferencePrefixes(blockId?: string | null): Set<str
3838
loopValues.forEach((loop) => {
3939
if (!loop?.nodes) return
4040
if (loop.nodes.includes(blockId)) {
41+
accessibleIds.add(loop.id) // Add the loop block itself
4142
loop.nodes.forEach((nodeId) => accessibleIds.add(nodeId))
4243
}
4344
})
@@ -46,6 +47,7 @@ export function useAccessibleReferencePrefixes(blockId?: string | null): Set<str
4647
parallelValues.forEach((parallel) => {
4748
if (!parallel?.nodes) return
4849
if (parallel.nodes.includes(blockId)) {
50+
accessibleIds.add(parallel.id) // Add the parallel block itself
4951
parallel.nodes.forEach((nodeId) => accessibleIds.add(nodeId))
5052
}
5153
})

apps/sim/executor/__test-utils__/executor-mocks.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ export const createParallelExecutionState = (options?: {
521521
completedExecutions?: number
522522
executionResults?: Map<string, any>
523523
activeIterations?: Set<number>
524-
currentIteration?: number
525524
parallelType?: 'count' | 'collection'
526525
}) => ({
527526
parallelCount: options?.parallelCount ?? 3,
@@ -530,7 +529,6 @@ export const createParallelExecutionState = (options?: {
530529
completedExecutions: options?.completedExecutions ?? 0,
531530
executionResults: options?.executionResults ?? new Map<string, any>(),
532531
activeIterations: options?.activeIterations ?? new Set<number>(),
533-
currentIteration: options?.currentIteration ?? 1,
534532
parallelType: options?.parallelType,
535533
})
536534

@@ -555,7 +553,7 @@ export const createParallelManagerMock = (options?: {
555553
}
556554

557555
const parallelState = context.parallelExecutions?.get(parallelId)
558-
if (!parallelState || parallelState.currentIteration === 0) {
556+
if (!parallelState) {
559557
continue
560558
}
561559

@@ -667,7 +665,6 @@ export const createParallelBlockHandler = vi.fn().mockImplementation(() => {
667665
completedExecutions: 0,
668666
executionResults: new Map(),
669667
activeIterations: new Set(),
670-
currentIteration: 1,
671668
}
672669
context.parallelExecutions.set(parallelId, parallelState)
673670

apps/sim/executor/orchestrators/loop.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export interface LoopContinuationResult {
2323
shouldExit: boolean
2424
selectedRoute: LoopRoute
2525
aggregatedResults?: NormalizedBlockOutput[][]
26-
currentIteration?: number
2726
}
2827

2928
export class LoopOrchestrator {
@@ -149,7 +148,6 @@ export class LoopOrchestrator {
149148
shouldContinue: true,
150149
shouldExit: false,
151150
selectedRoute: EDGE.LOOP_CONTINUE,
152-
currentIteration: scope.iteration,
153151
}
154152
}
155153

@@ -166,7 +164,6 @@ export class LoopOrchestrator {
166164
shouldExit: true,
167165
selectedRoute: EDGE.LOOP_EXIT,
168166
aggregatedResults: results,
169-
currentIteration: scope.iteration,
170167
}
171168
}
172169

apps/sim/executor/orchestrators/node.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export class NodeExecutionOrchestrator {
9494
shouldContinue: true,
9595
shouldExit: false,
9696
selectedRoute: continuationResult.selectedRoute,
97-
loopIteration: continuationResult.currentIteration,
9897
}
9998
}
10099

apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ const SPECIAL_BLOCKS_METADATA: Record<string, any> = {
912912
type: 'string',
913913
required: false,
914914
description: "Condition to evaluate (for 'while' and 'doWhile' loopType)",
915-
example: '<loop.currentIteration> < 10',
915+
example: '<loop.index> < 10',
916916
},
917917
maxConcurrency: {
918918
type: 'number',

apps/sim/providers/utils.test.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ describe('Model Capabilities', () => {
147147
'azure/model-router',
148148
// GPT-5.1 models don't support temperature (removed in our implementation)
149149
'gpt-5.1',
150-
'gpt-5.1-mini',
151-
'gpt-5.1-nano',
152-
'gpt-5.1-codex',
153150
'azure/gpt-5.1',
154151
'azure/gpt-5.1-mini',
155152
'azure/gpt-5.1-nano',
@@ -228,9 +225,6 @@ describe('Model Capabilities', () => {
228225
expect(getMaxTemperature('deepseek-r1')).toBeUndefined()
229226
// GPT-5.1 models don't support temperature
230227
expect(getMaxTemperature('gpt-5.1')).toBeUndefined()
231-
expect(getMaxTemperature('gpt-5.1-mini')).toBeUndefined()
232-
expect(getMaxTemperature('gpt-5.1-nano')).toBeUndefined()
233-
expect(getMaxTemperature('gpt-5.1-codex')).toBeUndefined()
234228
expect(getMaxTemperature('azure/gpt-5.1')).toBeUndefined()
235229
expect(getMaxTemperature('azure/gpt-5.1-mini')).toBeUndefined()
236230
expect(getMaxTemperature('azure/gpt-5.1-nano')).toBeUndefined()
@@ -325,9 +319,6 @@ describe('Model Capabilities', () => {
325319
it.concurrent('should have correct models in MODELS_WITH_REASONING_EFFORT', () => {
326320
// Should contain GPT-5.1 models that support reasoning effort
327321
expect(MODELS_WITH_REASONING_EFFORT).toContain('gpt-5.1')
328-
expect(MODELS_WITH_REASONING_EFFORT).toContain('gpt-5.1-mini')
329-
expect(MODELS_WITH_REASONING_EFFORT).toContain('gpt-5.1-nano')
330-
expect(MODELS_WITH_REASONING_EFFORT).toContain('gpt-5.1-codex')
331322
expect(MODELS_WITH_REASONING_EFFORT).toContain('azure/gpt-5.1')
332323
expect(MODELS_WITH_REASONING_EFFORT).toContain('azure/gpt-5.1-mini')
333324
expect(MODELS_WITH_REASONING_EFFORT).toContain('azure/gpt-5.1-nano')
@@ -354,9 +345,6 @@ describe('Model Capabilities', () => {
354345
it.concurrent('should have correct models in MODELS_WITH_VERBOSITY', () => {
355346
// Should contain GPT-5.1 models that support verbosity
356347
expect(MODELS_WITH_VERBOSITY).toContain('gpt-5.1')
357-
expect(MODELS_WITH_VERBOSITY).toContain('gpt-5.1-mini')
358-
expect(MODELS_WITH_VERBOSITY).toContain('gpt-5.1-nano')
359-
expect(MODELS_WITH_VERBOSITY).toContain('gpt-5.1-codex')
360348
expect(MODELS_WITH_VERBOSITY).toContain('azure/gpt-5.1')
361349
expect(MODELS_WITH_VERBOSITY).toContain('azure/gpt-5.1-mini')
362350
expect(MODELS_WITH_VERBOSITY).toContain('azure/gpt-5.1-nano')

apps/sim/stores/workflows/workflow/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ export interface LoopBlock {
100100
width: number
101101
height: number
102102
executionState: {
103-
currentIteration: number
104103
isExecuting: boolean
105104
startTime: null | number
106105
endTime: null | number

0 commit comments

Comments
 (0)