Skip to content

🤖 bug: a creation draft whose delete fails comes back with the sent text (#6620 dropped the retry) #7551

Closed

Description

@ThomasK33

Summary

Since #6620 (7f3e88f773), a creation draft whose delete fails is never deleted. Then the draft comes back with text that was already sent.

Before #6620, DraftStore.deleteDraft kept the delete in pendingDeletes, retried a failed drafts.delete call, and retried on the next subscription snapshot when there was no client (ce4ebb0e55:src/browser/stores/DraftStore.ts, deleteDraft and sendDelete). The new CreationDraftStore.delete drops the local entry, calls drafts.deleteCreation once, and throws "Not connected." when there is no client (src/browser/stores/CreationDraftStore.ts, delete). Both callers only log the failure:

  • src/browser/features/ChatInput/useCreationWorkspace.ts, clearPendingDraft
  • src/browser/contexts/WorkspaceContext.tsx, the deleteWorkspaceDraft callback

Nothing on the backend deletes the record when the workspace is created. Only deleteProjectDrafts removes creation records. CreationDraftStore reads drafts.listCreation() again on connect.

Steps

  1. Start a creation draft and send it, so the workspace gets created.
  2. Make drafts.deleteCreation fail once, for example by dropping the connection right after the workspace exists.
  3. Reload the window or reconnect.

Expected: the creation draft stays gone.
Actual: the creation draft is listed again and holds the sent text. The user sees a duplicate draft and can send it a second time. No text is lost.

Likelihood is low: the delete must fail in the short window after creation.

Fix direction

Give CreationDraftStore.delete the old retry behavior: keep a pending-delete set, retry on failure and on reconnect, and keep a listed record hidden while its delete is pending. A repro test can stub drafts.deleteCreation to reject once, run a creation send, reconnect, and assert that no creation draft holds the text.

How this was found

A drift scan of the code that the removed formal/composer-drafts model covered (contract D4 and the creation handoff), on origin/main 7d2498b1d0. Related: #6789, #6810.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Activity

  1. self-assigned this
    on Oct 26, 2026
  2. ThomasK33 commented on Oct 26, 2026

    @ThomasK33
    MemberAuthor

    Issue coordinator desk (workspace 3203e76efb): picked up as F181. The Bug fixer lane (workspace a6151739e2) checks the cause on main first (CreationDraftStore.delete has one attempt since #6620; listCreation re-runs on connect), then posts a plan here before any code.


    Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

  3. ThomasK33 commented on Oct 26, 2026

    @ThomasK33
    MemberAuthor

    Bug fixer lane (workspace a6151739e2): I confirmed the cause on main 7d2498b1d0. The plan is below. I will not push until the issue coordinator desk says go.

    Cause

    1. CreationDraftStore.delete (src/browser/stores/CreationDraftStore.ts:593-606) drops the local entry and the sidebar row, then calls drafts.deleteCreation once. Without a client, it throws "Not connected.". Nothing retries it.
    2. Both callers only log the failure: useCreationWorkspace.ts clearPendingDraft (:659-670) and WorkspaceContext.tsx deleteWorkspaceDraft (:1714-1716).
    3. On the next connection, setClient calls loadList (:292-301, :346-373). listCreation still returns the record, so the row comes back with the sent text.
    4. On the backend, workspace create does not touch creation drafts. Only deleteProjectDrafts (project removal) deletes them.

    Two new tests in CreationDraftStore.test.ts fail on main: a delete that fails once and then reconnects, and a delete that keeps failing while the list loads again.

    Plan (one PR, Fixes #7551)

    Bring back the retry that DraftStore.deleteDraft had before #6620, inside CreationDraftStore:

    1. A pendingDeletes set. delete adds the id after the in-flight save lands, then sends.
    2. On a failed delete: retry with the existing backoff (retryDelayMs from DraftStore, 250 ms to 5 s) while the same client is connected.
    3. On a new client (setClient): send every pending delete again.
    4. loadList leaves out listed records whose delete is pending, and a confirmed delete drops the row again.
    5. delete no longer rejects. The retry logs the failure.

    Why not a backend delete on workspace create: it needs a new workspace.create input field, a backend change in workspaceService, and the same handling in createScratch. It also does not cover the sidebar Delete, which uses the same store call. The frontend retry is smaller, and it is the behavior from before #6620.

    Limit: the pending set lives in memory, as it did before #6620. If the window reloads before any retry succeeds, the record is listed again. Once any retry succeeds (on the same connection or a reconnect), the draft stays gone.


    Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $211.01

  4. added 2 commits that reference this issue on Oct 26, 2026
    038105d
    da7b705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions