Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Dec 5, 2025

fix(copilot): fix hanging tool calls (#2218)
fix(copilot): fix tool call flash (#2221)
fix(copilot): fix function execute tool (#2222)

@vercel
Copy link

vercel bot commented Dec 5, 2025

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

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Dec 5, 2025 11:19pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 5, 2025

Greptile Overview

Greptile Summary

This PR adds support for integration tools (server-side executed tools) in the copilot with an "Always Allow" feature and fixes hanging tool calls. The changes introduce:

  • New isIntegrationTool() helper to distinguish integration tools from client tools
  • "Allow" and "Always Allow" buttons for integration tools requiring user confirmation
  • Auto-execution logic for tools marked as auto-allowed
  • Click-to-toggle UI for removing tools from the auto-allowed list
  • Server-side execution handling via executeIntegrationTool() and skip notifications via /api/copilot/tools/mark-complete

Critical Issues Found:

  • Integration tool execution lacks proper success state handling - if executeIntegrationTool succeeds, the UI state may remain stuck in "executing"
  • Skip notifications fail silently which could cause the original hanging issue if backend doesn't receive skip confirmation
  • Race condition possible between "Allow" and "Always Allow" buttons allowing simultaneous execution

Confidence Score: 2/5

  • This PR has critical logical issues that could cause the original hanging behavior to persist
  • Score reflects three critical bugs: (1) integration tool execution lacks proper success state updates causing UI to hang in "executing" state, (2) skip notifications fail silently which means the agent may never know a tool was skipped - the exact issue this PR aims to fix, and (3) race condition between Allow and Always Allow buttons. While the architectural approach is sound, these implementation gaps could cause the hanging tool calls issue to reoccur.
  • Pay close attention to tool-call.tsx - the handleRun and handleSkip functions for integration tools need proper error handling and state management

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx 4/5 Adds integration tool support with auto-allow functionality and fixes hanging tool calls by handling execution and skipping for server-side integration tools

Sequence Diagram

sequenceDiagram
    participant User
    participant ToolCallComponent as ToolCall Component
    participant Store as Copilot Store
    participant API as Backend API
    participant Agent as Sim Agent

    Note over User,Agent: Integration Tool Execution Flow (Allow)
    
    User->>ToolCallComponent: Clicks "Allow" button
    ToolCallComponent->>ToolCallComponent: setIsProcessing(true)
    ToolCallComponent->>ToolCallComponent: setButtonsHidden(true)
    ToolCallComponent->>ToolCallComponent: handleRun()
    ToolCallComponent->>ToolCallComponent: Check isIntegrationTool()
    ToolCallComponent->>Store: executeIntegrationTool(toolCallId)
    Store->>Store: Update state to "executing"
    Store->>API: POST /api/copilot/execute-tool
    API->>Agent: Forward tool execution request
    Agent-->>API: Return execution result
    API-->>Store: Return success/failure
    Store->>Store: Update state to "success" or "error"
    Store-->>ToolCallComponent: Execution complete
    ToolCallComponent->>ToolCallComponent: setIsProcessing(false)

    Note over User,Agent: Integration Tool Skip Flow
    
    User->>ToolCallComponent: Clicks "Skip" button
    ToolCallComponent->>ToolCallComponent: handleSkip()
    ToolCallComponent->>ToolCallComponent: Check isIntegrationTool()
    ToolCallComponent->>Store: setToolCallState(rejected)
    ToolCallComponent->>API: POST /api/copilot/tools/mark-complete
    Note right of ToolCallComponent: Silent failure (empty catch)
    API->>Agent: Notify tool was skipped
    Agent-->>API: Acknowledge

    Note over User,Agent: Always Allow Flow
    
    User->>ToolCallComponent: Clicks "Always Allow"
    ToolCallComponent->>ToolCallComponent: setIsProcessing(true)
    ToolCallComponent->>ToolCallComponent: setButtonsHidden(true)
    ToolCallComponent->>Store: addAutoAllowedTool(toolName)
    Store->>API: POST /api/copilot/auto-allowed-tools
    API->>Store: Tool added to allow list
    ToolCallComponent->>Store: executeIntegrationTool(toolCallId)
    Store->>API: POST /api/copilot/execute-tool
    API->>Agent: Execute tool
    Agent-->>Store: Result
    Store-->>ToolCallComponent: Complete
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.

1 file reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

* Fix copilot tool call flash

* Fix lint
@icecrasher321 icecrasher321 merged commit 12c4c2d into main Dec 5, 2025
20 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.

3 participants