Skip to content

Undo of a server Discard all brings the AI's change back over Live typing #1733

Closed

Description

@haowjy

Found while fixing #1727. Undoing the Changes list's Discard all brings the AI's change back over a word the writer typed in Live since, at any timing. The draft then proposes replacing the writer's word, and no "couldn't come back" line shows. Nothing is lost: Live keeps the typed word until the writer applies.

Steps (mock stack, one chat in Draft mode that replaced "old gate" with "crumbling gate"):

  1. Open the chat's Changes list and press Discard all.
  2. Open the document beside the chat (Live), select "old" and type "grey".
  3. Wait 12 s, then press the row's Undo discard of Gate.

Result: the draft shows "grey" struck and "crumbling" added. Pressing Undo at once does the same.

Expected (as #1727 settles it for a room Discard): the line "1 change couldn't come back: the text changed after it was discarded." and the draft keeps the writer's word.

Cause: Discard all is a server Discard. Its Undo (createDrizzleUndoDiscard → reopen in apps/server/server/domains/collab/adapters/drizzle-reopen-drafts.ts) reopens the closed draft as it was, with its old base. The next Live pull merges Live's new text into it with contentMerge, where the draft's side wins a conflict, so the AI's word stays as a proposal over the writer's. Nothing on this path asks whether the discarded text was edited since. The room Discard's Undo (the chat strip, the editor) asks that with touchedSince, so the two Undos of the same kind of action disagree.

Needs a decision: should restoring a whole discarded draft leave out a change whose Live text was edited since, and count it in leftOut the way a room Discard's Undo does? If yes, the check belongs in reopen, against the Live text the draft's base last saw.

Activity

  1. haowjy commented on Nov 16, 2026

    @haowjy
    OwnerAuthor

    Fixed by #1735, merged into the integration branch feat/document-commands-never-refuse; reaches main with #1555.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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