Skip to content

fix(copilot): expand tool metadata, fix thinking text rendering, clean up display logic#3779

Merged
waleedlatif1 merged 3 commits intostagingfrom
fix/tool-names
Mar 26, 2026
Merged

fix(copilot): expand tool metadata, fix thinking text rendering, clean up display logic#3779
waleedlatif1 merged 3 commits intostagingfrom
fix/tool-names

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Expanded MothershipToolName union and TOOL_UI_METADATA to cover all tool IDs — every tool now shows a human-readable display title instead of falling back to raw snake_case names
  • Fixed thinking/reasoning text not rendering in chat — live streaming now wraps reasoning events in <thinking> XML, and loaded history converts stored thinking blocks the same way, both feeding into the existing parseSpecialTags rendering pipeline
  • Removed formatToolName fallback and getOverrideDisplayTitle indirection; TOOL_UI_METADATA is now the single source of truth for tool display names
  • Fixed phase: 'subagent' on deploy/key management tools — corrected to phase: 'management'
  • Removed stale "Go backend" references in log messages and comments

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 Mar 26, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 26, 2026 5:53am

Request Review

@cursor
Copy link

cursor bot commented Mar 26, 2026

PR Summary

Medium Risk
Moderate risk: changes how SSE reasoning/stored thinking blocks are transformed into chat text and centralizes tool display titles to a new comprehensive TOOL_UI_METADATA, which could impact streaming/chat rendering and tool label/icon consistency.

Overview
Updates Copilot chat rendering to properly display model reasoning and stored thinking blocks by wrapping them in <thinking>...</thinking> so they flow through the existing special-tag parser during both live streaming and history load.

Expands MothershipToolName and makes TOOL_UI_METADATA a complete, single source of truth for tool titles/phases, then simplifies message tool display logic to rely on this map (removing snake_case title formatting and override title resolution). Tool icon mappings are also extended to cover the expanded tool set.

Includes small cleanups: renames “Go backend” references to “server/copilot”, tightens types for persisted chat resources, removes unused client tool base types, and makes the workflow-tool name set internal.

Written by Cursor Bugbot for commit 3464600. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 26, 2026

Greptile Summary

This PR delivers three focused fixes to the copilot chat experience: expands MothershipToolName and TOOL_UI_METADATA to full coverage so every tool displays a human-readable title, fixes thinking/reasoning text that was silently dropped during live streaming and history replay, and simplifies the tool-name resolution pipeline by removing the formatToolName fallback and getOverrideDisplayTitle indirection in favour of TOOL_UI_METADATA as the single source of truth.\n\nKey changes:\n- TOOL_UI_METADATA promoted from Partial<Record<MothershipToolName, …>> to a full Record<…> — TypeScript now enforces completeness at compile time, and ~40 new tool entries are added with correct phase values (management for deploy/key tools, previously wrong).\n- Live streaming: the new reasoning SSE case in use-chat.ts wraps content chunks in <thinking>…</thinking> XML, feeding the existing parseSpecialTags pipeline. Both start and end phases use ensureTextBlock() so the closing tag is always written regardless of interleaved blocks.\n- History replay: mapStoredBlock now converts stored thinking-typed blocks to text blocks with the <thinking> wrapper before passing them to the rendering pipeline.\n- Dead code removed: ClientToolCallState enum, BaseClientToolMetadata, DynamicTextFormatter, WORKFLOW_EXECUTION_TIMEOUT_MS, ChatResource alias, and WORKFLOW_TOOL_NAME_SET (un-exported) are all gone.\n- Stale "Go backend" references updated to generic "server"/"copilot" language throughout.

Confidence Score: 5/5

Safe to merge — all three bugs are correctly addressed and no regressions were found.

The reasoning event handling correctly uses ensureTextBlock() for both start and end phases. Dead code removal is clean: ClientToolCallState is still exported from tool-display-registry.ts and imported from there by its consumers; WORKFLOW_EXECUTION_TIMEOUT_MS had no external usages; WORKFLOW_TOOL_NAME_SET is only used internally. The TOOL_UI_METADATA Record promotion gives compile-time completeness guarantees.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/types.ts Expands MothershipToolName union by ~40 entries and converts TOOL_UI_METADATA from Partial to a full Record, ensuring every tool maps to human-readable metadata at compile time.
apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts Adds reasoning SSE event handling (wrapping chunks in thinking XML tags during live streaming) and converts stored thinking blocks to text blocks on history load; both correctly use ensureTextBlock() for safe tag insertion.
apps/sim/app/workspace/[workspaceId]/home/components/message-content/message-content.tsx Removes formatToolName fallback, mapToolStatusToClientState, and getOverrideDisplayTitle indirection; displayTitle now resolves purely via TOOL_UI_METADATA with a raw-name fallback.
apps/sim/app/workspace/[workspaceId]/home/components/message-content/utils.ts TOOL_ICONS expanded to cover all new MothershipToolName entries, with context_compaction and open_resource relocated to their correct semantic sections.
apps/sim/lib/copilot/tools/client/base-tool.ts Removes ClientToolCallState enum, ClientToolDisplay, BaseClientToolMetadata, DynamicTextFormatter, and WORKFLOW_EXECUTION_TIMEOUT_MS — all confirmed unused after the displayTitle simplification.

Reviews (2): Last reviewed commit: "fix(copilot): guard null reasoning data,..." | Re-trigger Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@waleedlatif1 waleedlatif1 merged commit 2771b67 into staging Mar 26, 2026
6 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/tool-names branch March 26, 2026 05:54
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