mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3385] [Issue]: Branching a roleplay/VN chat clears all tracker state (world + character tracker) — snapshot copy is gated to Game mode only #1835
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#1835
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 @kolacheee on GitHub (Jul 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3385
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
When you branch a chat, the world/character tracker state is wiped in the new branch — even though the tracker agents are still on and you're continuing from the same point in the same conversation. You end up having to recreate everything by hand: the world tracker, and especially the character tracker (including the per-character variable fields, which aren't easy to re-add).
The cause: branching copies the tracker snapshots to the new branch only for Game-mode chats. Roleplay and Visual Novel chats use the exact same tracker snapshots, but the copy step skips them, so the branch starts with empty tracker state. This is a bug, not intended behavior — a branch continues the same conversation from the same point, so the tracker state should carry over just like it does in Game mode.
How to reproduce (try it yourself)
You'll see: the tracker panels are empty / reset — all world and character tracker info (including custom character variables) is gone, even though the agents are still enabled and the messages carried over.
Expected: the branch keeps the tracker state up to the branch point, the same way Game-mode branches do.
Where it is
packages/server/src/routes/chats.routes.ts— the branch route copies game-state/tracker snapshots to the new branch only when the source chat is Game mode:These
gameStateSnapshotsare keyed by(chatId, messageId, swipeIndex)and are mode-agnostic — the same snapshots roleplay/VN trackers write and that the generation path reads back as "committed tracker context" (packages/server/src/routes/generate.routes.ts~2519getCommittedForMessages, ~3068injectCommittedTrackerContext). The branch route's own comment calls them "the correct tracker state for that specific message." So themode === "game"condition is an over-restriction that drops roleplay/VN tracker state. (Messages and their swipes ARE copied for every mode — only the tracker snapshots are gated.)What's happening
The tracker-snapshot copy on branch was scoped to Game mode, but trackers exist in roleplay and visual-novel modes too (same snapshot table). So a roleplay/VN branch copies the messages but none of the tracker snapshots, and the new branch reads back empty tracker state. The per-character variable fields the reporter mentions are the snapshot's
manualOverrides(copied atchats.routes.ts~3180/3198 inside the same gated block), so they're lost too.Suggested fix
Copy the
gameStateSnapshotson branch regardless of mode — change the guard fromsourceChat.mode === "game"to justsourceToBranchedMessageId.size > 0(the copy is keyed per message and no-ops for a chat that has no snapshots). If desired, keep the turn-game engine-state (gameEngineState, UNO) copy inside a game check, but the tracker snapshots should be copied for roleplay and visual_novel too. This restores the world tracker, character tracker, and the per-character variables (manualOverrides) in the branch.On the reporter's "did this work before?" — I can't speak to history without git blame, but the current v2.1.1 code definitively gates tracker-snapshot copying to Game mode, so roleplay/VN branches lose tracker state today. It's a bug, not a feature request.
AI-investigated against v2.1.1 (
git describe= v2.1.1); the branch mode gate, the snapshot fields, and the roleplay generation read/commit of these snapshots were all read and confirmed. Please verify before fixing.@SpicyMarinara commented on GitHub (Jul 8, 2026):
Addressed in #3388 and merged to staging.