Repository navigation
fix(copilot): reopen the chat when its delete fails, unless another chat took its place - #10480
Conversation
…hat took its place The panel leaves the open chat before deleting it. A failed delete now reopens it, but only if the workflow still has no selection, so a chat opened or started in the meantime is kept.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge; no new actionable issue was found. SummaryThe PR reopens an open chat when deletion fails, without replacing another selected chat or an active conversation.
No new actionable issues were found. The earlier threads were unnumbered and were not reposted. This review checked code; it did not run the app. Reviews (4) · Last reviewed commit: "fix(copilot): guard the delete restore o..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…e delete An empty selection doesn't prove the panel is idle: a message sent from the empty panel has no chat id until its POST returns. Count select, new-chat and send actions instead, and reopen the chat only if none happened while the delete was pending.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
The route returns 404 only when another request deleted the chat between its lookup and its delete. Treat that like success, so the draft is pruned, the list refreshes, and the panel never reopens a chat that no longer exists.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 4/5
- In
panel.tsx, the failure-restore check only counts panel actions, so a send from the terminal or a block’s “ask copilot” action during deletion can be missed. Include sends from the mothership event handler in the check.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx">
<violation number="1" location="apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx:417">
P2: The failure-restore check only counts panel actions, so a send from the mothership event handler (terminal or block "ask copilot" actions) made while the delete is in flight is not counted. If that send creates a new chat and the delete then fails, the restore replaces the new chat with the deleted one. Check the live selection in the query cache as well as the counter, or bump `copilotChatActionsRef` in the mothership handler before `copilotSendMessage`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
…tion count A count of panel actions misses selections that land later (a new chat whose create returns after the delete) and sends that don't go through the panel's handlers. Restore only when the workflow still has no selection and the panel holds no transcript and no send in flight.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
Summary
useCopilotChatSelectionexposespeekChatId(), which reads the workflow's current selection from the cache. A mutation callback needs it because its closure holds the selection from when the delete started.Type of Change
Testing
onErrorbranch in the panel, and a test would only mock React Query and restate the conditionChecklist
test-auditauthoring gate)