Skip to content

Conversation

@Sg312
Copy link
Contributor

@Sg312 Sg312 commented Jan 19, 2026

Summary

Improves condition and router handles for the copilot
Uses plan respond tool to show plan instead of relying on plan tags

Type of Change

  • Bug fix
  • New feature

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 Jan 19, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 19, 2026 11:18pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 19, 2026

Greptile Summary

  • Enhances copilot AI tooling by fixing workflow variables data format compatibility and adding support for intuitive handle references (e.g., "if", "else", "route-0")
  • Improves workflow data sanitization by switching router handles from 1-indexed to 0-indexed numbering for consistency with programming conventions
  • Hides the user_memory internal tool from the copilot UI to maintain a cleaner user experience

PR Description Notes:

  • Template still contains placeholder text and checkboxes are not filled out

Important Files Changed

Filename Overview
apps/sim/lib/copilot/tools/client/workflow/set-global-workflow-variables.ts Fixed data format mismatch by converting variables array to Record<string, Variable> format expected by API
apps/sim/lib/copilot/tools/server/workflow/edit-workflow.ts Enhanced edge validation to accept natural language handle references and normalize them to internal formats
apps/sim/lib/workflows/sanitization/json-sanitizer.ts Updated workflow sanitization to use 0-indexed router handles and simplified naming conventions

Confidence score:4/5

  • This PR enhances copilot functionality with well-structured changes that improve API compatibility and user experience
  • Score reflects solid implementation with proper normalization logic, though the complex edge handle validation warrants careful testing
  • Pay close attention to edit-workflow.ts edge validation logic and ensure the handle mapping covers all expected formats

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as "ToolCall Component"
    participant ClientTool as "SetGlobalWorkflowVariablesClientTool"
    participant API as "/api/workflows/[id]/variables"
    participant Database
    participant Store as "VariablesStore"

    User->>UI: "Click Allow on variable operations"
    UI->>ClientTool: "handleAccept(editedParams)"
    ClientTool->>ClientTool: "setState(executing)"
    ClientTool->>API: "GET current variables"
    API->>Database: "Query existing variables"
    Database->>API: "Return current variables"
    API->>ClientTool: "Return variables record"
    ClientTool->>ClientTool: "Apply operations (add/edit/delete)"
    ClientTool->>ClientTool: "Coerce values by type"
    ClientTool->>API: "POST updated variables"
    API->>Database: "Save variables record"
    Database->>API: "Confirm saved"
    API->>ClientTool: "Success response"
    ClientTool->>API: "GET refreshed variables"
    API->>Database: "Query updated variables"
    Database->>API: "Return fresh variables"
    API->>ClientTool: "Return updated variables"
    ClientTool->>Store: "Update variables in store"
    ClientTool->>ClientTool: "markToolComplete(200)"
    ClientTool->>ClientTool: "setState(success)"
    ClientTool->>UI: "Update display to success state"
Loading

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.

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@Sg312 Sg312 force-pushed the improvement/copilot-4 branch from 03a4ada to 65f4d3d Compare January 19, 2026 23:18
@Sg312 Sg312 merged commit 5f45db4 into staging Jan 19, 2026
10 checks passed
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.

2 participants