fix(copilot): persist workflow drafts across navigation - #6807
fix(copilot): persist workflow drafts across navigation#6807BillLeoutsakosvl346 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Panel derives the workflow id from the hydrated registry or the route param so the scope stays stable during navigation and while a new chat receives its server id. It passes MothershipChat keys only Reviewed by Cursor Bugbot for commit 3024651. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR reuses the localStorage-backed Mothership draft store for workflow Copilot and remounts only the composer when its workflow scope changes.
Confidence Score: 4/5The workflow draft scope should be tied to the current route before merging because navigation can save new Copilot input under the previous workflow and then make it disappear. During an asynchronous workflow switch, the panel can render the destination workflow while activeWorkflowId still names the source workflow, causing the newly added persistence wiring to write drafts into the wrong scope until hydration completes. Files Needing Attention: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/home/components/mothership-chat/mothership-chat.tsx | Keys UserInput by draft scope to trigger restoration without remounting the transcript; the remount exposes the panel's stale-scope transition. |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx | Adds workflow-scoped Copilot persistence, but derives the key from registry state that can still identify the previous workflow during asynchronous navigation. |
Sequence Diagram
sequenceDiagram
participant U as User
participant R as Workflow route
participant P as Panel
participant G as Workflow registry
participant D as Draft store
U->>R: Navigate A → B
R->>P: Render workflow B
G-->>P: "activeWorkflowId = A"
P->>D: Use scope workspace:copilot:A
U->>P: Type draft on B
P->>D: Persist under A
R->>G: Hydrate workflow B
G-->>P: "activeWorkflowId = B"
P->>P: Remount composer
D-->>P: Restore B draft
Reviews (1): Last reviewed commit: "fix(copilot): persist workflow drafts ac..." | Re-trigger Greptile
fc3aa8f to
f12acb9
Compare
f12acb9 to
c7a99d0
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c7a99d0. Configure here.
c7a99d0 to
3024651
Compare

Summary
Type of Change
Testing
bunx biome checkon both changed filesbun run check:audits— 29/29 audits passedbun run lint:check— 24/24 tasks passedbun run type-check— 24/24 tasks passedbun run test— 17/17 tasks passed; app suite 27,406 passed, 46 skippedbunx turbo run build --filter=@sim/app— passedgit diff --check— passed@sim/apptype-check, and diff check passedInteractive localhost QA was not available in the agent browser session. Reviewer focus: type an unsent workflow Copilot draft, navigate away and return or refresh, confirm it restores; switch workflows and confirm isolation; send and confirm the draft clears.
No new automated test was added because this adopts an existing persistence path, while a mocked Panel test would only assert prop wiring rather than route-navigation behavior.
Checklist
Screenshots/Videos
Not attached because an interactive localhost browser session was unavailable.