mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6155] Game turns that used a separate tool connection are saved as having finished with a tool call #3428
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#3428
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/6155
Originally assigned to: @SpicyMarinara on GitHub.
When a Game chat runs its tool planning on a separate connection, the finished narration is recorded with a finish reason of "tool_calls" even though the narrator ended the reply normally. You can see it in Peek Prompt, and if the narrator happens to come back empty the same wrong value is quoted back at you in the error message, pointing at a tool call that is not what stopped the reply.
How to reproduce (try it yourself)
I force the gate.What you'll see: the finish reason reads
tool_calls, even though the narration completed normally. If the narrator returns nothing at all, the error readsThe AI returned an empty response (finish reason "tool_calls"). Try sending your message again.What should happen: the field should be empty, the same as it is when you set "Game tool connection" back to "Same as narrator" and replay the same turn, and the empty-response message should read
The AI returned an empty response. Try sending your message again.Where it is
packages/server/src/routes/generate.routes.ts:result = { content: null, toolCalls: gameToolPlan.toolCalls, finishReason: "tool_calls" }, a synthesized value no provider ever reported.finishReason = result.finishReason;, then the loop breaks at :7328.finishReason = usage.finishReason ?? finishReason;, so the narrator only overwrites it when its provider reports one. Same shape at :8023 for the post-roll rewrite.extraUpdate.generationInfo.finishReason, surfaced bypackages/client/src/components/chat/PeekPromptModal.tsx:44.describeEmptyModelResponseinpackages/server/src/services/generation/empty-response-reason.ts:41-80.packages/server/src/services/llm/providers/claude-subscription.provider.tsnever reports a finish reason at all (lines 669 to 677).What's happening
The planning pass fakes a provider result so the tool loop can carry the planned calls forward, and that fake result sets a finish reason of "tool_calls". That value is assigned to the turn's finish reason before the loop breaks, and the narrator pass only replaces it if its own provider reports one. Providers that report nothing, such as the Claude subscription transport, leave the planner's stale value in place, so it gets saved onto the message and shown to the user. Nothing branches on the value, but it is not purely cosmetic: the empty-response diagnostic quotes it verbatim, which misdirects anyone trying to work out why a turn came back blank.
Suggested fix
Do not let the narrator pass inherit the planner's synthesized finish reason. Reset the turn's
finishReasonto undefined when breaking out of the tool loop on the planner path, or simply do not assign the synthesized value at line 7117 in the first place, so a provider that reports nothing leaves the field empty and matches what the same chat saves on "Same as narrator".A regression for this needs a narrator fixture that reports no finish reason and an assertion on the saved
generationInfo.finishReason. The shippedgame-tool-controlslane passes because its mock narrator returnsfinishReason: "stop", which masks the stale value.Context
Left by merged PR #5982, which implemented feature request #5957 (running Game tool calls on a different connection than narration). It is unreleased on staging: the latest release tag is v2.4.4. PR #6137 did not touch the planner region of
generate.routes.tsor the empty-response helper. The fix can ride along with the planner prompt-shape defect on this same feature, since both live in this file.Found by an AI-assisted sweep and re-verified against staging
ac14dd704on 2026-09-13. Please verify before fixing.Related issue from the same sweep: #6148 (the planner-path prompt shape defect the fix can ride along with).
@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.