Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Latest block name to copilot for tool call rendering purposes.

Type of Change

  • Bug fix

Testing

tested manually

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 21, 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 21, 2026 5:09am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 21, 2026

Greptile Summary

Fixed copilot tool calls to display the correct block names by using getLatestBlock() instead of getBlock(). This ensures that when blocks have versioned variants (e.g., cursor with legacy version and cursor_v2 as the latest), the copilot UI shows the current version's name ("Cursor") rather than the legacy version's name ("Cursor (Legacy)").

The fix is applied consistently across:

  • Client-side tools: Updated getDynamicText functions to use getLatestBlock() for displaying block names in tool call states
  • Server-side tools: Added logic to retrieve the latest block and use its name as the displayName in API responses

The getLatestBlock() function searches for the highest versioned variant (e.g., _v2, _v3) and falls back to the base block if no versions exist, ensuring backward compatibility for blocks without versions.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward and well-contained, addressing a specific display issue with legacy block names. The implementation correctly uses the existing getLatestBlock() function, which has proper fallback logic. All changes maintain backward compatibility since the function returns the base block when no versioned variants exist.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts Added getLatestBlock import and logic to use latest block name as display name in API responses
apps/sim/lib/copilot/tools/server/blocks/get-block-options.ts Added getLatestBlock import and logic to use latest block name as display name in API responses

Sequence Diagram

sequenceDiagram
    participant Copilot
    participant ClientTool as Client Tool<br/>(get-block-config/get-block-options)
    participant Server as Server Tool<br/>(get-block-config/get-block-options)
    participant Registry as Block Registry

    Copilot->>ClientTool: Request block info (blockType)
    ClientTool->>Registry: getLatestBlock(blockType)
    Registry-->>ClientTool: Latest block config with name
    ClientTool->>ClientTool: Generate dynamic text with latest name
    ClientTool->>Server: POST /api/copilot/execute-copilot-server-tool
    Server->>Registry: Get block from registry[blockType]
    Server->>Registry: getLatestBlock(blockType)
    Registry-->>Server: Latest block config
    Server->>Server: Use latestBlock.name as displayName
    Server-->>ClientTool: Return result with displayName
    ClientTool-->>Copilot: Display with correct block name
Loading

@icecrasher321 icecrasher321 merged commit 1d45057 into staging Jan 21, 2026
12 checks passed
waleedlatif1 added a commit that referenced this pull request Jan 21, 2026
* fix(google): wrap primitive tool responses for Gemini API compatibility (#2900)

* fix(canonical): copilot path + update parent (#2901)

* fix(rss): add top-level title, link, pubDate fields to RSS trigger output (#2902)

* fix(rss): add top-level title, link, pubDate fields to RSS trigger output

* fix(imap): add top-level fields to IMAP trigger output

* improvement(browseruse): add profile id param (#2903)

* improvement(browseruse): add profile id param

* make request a stub since we have directExec

* improvement(executor): upgraded abort controller to handle aborts for loops and parallels (#2880)

* improvement(executor): upgraded abort controller to handle aborts for loops and parallels

* comments

* improvement(files): update execution for passing base64 strings (#2906)

* progress

* improvement(execution): update execution for passing base64 strings

* fix types

* cleanup comments

* path security vuln

* reject promise correctly

* fix redirect case

* remove proxy routes

* fix tests

* use ipaddr

* feat(tools): added textract, added v2 for mistral, updated tag dropdown (#2904)

* feat(tools): added textract

* cleanup

* ack pr comments

* reorder

* removed upload for textract async version

* fix additional fields dropdown in editor, update parser to leave validation to be done on the server

* added mistral v2, files v2, and finalized textract

* updated the rest of the old file patterns, updated mistral outputs for v2

* updated tag dropdown to parse non-operation fields as well

* updated extension finder

* cleanup

* added description for inputs to workflow

* use helper for internal route check

* fix tag dropdown merge conflict change

* remove duplicate code

---------

Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>

* fix(ui): change add inputs button to match output selector (#2907)

* fix(canvas): removed invite to workspace from canvas popover (#2908)

* fix(canvas): removed invite to workspace

* removed unused props

* fix(copilot): legacy tool display names (#2911)

* fix(a2a): canonical merge  (#2912)

* fix canonical merge

* fix empty array case

* fix(change-detection): copilot diffs have extra field (#2913)

* improvement(logs): improved logs ui bugs, added subflow disable UI (#2910)

* improvement(logs): improved logs ui bugs, added subflow disable UI

* added duplicate to action bar for subflows

* feat(broadcast): email v0.5 (#2905)

---------

Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
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