Skip to content

feat(copilot): copilot tool refactor#1030

Merged
Sg312 merged 17 commits intostagingfrom
feat/copilot-refactor
Aug 19, 2025
Merged

feat(copilot): copilot tool refactor#1030
Sg312 merged 17 commits intostagingfrom
feat/copilot-refactor

Conversation

@Sg312
Copy link
Copy Markdown
Collaborator

@Sg312 Sg312 commented Aug 19, 2025

Summary

  • Moves all copilot tools client side
  • Removes redis polling for copilot tools
  • Handles tool detection purely via SSE stream

Fixes #(issue)

Type of Change

  • New feature

Testing

Manual testing

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
Copy Markdown

vercel Bot commented Aug 19, 2025

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

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 19, 2025 0:44am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 19, 2025 0:44am

@Sg312 Sg312 changed the title Feat/copilot refactor feat(copilot): copilot tool refactor Aug 19, 2025
Copy link
Copy Markdown
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 Summary

This PR implements a major architectural refactor of the copilot tool system, moving from a Redis-backed interrupt/approval model to a simplified client-server execution pattern. The refactor introduces several key changes:

Architecture Changes:

  • Tool Execution Model: Removes the complex Redis-backed interrupt system (requiresInterrupt = true) and replaces it with direct tool execution via the /api/copilot/methods endpoint
  • Client-Server Separation: Creates a clear separation between client-side tools (UI state management, parameter normalization) and server-side tools (actual execution logic)
  • Unified Communication: Standardizes tool communication through the /api/copilot/methods route with completion callbacks to sim-agent

New Client Tools Added: 16 new client-side tools were added to support comprehensive workflow operations including: workflow building/editing (BuildWorkflowClientTool, EditWorkflowClientTool), environment variable management (GetEnvironmentVariablesClientTool, SetEnvironmentVariablesClientTool), Google Drive operations (ListGDriveFilesClientTool, ReadGDriveFileClientTool, GDriveRequestAccessTool), documentation search (SearchDocumentationClientTool), and other utilities like API requests and OAuth credential management.

Server-Side Additions: Two new server-side completion handlers were added (runWorkflowServerTool, gdriveRequestAccessServerTool) that echo back status/confirmation data for callback purposes rather than performing complex business logic.

Notification System Refactor: The notification system was completely overhauled - the notify() function became a no-op, the /api/copilot/confirm endpoint was removed entirely (along with its tests), and completion notifications now flow through the methods route with callbacks to sim-agent.

Enhanced Features: Added authentication flexibility (session-only auth), auto-injection of session userId for OAuth methods, prefetch functionality for blocks/tools metadata, and comprehensive debug logging throughout the documentation search functionality.

The refactor maintains backward compatibility while significantly simplifying the execution model, reducing Redis dependencies, and providing a more consistent tool development pattern. All new client tools follow the same architectural pattern using BaseTool, postToMethods utility functions, and standardized error handling.

Confidence score: 2/5

  • This PR introduces breaking architectural changes with significant complexity that require extensive testing and could destabilize the copilot system
  • Score reflects the removal of entire test suites, extensive debugging code that should be temporary, and complex state management changes that could introduce hard-to-detect bugs
  • Pay close attention to all copilot functionality, the removed /api/copilot/confirm endpoint and its test coverage, and the extensive debug logging in documentation search tools that should be cleaned up before production

32 files reviewed, 33 comments

Edit Code Review Bot Settings | Greptile

Comment thread apps/sim/lib/copilot/tools/server-tools/docs/search-docs.ts
Comment thread apps/sim/lib/copilot/tools/server-tools/docs/search-docs.ts
Comment thread apps/sim/lib/copilot/tools/server-tools/docs/search-docs.ts
Comment thread apps/sim/app/api/copilot/methods/route.ts
Comment thread apps/sim/lib/copilot/tools/server-tools/other/run-workflow.ts
Comment thread apps/sim/lib/copilot/tools/client-tools/search-documentation.ts
Comment thread apps/sim/lib/copilot/tools/client-tools/search-documentation.ts
Comment thread apps/sim/lib/copilot/tools/client-tools/get-blocks-metadata.ts
@vercel vercel Bot temporarily deployed to Preview – docs August 19, 2025 12:32 Inactive
@vercel vercel Bot temporarily deployed to Preview – docs August 19, 2025 12:35 Inactive
@Sg312 Sg312 merged commit 81969f1 into staging Aug 19, 2025
4 of 5 checks passed
@Sg312 Sg312 deleted the feat/copilot-refactor branch August 19, 2025 12:39
aadamgough pushed a commit that referenced this pull request Aug 20, 2025
* get user workflow

* get env vars and oauth creds

* metadtata

* Search docs

* More tools

* Build edit workflow

* Read workflwo console

* v1

* UPdates

* Fixes

* Updates

* Skip tools

* Lint

* Fix tests

* Remove logs

* Remove more logs

* UPdate
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.

1 participant