fix(workflow): optimize loop/parallel regeneration and prevent duplicate agent tools#3100
Merged
waleedlatif1 merged 2 commits intostagingfrom Feb 1, 2026
Merged
fix(workflow): optimize loop/parallel regeneration and prevent duplicate agent tools#3100waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryOptimized workflow store to skip expensive loop/parallel regeneration operations when they're not needed, and added duplicate prevention for agent tools. Major Changes:
Performance Impact: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant WorkflowStore
participant generateLoopBlocks
participant generateParallelBlocks
Note over WorkflowStore: Case 1: Add regular block (no parentId)
User->>WorkflowStore: addBlock(id, type='agent', ...)
WorkflowStore->>WorkflowStore: Check parentId (undefined)
WorkflowStore->>WorkflowStore: Create newBlocks
Note over WorkflowStore: Skip loop/parallel regeneration
WorkflowStore->>WorkflowStore: set({ loops: {...get().loops}, parallels: {...get().parallels} })
Note over WorkflowStore: Case 2: Add child to loop
User->>WorkflowStore: addBlock(id, type='function', parentId='loop-1')
WorkflowStore->>WorkflowStore: Check parentBlock type (loop)
WorkflowStore->>generateLoopBlocks: generateLoopBlocks(newBlocks)
generateLoopBlocks-->>WorkflowStore: Updated loops with child
WorkflowStore->>WorkflowStore: set({ loops: updatedLoops, parallels: {...get().parallels} })
Note over WorkflowStore: Case 3: Add edge
User->>WorkflowStore: batchAddEdges([edge])
WorkflowStore->>WorkflowStore: Validate and add edge
Note over WorkflowStore: Edges don't affect loop/parallel structure
WorkflowStore->>WorkflowStore: set({ loops: {...get().loops}, parallels: {...get().parallels} })
Note over WorkflowStore: Case 4: Batch add with mixed blocks
User->>WorkflowStore: batchAddBlocks([loop, child, regular])
WorkflowStore->>WorkflowStore: Check if any block.type === 'loop'
WorkflowStore->>WorkflowStore: Check if any block has parentId pointing to loop
WorkflowStore->>generateLoopBlocks: generateLoopBlocks(newBlocks)
generateLoopBlocks-->>WorkflowStore: Updated loops
WorkflowStore->>WorkflowStore: set({ loops: updatedLoops })
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
- Migrated undo-redo to use batchAddBlocks instead of addBlock loop - Removed addBlock method from workflow store (now unused) - Updated tests to use helper function wrapping batchAddBlocks - This fixes the cursor bot comments about inconsistent parent checking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Checklist