mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6665] [MERGED] fix(generation): report a reply budget spent on the prompt #7277
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#7277
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?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6665
Author: @SonaGat3
Created: 9/25/2026
Status: ✅ Merged
Merged: 9/25/2026
Merged by: @SonaGat3
Base:
staging← Head:fix/6614-log-reply-budget-reduction📝 Commits (1)
2f16b4cfix(generation): report a reply budget spent on the prompt📊 Changes
4 files changed (+40 additions, -9 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
packages/server/src/services/llm/base-provider.ts(+22 -9)📝
packages/shared/src/types/generation-integration.ts(+2 -0)📝
scripts/regressions/context-fit.regression.ts(+14 -0)📄 Description
Linked issue
Refs #6614
Why this change
fitMessagesToContextcan hand the reply budget to the prompt instead of dropping messages, down to a floor of 128 tokens. That is the right call — better than sending a request the backend will truncate — but it happens silently.[LLM context] Trimmed prompt ...). Spending the reply budget is not, so a user whose configured Max Tokens never reaches the provider has nothing to go on.What changed
ContextFitResultcarriesrequestedMaxTokens, the budget the caller asked for, alongside the one actually used.logContextTrimreports both adjustments instead of returning early on the first. The existing trim message is unchanged, so anyone grepping for it still finds it.warn; any smaller reduction logs atdebug. Single-shot prompts (summarizers, Noodle refreshes) carry no removable history and give the reply budget back by design on every call, so warning on those would add noise to working setups.No behaviour changes: what gets sent to the provider is identical, only what is reported differs.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm check: passes (exit 0).node scripts/run-regressions.mjs --filter context-fit: passes, including the two new cases.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Not applicable: no UI change. Surfacing the reduced budget in the UI would help too, but that touches client and server and belongs in its own change.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.