fix: persist Copilot drafts per workflow - #6017
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The panel builds a stable scope key Reviewed by Cursor Bugbot for commit c718f0b. Bugbot is set up for automated code reviews on this repo. Configure here. |
BillLeoutsakosvl346
left a comment
There was a problem hiding this comment.
Review
Approved. This is a simple, targeted reuse of the existing draftScopeKey mechanism. The workspace/Copilot/workflow key scopes drafts per workflow and avoids collisions with the main workspace chat key format, while preserving the existing restoration and submission cleanup behavior. I found no concrete bugs, unnecessary complexity, redundancy, or pattern violations in the diff.
BillLeoutsakosvl346
left a comment
There was a problem hiding this comment.
Review — PR #6017: persist Copilot drafts per workflow
This is a clean, minimal, one-file change that does exactly what it claims and nothing more.
What it does: derives workflowId from route params and builds a copilotDraftScopeKey (${workspaceId}:copilot:${workflowId}), then passes it to MothershipChat as draftScopeKey.
Assessment:
- Follows existing patterns. This mirrors
home.tsx(draftScopeKey = ${workspaceId}:${chatId ?? 'new'}) and reuses the already-wireddraftScopeKeyprop path throughMothershipChat→UserInputand the existinguseMothershipDraftsStorerestore/save/clear logic. No new machinery is introduced. - Correct isolation. The
:copilot:segment keeps the workflow Copilot drafts namespaced separately from the main workspace chat drafts (${workspaceId}:${chatId}), and the trailingworkflowIdisolates per workflow, matching the stated goal. The key shapes can't collide (2 segments vs 3). - No over-engineering / no defensive cruft. Just the two lines needed to compute the key plus the prop pass-through.
workflowIdis guaranteed present in this[workflowId]route, so theas stringcast is consistent with the existingworkspaceIdhandling.
One thing worth being aware of (not a blocker, and consistent with the existing home.tsx behavior): the draft restore in UserInput is mount-only (hasRestoredDraftRef + empty deps), so restoration relies on the component remounting when workflowId changes on navigation. This is the same contract used by the main chat, so it's reasonable to inherit here.
LGTM — approve.
| draftScopeKey={copilotDraftScopeKey} | ||
| layout='copilot-view' |
There was a problem hiding this comment.
Draft not swapped on workflow change
When soft-navigating between workflows, draftScopeKey updates in place but Panel/MothershipChat/UserInput are not keyed by workflow, and UserInput only restores drafts on mount while always saving edits to draftScopeKeyRef.current. The previous workflow's text, attachments, and contexts stay in the editor and further edits overwrite the new workflow's stored draft, so drafts leak across workflows until a full remount.
| draftScopeKey={copilotDraftScopeKey} | |
| layout='copilot-view' | |
| key={copilotDraftScopeKey} | |
| draftScopeKey={copilotDraftScopeKey} | |
| layout='copilot-view' |
Greptile SummaryPersist unsent workflow Copilot drafts per workspace/workflow by passing a stable draftScopeKey into MothershipChat.
Confidence Score: 3/5Not safe to merge until draft restore/swap on workflow navigation is fixed so drafts stay isolated when switching workflows without a full remount. Passing a workflow-scoped draftScopeKey is correct for isolation in the store, but UserInput only restores on mount and keeps saving the live editor into the latest key, so soft workflow switches leave the wrong draft visible and can overwrite another workflow's draft. Files Needing Attention: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx (and UserInput/MothershipChat draftScopeKey lifecycle if fixed there)
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx | Wires per-workflow draftScopeKey into MothershipChat, but without remounting/rehydrating UserInput on workflow change so drafts can bleed across workflows. |
Reviews (1): Last reviewed commit: "fix: persist Copilot drafts per workflow" | Re-trigger Greptile
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e554493. Configure here.

Summary
Persist unsent workflow Copilot drafts across navigation, including text, attachments, and contexts.
Why
Workflow panel drafts were not restored after navigating away, and must remain isolated per workflow and from the main workspace chat.
How
Build a stable draft scope key from the route workspace and workflow IDs and pass it to
MothershipChat, reusing the existing draft restore and post-submission cleanup behavior.