Skip to content

feat: mothership/copilot feedback#3940

Merged
emir-karabeg merged 2 commits intostagingfrom
feat/mothership-feedback
Apr 4, 2026
Merged

feat: mothership/copilot feedback#3940
emir-karabeg merged 2 commits intostagingfrom
feat/mothership-feedback

Conversation

@emir-karabeg
Copy link
Copy Markdown
Collaborator

@emir-karabeg emir-karabeg commented Apr 4, 2026

Summary

  • Added thumbs up/down feedback mechanism for copilot message actions, including new emcn icons, a useCopilotFeedback mutation hook, and updated message action UI
  • Mothership chat and view components updated to support feedback flow

Type of Change

  • New feature

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

vercel bot commented Apr 4, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 4, 2026 5:43pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 4, 2026

PR Summary

Medium Risk
Adds a new user feedback submission flow that sends copilot chat data to /api/copilot/feedback, plus restructures chat action rendering and sidebar scroll observation; main risk is around payload correctness and UI state/scroll regressions.

Overview
Adds copilot/mothership message feedback: assistant messages now show copy + thumbs up/down actions, prompting for optional text in a modal and submitting via a new React Query mutation hook (useSubmitCopilotFeedback) to /api/copilot/feedback (including chatId, preceding userQuery, and agentResponse). Copy behavior was simplified to copy a plain-text version of the assistant response (stripping special tags/markdown).

Tweaks related UI behavior: message actions are repositioned below completed assistant messages and chatId is threaded through MothershipChat from both Home and the workflow copilot panel; minor markup/style adjustments include changing mothership error display to a <p>, speeding up the resource panel collapse/expand transition, and improving sidebar overflow detection by observing a new scroll content wrapper (plus small Help modal label styling updates).

Reviewed by Cursor Bugbot for commit e9b82ee. Configure here.

@emir-karabeg emir-karabeg changed the title feat: mothership/copilot feedback, store cleanup, and loading improvements feat: mothership/copilot feedback Apr 4, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 4, 2026

Greptile Summary

This PR adds a thumbs-up/down feedback mechanism to copilot/mothership message actions, cleans up unused Zustand environment store scaffolding, and removes jarring loading spinners in favour of smoother page transitions.

  • Feedback UI (message-actions.tsx): Replaces the previous ellipsis dropdown with inline copy/thumbs-up/thumbs-down buttons. Clicking a thumb opens a modal prompting for optional free-text; submission is handled via a new useSubmitCopilotFeedback React Query mutation hook.
  • New icons: ThumbsUp and ThumbsDown SVG components added to the emcn icon library and exported from the barrel file.
  • copilot-feedback.ts: Clean mutation hook following project React Query conventions, with proper error logging.
  • Store cleanup: Dead Zustand environment store initialisation scaffolding removed; deployment state migrated to React Query.
  • Loading improvements: Spinner components removed from several pages, replaced with skeleton-based or instant transitions.

Confidence Score: 4/5

Mostly safe to merge; one P1 logic bug causes feedback to be silently discarded when users click Submit with an empty text field.

The P1 issue in handleSubmitFeedback means a user who opens the feedback modal and clicks Submit without typing anything sees the modal close as if their action succeeded — but no request is ever sent to /api/copilot/feedback. Since feedback is already optional in the API interface, the fix is straightforward. All other changes (icon additions, store cleanup, loading improvements) are clean and low-risk.

apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx — the handleSubmitFeedback callback silently discards feedback when text is empty

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx Adds thumbs-up/down feedback modal with toPlainText clipboard helper; has a P1 silent discard bug when submit is clicked with empty text, and includes submitFeedback mutation in useCallback deps contrary to project guidelines.
apps/sim/hooks/queries/copilot-feedback.ts New mutation hook following React Query patterns; correctly uses logger, throws on non-ok responses, and handles errors — no issues found.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx Passes chatId and the preceding user message's content as userQuery to MessageActions; logic for finding the preceding user message is correct.
apps/sim/components/emcn/icons/thumbs-up.tsx New SVG icon component following existing emcn icon patterns with aria-hidden and spread props.
apps/sim/components/emcn/icons/thumbs-down.tsx New SVG icon implemented as a vertical flip of the ThumbsUp shape via scale(1,-1) transform; consistent with project icon patterns.
apps/sim/components/emcn/icons/index.ts Adds ThumbsDown and ThumbsUp exports in alphabetical order.
apps/sim/app/workspace/[workspaceId]/home/home.tsx Spinner loading states removed for smoother transitions; no logic regressions observed.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx Store cleanup and unused exports removed; no functional regressions.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant MA as MessageActions
    participant Modal as FeedbackModal
    participant Hook as useSubmitCopilotFeedback
    participant API as /api/copilot/feedback

    U->>MA: Clicks ThumbsUp / ThumbsDown
    MA->>Modal: setPendingFeedback('up'|'down') → open modal
    U->>Modal: Types optional feedback text
    alt text is non-empty
        U->>Modal: Clicks Submit
        Modal->>Hook: submitFeedback.mutate(payload)
        Hook->>API: POST /api/copilot/feedback
        API-->>Hook: { success, feedbackId }
        Modal->>MA: setPendingFeedback(null) → close modal
    else text is empty (current bug)
        U->>Modal: Clicks Submit
        Modal->>MA: setPendingFeedback(null) → close modal silently
        Note over Hook,API: No request sent
    end
    U->>MA: Clicks Copy
    MA->>MA: toPlainText(content)
    MA->>U: navigator.clipboard.writeText(plainText)
Loading

Reviews (1): Last reviewed commit: "feat: mothership/copilot feedback" | Re-trigger Greptile

Copy link
Copy Markdown

@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 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Feedback silently discarded when text is empty
    • Removed the early return that prevented submitFeedback.mutate() from being called when feedbackText was empty, allowing the thumbs up/down vote to be recorded even without optional text feedback.
  • ✅ Fixed: Form labels replaced with non-semantic paragraph elements
    • Replaced

      elements with proper components from EMCN with htmlFor attributes pointing to the form input IDs, restoring accessibility features.

Create PR

Or push these changes by commenting:

@cursor push c9d526113f
Preview (c9d526113f)
diff --git a/apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx b/apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx
--- a/apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/components/message-actions/message-actions.tsx
@@ -92,17 +92,12 @@
   const handleSubmitFeedback = useCallback(() => {
     if (!pendingFeedback || !chatId || !userQuery) return
     const text = feedbackText.trim()
-    if (!text) {
-      setPendingFeedback(null)
-      setFeedbackText('')
-      return
-    }
     submitFeedback.mutate({
       chatId,
       userQuery,
       agentResponse: content,
       isPositiveFeedback: pendingFeedback === 'up',
-      feedback: text,
+      feedback: text || undefined,
     })
     setPendingFeedback(null)
     setFeedbackText('')

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/help-modal/help-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/help-modal/help-modal.tsx
--- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/help-modal/help-modal.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/help-modal/help-modal.tsx
@@ -12,6 +12,7 @@
   Button,
   Combobox,
   Input,
+  Label,
   Modal,
   ModalBody,
   ModalContent,
@@ -431,7 +432,7 @@
             <div ref={scrollContainerRef} className='min-h-0 flex-1 overflow-y-auto'>
               <div className='space-y-3'>
                 <div className='flex flex-col gap-2'>
-                  <p className='font-medium text-[var(--text-secondary)] text-sm'>Request</p>
+                  <Label htmlFor='type' className='text-[var(--text-secondary)] text-sm'>Request</Label>
                   <Combobox
                     id='type'
                     options={REQUEST_TYPE_OPTIONS}
@@ -446,7 +447,7 @@
                 </div>
 
                 <div className='flex flex-col gap-2'>
-                  <p className='font-medium text-[var(--text-secondary)] text-sm'>Subject</p>
+                  <Label htmlFor='subject' className='text-[var(--text-secondary)] text-sm'>Subject</Label>
                   <Input
                     id='subject'
                     placeholder='Brief description of your request'
@@ -456,7 +457,7 @@
                 </div>
 
                 <div className='flex flex-col gap-2'>
-                  <p className='font-medium text-[var(--text-secondary)] text-sm'>Message</p>
+                  <Label htmlFor='message' className='text-[var(--text-secondary)] text-sm'>Message</Label>
                   <Textarea
                     id='message'
                     placeholder='Please provide details about your request...'

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e9b82ee. Configure here.

@emir-karabeg emir-karabeg changed the base branch from main to staging April 4, 2026 17:45
@emir-karabeg emir-karabeg merged commit b0cb95b into staging Apr 4, 2026
15 checks passed
@emir-karabeg emir-karabeg deleted the feat/mothership-feedback branch April 4, 2026 17:46
waleedlatif1 pushed a commit that referenced this pull request Apr 4, 2026
* feat: mothership/copilot feedback

* fix(feedback): remove mutation object from useCallback deps
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