mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2323] [Issue]: branch_chat nulls the new branch's gameState on a partial branch, losing bootstrap world-state #1150
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#1150
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/2323
Originally assigned to: @Xelvanis on GitHub.
Summary
Severity: Medium — Data-loss.
branch_chatcan null the new branch'sgameStatewhen no copied assistant message has a tracker snapshot at its active swipe, dropping the branch's initial/bootstrap world-state. The branch then opens with no visible world-state until a later turn regenerates it.Expected behavior
Branching should preserve the branch's visible world-state. When no per-message snapshot is copied, it should fall back to the bootstrap tracker snapshot rather than nulling
gameState.Actual behavior
src-tauri/src/commands/storage/chats.rs:1102-1106:The if/else-if chain is: (1)
visible_tracker_target.is_some()→ patch gameState to that snapshot; (2)else if !chat_game_state_is_bootstrap→ set gameState = Null (1102-1106); (3)else if copy_bootstrap_tracker_snapshot(...)→ patch to bootstrap (1107-1115).When
visible_tracker_target == None(no copied assistant message has an active-swipe snapshot) AND the cloned sourcegameStateis message-bound (sochat_game_state_is_bootstrapreturns false), branch (2) fires and nulls gameState — making branch (3) unreachable, so the bootstrap snapshot is never copied.copy_tracker_snapshots_for_messageonly copies per-message snapshots, never the bootstrap (messageId""); the bootstrap is copied solely bycopy_bootstrap_tracker_snapshot, the shadowed branch.sync_chat_game_state_to_visible_trackeronly runs on message/swipe delete (not on branch/open), so it is not self-healed until the next turn.Steps to reproduce
gameStatebound to a later message).gameStatewiped to null.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. The copied per-message snapshots are not lost (only the bootstrap fallback + the convenience
gameStatefield), and the next turn regenerates state, hence medium.Additional context
Suggested fix: when
visible_tracker_targetis None but tracker snapshots were copied (or a bootstrap snapshot exists), fall back to the latest copied snapshot orcopy_bootstrap_tracker_snapshotbefore zeroinggameState; only nullgameStatewhen no copied/bootstrap snapshot exists at all. Reorder so the bootstrap-copy branch can still run when the cloned gameState is message-bound.Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: