mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2872] [MERGED] fix: v2.0.5 chat/conversation/summary bug fixes (continue, swipe counter, author notes, drag handle, group selfie, react-gate, summary tail, streaming lag) #5774
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#5774
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2872
Author: @Romuromylus
Created: 6/25/2026
Status: ✅ Merged
Merged: 6/27/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/v205-me-bugs-batch📝 Commits (10+)
37936d2fix(chat): only show swipe counter when a message has multiple swipes (#2867)dbad3d6fix(chat): /continue creates a new reply when the last message is from the user (#2866)168405efix(panels): show touch drag handle on touch devices regardless of width (#2869)c548738fix(chat): keep Author's Notes panel open when the mobile keyboard appears (#2868)cc0d804fix(chat): include lastMessageRole in conversation slash-context deps (#2866)16ba787fix(conversation): attribute merged group-chat commands to their speaker (#2870)c845359fix(conversation): type merged command attribution without union narrowing (#2870)d31c8bafix(chat): gate Author's Notes focus guard to mobile to keep desktop outside-click (#2868)c3c68bbfix(chat): keep toolbar overflow menu open when the mobile keyboard resizes (#2868)db64ed4fix(summary): reclaim a drifted summary tail instead of stranding it (#2879)📊 Changes
14 files changed (+379 additions, -20 deletions)
View changed files
📝
packages/client/src/components/chat/ChatInput.tsx(+2 -0)📝
packages/client/src/components/chat/ChatRoleplaySurface.tsx(+21 -4)📝
packages/client/src/components/chat/ChatToolbarControls.tsx(+8 -1)📝
packages/client/src/components/chat/ConversationInput.tsx(+4 -0)📝
packages/client/src/components/chat/ConversationView.tsx(+2 -1)📝
packages/client/src/components/chat/SwipeJumpControl.tsx(+1 -1)📝
packages/client/src/components/ui/TouchDragHandle.tsx(+5 -1)➕
packages/client/src/hooks/use-throttled-stream-buffer.ts(+67 -0)➕
packages/client/src/lib/raf-throttle.ts(+63 -0)📝
packages/client/src/lib/slash-commands.ts(+14 -2)📝
packages/server/src/routes/chats.routes.ts(+6 -1)📝
packages/server/src/routes/generate.routes.ts(+50 -9)📝
packages/server/src/routes/generate/generate-route-utils.ts(+59 -0)📝
packages/server/src/services/conversation/character-commands.ts(+77 -0)📄 Description
Linked issue
Closes #2866
Closes #2867
Closes #2868
Closes #2869
Closes #2870
Closes #2877
Closes #2878
Closes #2879
Why this change
A batch of v2.0.5 issues reported in the community Discord, grouped into one PR. Each is independent and small; the root cause for each is below.
/continueappends to the wrong message. In Roleplay mode, the/continueslash command always targeted the latest assistant message, even when the user had posted since. After/impersonate(user posts last),/continueappended onto the scenario/first message (index 0) instead of generating a new reply. The toolbar/continuebutton is gated onlastMessageRole === "assistant"; the slash command had no equivalent gate.swipeCount <= 1 && !onCreateNextSwipe, and the message layouts always passonCreateNextSwipe, so the control never hid.ChatToolbarMenu), and their panels are portals rendered by buttons that live inside that menu. The menu recomputes its layout on everywindowresize and, on a mobile viewport, closes itself each time. The on-screen keyboard opening fires a resize, so opening the keyboard closed the overflow menu and unmounted the open editor panel before the user could type.md:hidden(≥768px). It is a touch-only affordance (native HTML5 row-drag covers mouse), so touch devices at ≥768px width (tablets) had no working way to drag a character into a folder.[selfie]— were attributed to the first character, so a selfie taken by another character rendered the first character's appearance and name.[react: …]text when Character Commands is off. The react capability instruction is appended to the conversation system prompt unconditionally, but the[react: emoji="…"]tag is parsed, stripped, and applied inside the command pipeline that only runs when Character Commands are enabled (metadata.characterCommands !== false). With commands off, the model was still told it could react, so it emitted the tag and the server left it in the visible message as raw text with no reaction badge. Reported in Discord as group-chat-only; it is not group-specific — the trigger is the Character Commands toggle, not group vs. solo.visible.slice(-contextSize), and that same set bounds each entry's frozenhiddenMessageIds(the batch minus the protected tail). Once a previous summary's protected tail drifts beyond the lastcontextSizevisible messages, no later entry claims it, so it stays visible forever and accumulates as stale context.What changed
lastMessageRoletoSlashCommandContextand gated the/continuehandler on it — it continues the latest assistant message only when that message is the last in the chat, otherwise it generates a fresh reply. ThreadedlastMessageRolethrough the three context build sites (ChatInput,ConversationInput×2).if (swipeCount <= 1) return null;so the counter and arrows only appear when a message has multiple swipes (pre-2.0.5 behavior). New swipes are still generated via the regenerate path.ChatToolbarMenunow closes its overflow menu only when the viewport width changes (orientation / window resize) rather than on every resize — so the on-screen keyboard, which only shrinks the height, no longer dismisses the menu and unmounts the open Author's Notes or Summary panel. Hardening in the same area:AuthorNotesButton's resize/scroll frame recompute keeps the last good frame instead of clearing it when the anchor is transiently unmeasurable, and its outside-pointer close handler no longer dismisses while a field inside the panel is focused (mobile-only, so desktop outside-clicks still close on the first click).TouchDragHandlevisibility from the width-basedmd:hiddento the pointer-based[@media(pointer:fine)]:hidden, so the handle shows on touch (coarse-pointer) devices at any width and stays hidden on mouse desktops. This is the shared handle used by the Characters, Presets, Connections, Lorebooks, and Personas panels.parseCharacterCommandsBySpeaker, which segments a merged group response by the sameName:prefixes the client uses for display (parseNamePrefixFormat+ the sharednormalizeTextForMatch) and attributes each command to its segment's character. The authoritative command list and cleaned content still come from a single whole-response parse, so no command is dropped or reordered — only the attribution is layered on, with a fallback to the generating character. Wired into generation only for merged Conversation-mode group chats; Roleplay mode, the per-character individual loop, and non-group chats are byte-identical to before.conversationCommandsEnabled, the same condition that guards the parse/strip/apply path, so the[react: …]syntax is only advertised to the model when it will actually be handled. With Character Commands enabled, reactions still strip and post as badges exactly as before.requestAnimationFramecoalescer (rafThrottle, with an injectable scheduler) and auseThrottledStreamBufferhook, and switched the conversation and roleplay live-stream renderers to read the streaming buffer through it. The live message now re-renders — and so re-parses its markdown — at most once per animation frame instead of once per token, which removes the per-token full re-parse that grows with message length. The store'sstreamBufferis still written on every token, so token-exact consumers (ChatArea's auto-scroll subscriber) are unaffected; the committed message is rendered from the React Query cache once streaming ends, so a live frame being up to ~16ms behind is never visible. On slow streams (≤60 tok/s) tokens already arrive slower than the frame budget, so this is a no-op there; the win scales with token rate (≈4× fewer markdown parses at 240 tok/s, ≈8× at 480 tok/s in a local micro-benchmark of the renderer).selectRollingSummaryMessages, a pure helper that keeps the plain last-contextSizewindow for the first summary and whenever the visible set fits the window, but extends the window back to the previous summary's boundary when visible messages have piled up past it — pulling the drifted tail back into the batch so it is summarized and hidden on this run. The boundary is identified by ids a live summary entry actually summarized (itsmessageIds/hiddenMessageIds), not the barehiddenFromAIflag — a user's manual "Hide from AI" toggle writes the same flag, and keying off it would let a stray manual hide be misread as a boundary and balloon the window to nearly the whole chat. IncludingmessageIds(guarded by a hidden-check so the protected tail isn't chosen) also covers entries created before thehiddenMessageIdsfield existed. Wired into the automatic summary (generate.routes.ts) and the manual "summarize last N" path (chats.routes.ts); the explicit manual range path is unchanged.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Tested on a build deployed to my private staging instance.
/impersonate "Hi"then/continue— confirm a new assistant reply is created rather than text being appended to the scenario message. Also confirm the normal case still continues: with the last message being an assistant reply,/continueextends it.n / mcounter and arrows.resize/visualViewport resize): before the fix the panel unmounted on the simulated keyboard; after the fix it stays open and preserves typed text.[react: emoji="…"]text in every reply with no badge. After the fix, with commands off the model is no longer told it can react, so the raw tag no longer appears; with commands on, reactions still post as badges.rafThrottle(a burst of calls in one frame collapses to a single apply with the latest value; per-frame ordering; flush/cancel; clearing to empty is delivered). The O(n²) per-token re-parse and the throttled-vs-current parse counts were measured against the realrenderMarkdownBlocks(message length ×2 → streaming parse time ×~4; throttling cuts parse work ≈4× at 240 tok/s and ≈8× at 480 tok/s, and is a no-op at ≤60 tok/s).selectRollingSummaryMessages+computeSummaryHideIds: the first summary still selects the plain last-contextSizewindow; a previously-protected tail that has drifted beyond the window is bridged back and hidden (e…n) instead of stranded; a manual "Hide from AI" is not treated as a boundary (no window ballooning); and pre-hiddenMessageIdsentries still anchor a boundary. Also manually verify across two consecutive automatic summaries with a nonzero tail that no previously-summarized message remains visible, and that toggling "Hide from AI" on an early message before an automatic summary does not blow up the summarized range.Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.