From e1859f504daf349c85d93d0249e9b26311caa988 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Sun, 6 Sep 2026 18:27:56 +0200 Subject: [PATCH] docs(drafts): trim the removal-marker invariant to four lines Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01KcyBRxE8j3ujCYkum9KrC4 --- .../src/lib/components/copilot/chat/global/core.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/lib/components/copilot/chat/global/core.ts b/frontend/src/lib/components/copilot/chat/global/core.ts index 99943c8d2b..8589dc4945 100644 --- a/frontend/src/lib/components/copilot/chat/global/core.ts +++ b/frontend/src/lib/components/copilot/chat/global/core.ts @@ -6179,12 +6179,10 @@ async function discardLocalDraft( await deleteGlobalDraft(workspace, type, path, triggerKind) - // Published only now: the delete above can throw, and the marker is read by the - // tool-completion listener, which a throw never reaches — leaving it to be - // consumed by some later action on this item, which would send its editor away - // while the item is still there. Nor is it published when a write is queued - // behind the delete: the form stays editable across it, and an edit made then - // recreates the draft, so the item the marker would report as gone is not. + // Published only now, and only if nothing is queued behind the delete: the marker + // sends a hosted editor away from an item it says is gone, so a throw above must + // not leave one standing for a later action to spend, and an edit made across the + // delete recreates the draft — leaving the item the marker would report as gone. if (removesItem && discardedKind) { const settled = UserDraftDbSyncer.getState({ workspace, itemKind: discardedKind, path: storagePath })