mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2320] [Issue]: Pressing Stop mid-stream discards the entire partial assistant message (never persisted) #1147
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#1147
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 @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2320
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Medium — Data-loss (work-in-progress). When the user presses Stop during streaming, the abort throws out of the stream loop before
saveAssistantMessageruns, so the assistant text the user already watched stream in is discarded — it is never persisted, and the UI buffer is cleared. There is no way to keep, swipe, or continue from the partial. This differs from SillyTavern-style keep-on-stop behavior.Expected behavior
A user-initiated Stop should "finish early with what we have": persist the partial assistant message generated so far, then cancel the remaining post-processing (agents/illustrations/tracker). The streamed text should remain in the chat.
Actual behavior
In
src/engine/generation/start-generation.ts,streamMainGenerationLoop(3287-3453) accumulates the text in a localcontentreturned only on normal completion (3452).throwIfAborted(signal)gates inside the loop throwabortGenerationError()the moment Stop fires, dropping the accumulated content. Both paths placethrowIfAbortedimmediately before the only save:No partial-save path exists. The UI (
use-generate.ts) persists the assistant message only via themessage/assistant_messageevents, which the engine emits aftersaveAssistantMessagesucceeds; on abort it throws first. The catch (1681-1687) rethrows AbortError andstopGenerationUi()clears the stream buffer, wiping the on-screen partial too.Steps to reproduce
ChatInput.tsx→chat.store.stopGeneration→controller.abort()).Impact area
Environment
b0e5561dLogs, screenshots, or video
Static source audit; cited to file:line above.
Regression notes
Found via static audit of the refactor branch; not verified against main. Lost content is freshly generated and never-committed (no corruption of saved data) and Stop is explicit and regenerable, hence medium.
Additional context
Suggested fix: on
AbortError, if the accumulatedcontent/UIreceivedbuffer is non-empty, runsaveAssistantMessagewith the partial before propagating, then keep the heavier post-savethrowIfAbortedgates so agent/illustration/tracker work is still cancelled. Capturecontentvia try/finally out ofstreamMainGenerationLoopso the caller can persist it whensignal.aborted && content.trim().Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@Romuromylus commented on GitHub (Jun 6, 2026):
Fixed by #2427, merged into
refactor.