mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #6220] [Issue]: Context usage bar over-reports on turns that made more than one request #3469
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#3469
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/6220
Originally assigned to: @SpicyMarinara on GitHub.
Summary
The context usage bar treats prompt tokens as the size of the prompt the model saw, but the persisted prompt figure is a sum across every request the turn made. A turn that resent the prompt for a tool round or for the dice outcome rewrite shows roughly twice the real context.
Expected behavior
The bar reflects how full the context window is, not the turn's billing total.
Actual behavior
packages/client/src/lib/professor-mari-context-budget.ts:31-38computesusedTokens = promptTokens + cachedPromptTokens + cacheWritePromptTokens + completionTokensfrom the persisted per-turn figures. The route accumulates oneusageobject across tool rounds (packages/server/src/routes/generate.routes.ts:7131-7145), the final follow-up (:7444-7456) and the dice follow-up (:8049-8060), and persists that sum. There is no per-request breakdown stored anywhere.Steps to reproduce
Environment
29ee24fc2)Logs, screenshots, or video
Not applicable; the arithmetic is at the cited lines.
Additional context
A
requestCountongenerationInfo, or a small per-request array of prompt, cached and cache-write tokens, would fix the bar and would also make a zero cache read on the second request visible instead of buried in the turn total.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).New generations record the latest request’s context size separately from the turn’s cumulative billed tokens. The context bar uses that value and does not infer a total if the latest report is missing. Native Anthropic cache counts are included once. Historical records without per-request metadata retain their legacy estimate until another generation.