fix: scope copilot drafts by workflow - #6020
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview This aligns workflow copilot with the existing draft-scoping pattern used elsewhere and avoids drafts bleeding across workflows or being lost when switching workflows or tabs. Reviewed by Cursor Bugbot for commit 2271ac2. Bugbot is set up for automated code reviews on this repo. Configure here. |
BillLeoutsakosvl346
left a comment
There was a problem hiding this comment.
Approve. This is a small, focused change that follows the existing draftScopeKey pattern and scopes copilot drafts by both workspace and workflow without unnecessary complexity. I found no concrete bugs or regressions in the diff.
BillLeoutsakosvl346
left a comment
There was a problem hiding this comment.
Review: fix: scope copilot drafts by workflow
This is a clean, minimal change that does exactly what the description says. Verdict: approve.
draftScopeKeyis an existing, optional prop onMothershipChat(mothership-chat.tsx:69) that is threaded down intouser-input.tsxand used to key drafts inuseMothershipDraftsStore, so wiring a value in here is the right mechanism.- The
${workspaceId}:copilot:${workflowId}key introduces a distinctcopilot:namespace, which correctly isolates the workspace copilot drafts both between workflows and from Home chat (whose keys are${workspaceId}:${chatId ?? 'new'}). No collision risk. params.workflowIdis guaranteed present on the[workflowId]route, so the key can't degrade to anundefinedsegment.- Follows the exact same pattern already established in
home.tsx.
No bugs, over-engineering, or redundancy spotted. Nice small fix.
| const workflowId = params.workflowId as string | ||
| const copilotDraftScopeKey = `${workspaceId}:copilot:${workflowId}` |
There was a problem hiding this comment.
copilotDraftScopeKey is ${workspaceId}:copilot:${workflowId} while home scopes drafts as ${workspaceId}:${chatId ?? 'new'}. Panel copilot still switches chats via chatId without remounting MothershipChat, so unsubmitted text, attachments, and contexts are shared across every chat in that workflow, and submit clears that shared draft for all of them. Include the active/resolved copilot chat id (or 'new') in the key for per-chat isolation.
Greptile SummaryEnables persisted copilot composer drafts in the workflow panel by deriving a workflow-scoped
Confidence Score: 4/5Safe to merge for enabling draft persistence; only non-blocking concern is drafts shared across copilot chats within one workflow. The change correctly wires optional draft persistence that was previously skipped when draftScopeKey was omitted, and the key format avoids home collisions; the remaining gap is product parity with per-chat draft isolation on the home path. Files Needing Attention: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx | Adds workflow-scoped draftScopeKey for panel copilot; works for per-workflow persistence but shares drafts across chats unlike home. |
Reviews (1): Last reviewed commit: "chore: investigate Slack-reported engine..." | Re-trigger Greptile
Summary
Pass a workflow-specific draft scope key to
MothershipChatin the workspace copilot panel.Why
Copilot drafts need to remain isolated between workflows and from Home chat while preserving persisted text, attachments, and contexts.
How
Read
workflowIdfrom the route, build a stable${workspaceId}:copilot:${workflowId}key, and provide it throughdraftScopeKey.