mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5131] [Issue]: Branching a Conversation chat drops its turn-game state (game_engine_state copy gated to game mode) #2836
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#2836
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 (Aug 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5131
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Branching a Conversation chat that has an active turn-game (UNO, Chess, Poker, Tic-Tac-Toe, Rock-Paper-Scissors, etc.) drops the turn-game's engine state on the new branch. The branch route only creates the
game_engine_statecopy store whensourceChat.mode === "game", but turn-games run in Conversation mode, so their engine rows are never copied to the branch.Expected behavior
Branching a Conversation chat should carry the turn-game's
game_engine_staterows to the new branch (the same way the route already copies game-mode tracker/spatial snapshots), so the branch continues the game from the branch point.Actual behavior
The turn-game state is lost on the branch. The new branch has no
game_engine_staterows, so the turn-game resets/disappears in the branch, while the source chat is unaffected.Steps to reproduce
game_engine_staterows exist for the chat.Environment
staging(2.4.3); present in every release since the engine-state branch-copy was addedRoot cause
packages/server/src/routes/chats.routes.ts, the chat-branch route (~L3899):game_engine_stateholds both game-surface Experience state (Game mode) and turn-game state (Conversation mode). Themode === "game"gate excludes Conversation, so the downstream engine-state copy loop (each site guarded byif (gameEngineStore)) is skipped entirely for Conversation branches.This is pre-existing: the gate was introduced when the engine-state branch-copy was first added (commit
e1e378b7e), and it is unchanged onstaging. It is independent of the experience-state work in #5106 — that PR reworked the per-anchor copy loop (limit(1)→ all rows) but not this mode gate. CodeRabbit surfaced it while reviewing #5106's nearby change, which is why it is filed here separately.Suggested fix
Create
gameEngineStorefor Conversation as well as Game mode (null for other modes), so the existing copy loop runs for Conversation turn-games:(Creating it unconditionally would also work — the copy loop is a no-op when a chat has no engine rows.) A regression should branch a Conversation chat that has turn-game engine rows and assert the branch retains them at the re-keyed anchors.
Additional context
Found during CodeRabbit's review of #5106 (host-owned experience-state routes). Related engine-state-on-branch handling lives in the same route; this specific gap concerns Conversation-mode turn-games, not the game-surface Experiences that PR targets.
Template check
@SpicyMarinara commented on GitHub (Aug 16, 2026):
Taking this now as SpicyMarinara. I’ll keep the fix scoped to Conversation/Game engine-state branch copying, add an end-to-end Conversation branch regression, and track the work in a draft PR against staging.