mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3105] [Issue]: /continue with rewrite agents can overwrite instead of appending to last message #1665
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1665
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @spacyH on GitHub (Jun 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3105
Originally assigned to: @SpicyMarinara on GitHub.
Summary
When using
/continue(or sending a blank message) in a chat with text rewrite agents enabled (prose guardian, continuity, editor), the continuation can fully replace the previous assistant message instead of appending to it. The original message content is silently destroyed.This is a data loss bug. The merge step briefly writes the correct combined content to the database, but a later text-rewrite phase overwrites that message with rewritten continuation text only.
The bug is probabilistic: it fires only when a text rewrite agent decides the continuation needs editing (
editNeeded: truefor prose-guardian/continuity, or a changed result for editor). If agents judge the text acceptable, the merged content survives.[NOTE: The initial investigation & recommendations were made by Prof. Mari, then reviewed & refined by Cursor (Composer 2.5) and me.]
Expected behavior
The continuation should append to the existing assistant message, producing:
[original content][continuation content]. Text rewrite agents, if they run, should operate on and persist the full merged message.Actual behavior
When a text rewrite agent applies an edit during a continue flow, message content is replaced entirely with
[rewritten continuation text only]. The original content is lost. No error or warning is shown.Steps to reproduce
/continueor send a blank message to trigger continuation.editNeeded: true(strict agents) or produces changed text (editor).Environment
generate.routes.tsbetween those releases)Additional context
Root cause trace (
packages/server/src/routes/generate.routes.ts, v2.0.8)Phase 1 — merge & save (correct): Lines 7027–7031 call
appendContinuationMessageContent(defined at line 741) and persist old + new content toinput.continueMessageId.Phase 2 —
combinedResponse(new text only): Line 7476 setscombinedResponse = allResponses.join("\n\n"), which contains only newly generated text, not pre-existing message content.Phase 3 —
messageIdtargets the continued message: Line 7895 setsmessageId = lastSavedMsg.id, which resolves toinput.continueMessageId.Phase 4 — text rewrite overwrites merge (the bug): Lines 9207–9208 gate rewrite with no
continueMessageIdguard and seed rewrite input fromcombinedResponseonly:Line 9285 then writes rewritten new-text-only back to the same message:
continueMessageIddoes not appear anywhere in the rewrite block (grep finds only 9 occurrences in the file, all outside this section).Probabilistic firing
Lines 9263–9281 gate whether a rewrite is applied:
editNeeded === true.textRewriteDropsProtectedMarkup), unchanged text, empty result.Version check (2.0.6 → 2.0.8)
CHANGELOG.mdhas no entry for this continue + text-rewrite overwrite path. Related fixes in 2.0.7 (#2920 empty-submit vs/continueseparation, #2983+ text-rewrite markup preservation) do not address merged-content overwrite. Git history ongenerate.routes.tsbetweenv2.0.6andv2.0.8shows no targeted fix.Suggested fixes
Option A (quick, safest): Skip text rewrite when
continueMessageIdis set:Option B (proper): Feed merged content to rewrite agents:
Requires capturing pre-merge content before the rewrite phase overwrites it.
Client-side note (minor, separate)
use-generate.tsmessage_savedhandler forcontinueMessageIdmay leave a__streaming__bubble briefly; display glitch only, not data loss.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 30, 2026):
Taking this in branch
codex/issue-sweep-3098-3105; I’ll patch the continue + rewrite overwrite path and close this once the fix is merged.