mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6221] [Issue]: Tool-round and dice follow-up usage accumulators sum different fields #3470
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#3470
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 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6221
Originally assigned to: @SpicyMarinara on GitHub.
Summary
The three places that accumulate usage across a turn's requests do not sum the same fields. The tool loop and the final follow-up add five fields; the dice outcome follow-up adds nine. A turn's reasoning-token total therefore depends on which path added the request.
Expected behavior
One accumulator, or three that sum the same set of fields, so the persisted reasoning, audio and prediction totals cover every request of the turn.
Actual behavior
packages/server/src/routes/generate.routes.ts:7131-7145(tool rounds) and:7444-7456(final follow-up) sumpromptTokens,completionTokens,totalTokens,cachedPromptTokensandcacheWritePromptTokensonly. The dice follow-up at:8049-8060also sumscompletionReasoningTokens,completionAudioTokens,acceptedPredictionTokensandrejectedPredictionTokens. Because the first round's usage is copied whole and later rounds only add the five fields,tokensReasoning(:8484) ends up holding the first round's reasoning alone.Steps to reproduce
Environment
29ee24fc2)Logs, screenshots, or video
Not applicable; the three accumulators are at the cited lines.
Additional context
Extracting one helper that both paths call, in the shape the dice follow-up already uses, is the smallest fix.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Sep 15, 2026):
Owner: @SpicyMarinara, with Codex implementing this issue as part of the requested sweep in draft PR #6230 against
staging. I checked the open PRs and issue-linked work before starting; no competing open PR was found.@SpicyMarinara commented on GitHub (Sep 15, 2026):
Merged in #6230 to staging (
c6685f7034).Tool rounds, finalization and dice follow-ups now share the same usage accumulator, preserving reasoning, audio, prediction and cache counters as well as prompt/completion totals. Focused tool/finalization and dice regressions pass.