Repository navigation
Regenerating a message deletes it server-side before the replacement exists #699
Description
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:
- Allow cancelling chat message generation #696
- Conversation Branching in Assistant #698
- Deletion or retry does not actually remove the chat message in Chat with AI when Context Agent is used #589
To Reproduce
- Have a conversation with at least one assistant reply.
- Hover the last assistant message and click "Regenerate message".
- 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.)
- 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 withopencode:GLM-5.3post-explore.
Activity