mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5474] Game Mode: narration choices do not repopulate after rewinding to a mid-log message #3036
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#3036
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 24, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5474
Originally assigned to: @SpicyMarinara on GitHub.
Game Mode: narration choices do not repopulate after rewinding to a mid-log message
Classification: ENGINE-SIDE. Not a Pixelforge defect — filed from a Pixelforge playtest only because that is where it was seen. Choice presentation is entirely Game Mode's; the package declares
providesChoices: falseand never touches it.Repro
[choices: ...].Observed 2026-08-24, second playtest of Pixelforge 0.11 against Engine 2.4.3.
Why it is engine-side
Choices are not persisted anywhere. There is no
gameChoicesmetadata key and no choices table —choice_blocksis unrelated prompt-preset machinery. They are ephemeral React state, re-derived from the message text each time the pipeline decides a turn is "new":packages/client/src/components/game/GameSurface.tsx:2884—const [activeChoices, setActiveChoices] = useState<string[] | null>(null);:5070-5072— the primary populate, insideprocessScene:if (!suppressInteractiveCommands && tags.choices) setActiveChoices(tags.choices);:12290— the render gate:const choicesVisible = Boolean(activeChoices && narrationDone);Suspected mechanism (two candidates, both in the same file)
A.
processSceneis keyed on message id alone, so a rewind that lands on a message it has already processed never re-derives choices.GameSurface.tsx:4921—if (lastProcessedMsgRef.current === msg.id) return;handleRetryTurnis the one flow that knows this and clears the ref explicitly (:6660, withsetActiveChoices(null)at:6635). Any other timeline move onto an already-processed id returns early. Two aggravating facts:processScene's reset block (:4931-4945) resetsnarrationDoneMsgId,partyDialogue,queuedQte,queuedEncounter,pendingSegmentEffectsand more — but neversetActiveChoices(null). So the state is neither refreshed nor cleared; whatever the last processed turn left is what stays.:4502-4508, "Re-extract interactive tags … so they survive unmount/remount and page refresh") is one-shot per scope:if (sceneRestoredRef.current || …) return;(:4462), and the scope key is`${activeChatId}:${activeGameMetaId}`(:2413), which does not change on a rewind inside the same chat. So it never re-runs either.B.
gameNarrationMessageIdcarries no swipe index, so a restored cursor can be measured against a different swipe's segments — and out of bounds means "jump to the end".GameSurface.tsx:4774persists{ index, messageId: latestAssistantMsg.id };:4819and:4831compare ids only.GameNarration.tsx:2840— the narration reset key does include the swipe:`${latestAssistant.id}:${latestAssistant.activeSwipeIndex}`.GameNarration.tsx:2890-2893— when the restored index exceeds the new segment count it falls back tosegments.length - 1, i.e. straight to the last segment, which immediately satisfiesnarrationComplete(:2298) and flipsnarrationDonetrue.The two halves of the machine therefore disagree about what a "new turn" is: narration restarts on a swipe, choice derivation does not. A restore that lands past the end also silently skips every unpresented segment — which is a second, related bug worth noting in the same report.
A third, lower-confidence path:
interruptedInteractiveCommandKeysRef(:2998) is consulted assuppressInteractiveCommandsat both:4504and:4967. Once a message id is in that set, choices for it are suppressed on every future re-derivation, including after rewinding back onto it. OnlyhandleRetryTurn(:6657) removes an entry.Also worth capturing while the area is open
narrationDone.messageOffset > 0suppresses bothonSegmentChange(GameNarration.tsx:2941) andonNarrationComplete(:2398), sonarrationDoneholds its last value while the player reviews the past — andchoicesVisiblekeeps rendering against that frozen value.packages/server/src/routes/chats.routes.ts:3803-3821—settingsToKeepdeletes only summary keys, sogameNarrationIndex/gameNarrationMessageIdare inherited into a branch whose messages get new ids. Benign today (the id will not match), but it is stale data carried into every branch, and it contrasts with the deliberate handling on the line beside it:settingsToKeep.gameWidgetState = restoreBranchHudLists(...).Suggested direction
Key the narration cursor and the scene-processed marker on
id:activeSwipeIndexrather thanid, matchingnarrationKeyinGameNarration.tsx:2840, and haveprocessSceneclearactiveChoicesin its reset block so a turn without a[choices:]tag cannot inherit the previous turn's cards.Environment
Engine 2.4.3 (
bb551bf921c006922edac7be06dbea8fe4c999b9), staging. Pixelforge 0.11.0, capability API 1.10. Line numbers are against thestagingcheckout on 2026-08-24 and were read directly, not inferred.@SpicyMarinara commented on GitHub (Aug 25, 2026):
Completed and landed on
stagingin #5503.