mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6156] Continuing a cut off Game message runs an extra planning request and overrides the continue instruction #3429
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#3429
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 (Sep 13, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6156
Originally assigned to: @SpicyMarinara on GitHub.
When a Game chat has a separate connection set for its tool calls, asking the model to continue a cut off Game master message still runs a full tool planning pass on that second connection, even with tool use switched off, and the results of that pass are pasted into the prompt after the instruction that tells the model to continue where it stopped. The model's final instruction ends up being "Write the narration using these results" instead of "continue your cut off message", and one extra request is billed for a turn that was already being narrated.
This is currently only reachable through a direct call to the generate endpoint, because Game mode ships no Continue button and no /continue command. It is worth a small guard now so the behaviour is correct the day a Continue affordance is added to Game mode.
How to reproduce (try it yourself)
/api/generate/with{"chatId":"<chat id>","streaming":true,"continueMessageId":"<the GM message id>","continueAddsNewline":true}.What you'll see: one planning request is billed on the tool connection for a turn that is already half narrated, it can return a fresh dice roll even though tool use is off, and the narrator prompt's last user turn ends with "The engine ran a separate tool-planning pass for this action... Write the narration using these results. Do not reroll these actions or claim a failed tool succeeded.", placed 233 characters after "Your last message got cut off! Please, continue!".
What should happen: a continuation should not trigger a new planning pass at all, and the continue instruction should stay the last thing the model reads. Control check: clear the Game tool connection and repeat the identical POST. No planning request is made, and the prompt ends exactly on the continue instruction.
Where it is
At staging
ac14dd704,packages/server/src/routes/generate.routes.ts:gameToolConnection && toolsAttached && toolDefs?.length, with no!input.continueMessageIdguard (compare the!input.impersonateguard that does exist on the connection gate at lines 5136 to 5141).role: "user"message afterinitialProviderMessages, therefore after the continuation prompt.packages/server/src/services/generation/tool-resolution-runtime.ts:1062:roll_diceis auto attached for Game mode, sotoolsAttachedis true on every non impersonate Game generation and the plan fires even with tool use off.What's happening
The planning pass has no idea the request is a continuation, so it treats a half finished turn as a brand new action and plans tools for it again. Its results are then appended to the end of the message list, which is built after the continuation prompt was already added, and the two get merged into the same user turn. Because the planner's wrapper text ends with a directive ("Write the narration using these results") rather than being plain tool data, it lands as the model's last instruction and competes with the instruction to continue from the exact cut off point.
Suggested fix
Simplest option: skip the planning pass when
input.continueMessageIdis set, alongside the existing impersonate guard. The turn's tools were already resolved when the message was first generated, so nothing needs replanning, and this also removes the extra billed request. If the plan should still run on continuations, then insert the tool results before the continuation prompt instead of after it, and reword the wrapper so it reads as material to use while continuing rather than a fresh instruction to write narration, for example "Use these results while continuing your cut off message; do not restart it." Either way the continue instruction must end up last. A regression covering a Game generation withcontinueMessageIdset and a Game tool connection configured would pin whichever behaviour is chosen;scripts/regressions/game-tool-controls.regression.tsnever setscontinueMessageIdtoday.Context
Introduced by PR #5982 (the separate Game tool connection and planning pass), which closed issue #5957. Neither the issue nor the PR discusses continuations. PR #6137 did not touch this area: its diff contains no reference to
continueMessageId, the continuation prompt, or the plan path. Unreleased on staging (latest release tag is v2.4.4). Related but different: #6130 covers Peek Prompt omitting the planner's billed request.Found by an AI-assisted sweep and re-verified against staging
ac14dd704on 2026-09-13. Please verify before fixing.@SpicyMarinara commented on GitHub (Sep 13, 2026):
Codex is addressing this report on behalf of @SpicyMarinara in draft PR #6168 as part of the requested issue sweep. I will verify the reported path against staging and preserve existing behavior outside the narrow fix.