Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Sep 30, 2025

Summary

Deprecate yaml, json import/export, deprecate build_workflow tool, convert copilot to json-based

Fixes #(issue)

Type of Change

  • Bug fix

Testing

Manual

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Sep 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 30, 2025 2:12am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 30, 2025 2:12am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Summary

This PR successfully deprecates YAML import/export functionality and the build_workflow tool, converting the copilot system to JSON-based operations. The changes include:

  • Tool Deprecation: Removed build_workflow tool from copilot registry and server router
  • API Endpoints: Deprecated multiple YAML-related API routes (/api/yaml/*, /api/workflows/yaml/*)
  • Format Conversion: Updated workflow text editor to support JSON-only, removing YAML/JSON dual mode
  • Export System: Converted export controls from YAML to JSON using new workflow JSON store
  • Training Logic: Updated training data processing to work with JSON operations instead of YAML
  • Data Structures: Modified stores and utilities to work with CopilotWorkflowState format

The conversion is comprehensive but introduces some complexity in YAML parsing utilities where both nested and direct handle formats are now supported, which could lead to conflicts.

Confidence Score: 4/5

  • This PR is safe to merge with one logical issue that should be addressed
  • The conversion from YAML to JSON is well-executed with clean removal of deprecated functionality. However, the YAML parsing utilities now support both nested ('loop.start') and direct ('loop-start-source') formats without conflict resolution, which could cause issues if both are used together.
  • Pay attention to apps/sim/stores/workflows/yaml/parsing-utils.ts for potential format conflicts

Important Files Changed

File Analysis

Filename        Score        Overview
apps/sim/lib/copilot/registry.ts 5/5 Updated tool registry to remove deprecated build_workflow tool, properly maintains type safety with zod schemas
apps/sim/lib/copilot/tools/server/router.ts 5/5 Cleanly removed build_workflow tool registration and validation logic
apps/sim/stores/workflows/json/store.ts 5/5 New JSON workflow store implementation with proper sanitization and export functionality
apps/sim/stores/workflows/yaml/parsing-utils.ts 3/5 Added direct handle format support for loop and parallel connections, potential duplication with existing nested format logic
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-text-editor/workflow-text-editor.tsx 4/5 Properly converted from YAML/JSON dual support to JSON-only, removed format conversion logic
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/control-bar/components/export-controls/export-controls.tsx 5/5 Clean conversion from YAML export to JSON export using new workflow JSON store

Sequence Diagram

sequenceDiagram
    participant User
    participant CopilotChat as Copilot Chat API
    participant SimAgent as Sim Agent
    participant WorkflowStore as Workflow Store
    participant JsonStore as JSON Store
    participant TrainingAPI as Training API
    
    Note over User, TrainingAPI: Before: YAML-based workflow operations
    User->>CopilotChat: Send message with workflow context
    CopilotChat->>SimAgent: Forward with workflow data
    SimAgent->>SimAgent: Use build_workflow tool (deprecated)
    SimAgent-->>CopilotChat: YAML workflow response
    CopilotChat-->>User: YAML-based response
    
    Note over User, TrainingAPI: After: JSON-based workflow operations
    User->>CopilotChat: Send message with workflow context  
    CopilotChat->>SimAgent: Forward with JSON workflow data
    SimAgent->>SimAgent: Use edit_workflow tool (JSON-based)
    SimAgent->>WorkflowStore: Update workflow state
    WorkflowStore->>JsonStore: Generate JSON export
    SimAgent-->>CopilotChat: JSON workflow response
    CopilotChat-->>User: JSON-based response
    
    User->>TrainingAPI: Submit training data
    TrainingAPI->>TrainingAPI: Process JSON operations
    TrainingAPI->>TrainingAPI: Send to agent indexer
Loading

57 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +569 to +622

// Parse direct handle formats (alternative to nested format)
// This allows using 'loop-start-source' directly instead of 'loop.start'
if (connections['loop-start-source']) {
const targets = Array.isArray(connections['loop-start-source'])
? connections['loop-start-source']
: [connections['loop-start-source']]
targets.forEach((target) => {
if (typeof target === 'string') {
edges.push(createEdge(blockId, target, 'loop-start-source', 'target'))
} else {
errors.push(`Invalid loop-start-source target in block '${blockId}': must be a string`)
}
})
}

if (connections['loop-end-source']) {
const targets = Array.isArray(connections['loop-end-source'])
? connections['loop-end-source']
: [connections['loop-end-source']]
targets.forEach((target) => {
if (typeof target === 'string') {
edges.push(createEdge(blockId, target, 'loop-end-source', 'target'))
} else {
errors.push(`Invalid loop-end-source target in block '${blockId}': must be a string`)
}
})
}

if (connections['parallel-start-source']) {
const targets = Array.isArray(connections['parallel-start-source'])
? connections['parallel-start-source']
: [connections['parallel-start-source']]
targets.forEach((target) => {
if (typeof target === 'string') {
edges.push(createEdge(blockId, target, 'parallel-start-source', 'target'))
} else {
errors.push(`Invalid parallel-start-source target in block '${blockId}': must be a string`)
}
})
}

if (connections['parallel-end-source']) {
const targets = Array.isArray(connections['parallel-end-source'])
? connections['parallel-end-source']
: [connections['parallel-end-source']]
targets.forEach((target) => {
if (typeof target === 'string') {
edges.push(createEdge(blockId, target, 'parallel-end-source', 'target'))
} else {
errors.push(`Invalid parallel-end-source target in block '${blockId}': must be a string`)
}
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Adding direct handle format parsing (e.g. 'loop-start-source') alongside existing nested format ('loop.start') could lead to conflicts if both formats are used in the same workflow YAML. Consider validating that only one format is used per block or document precedence rules.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/stores/workflows/yaml/parsing-utils.ts
Line: 569:622

Comment:
logic: Adding direct handle format parsing (e.g. 'loop-start-source') alongside existing nested format ('loop.start') could lead to conflicts if both formats are used in the same workflow YAML. Consider validating that only one format is used per block or document precedence rules.

How can I resolve this? If you propose a fix, please make it concise.

@vercel vercel bot temporarily deployed to Preview – docs September 30, 2025 02:09 Inactive
@Sg312 Sg312 merged commit 6a66466 into staging Sep 30, 2025
8 of 9 checks passed
@waleedlatif1 waleedlatif1 mentioned this pull request Sep 30, 2025
10 tasks
@waleedlatif1 waleedlatif1 deleted the fix/copilot-yaml branch October 7, 2025 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants