Skip to content

Regenerating a message deletes it server-side before the replacement exists #699

Open

Description

@WSHAPER

Which version of assistant are you using?

4.0.0 (current git main, where this was reproduced and reviewed)

Which version of Nextcloud are you using?

35.0.1 (e2e reproduced on a dev instance; the behavior is server-side app logic)

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Browser-independent; reproduced with Chromium-based browsers. The deletion happens on the backend when the regeneration is scheduled.

Describe the Bug

Scheduling a regeneration deletes the target message on the backend immediately, while its replacement only comes into existence if the new generation succeeds. The deletion happens when the task is scheduled, regardless of how the task ends, so any non-successful outcome leaves the conversation without the message:

  • the conversation permanently loses the reply, with no way to recover it,
  • the frontend keeps showing the deleted message as a ghost until the page is reloaded or the session is switched, at which point it disappears.

On released versions this is reachable today when a regeneration fails. #696 (still open at the time of writing) introduces cancellation, which makes the same loss reachable through a regular stop interaction; it also adds a frontend compensation that removes the ghost message on cancelled or failed regenerations, but the underlying data loss remains.

Expected Behavior

The old message should only be removed once the regenerated replacement exists. A cancelled or failed regeneration should leave the conversation exactly as it was.

An interim fix would defer the deletion: the regenerate endpoint schedules the task without touching the old message, and the new result replaces the old one on success (delete + insert in one transaction). The frontend compensation proposed in #696 could then be dropped again.

Long term, #698 (conversation branching) makes regeneration non-destructive altogether, so that fix would be an interim step towards it.

Related:

To Reproduce

  1. Have a conversation with at least one assistant reply.
  2. Hover the last assistant message and click "Regenerate message".
  3. Let the provider fail. (With Allow cancelling chat message generation #696 applied, stopping the regeneration via the cancel control or Escape hits the same path.)
  4. Reload the page or switch conversations and back: the regenerated message is gone, while it was still displayed before the reload.

Disclaimer

Initial spec elicited via STT whisper-base, partially polished with opencode:GLM-5.3 post-explore.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions