mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
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#7872
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/7672
Author: @Gunterlie
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @Gunterlie
Base:
staging← Head:chore/7573-tool-rounds📝 Commits (3)
2665612refactor(generate): move the tool-call round loop into runToolRounds6348594refactor(generate): read the usage provider per request, as before579c496test(generate): cover the game tool-plan branch of runToolRounds📊 Changes
6 files changed (+790 additions, -473 deletions)
View changed files
📝
packages/server/src/routes/generate.routes.ts(+110 -465)➕
packages/server/src/routes/generate/tool-rounds.ts(+453 -0)📝
scripts/regressions/game-mode-dice-tool.regression.ts(+8 -3)➕
scripts/regressions/generate-tool-rounds.regression.ts(+209 -0)📝
scripts/regressions/maintenance-lifecycle.regression.ts(+1 -1)📝
scripts/regressions/roleplay-streaming.regression.ts(+9 -4)📄 Description
Linked issue
Part of #7573 (second slice). Stacked on #7671: the base is that branch. Merge #7671 first, then retarget this PR to
staging.Why this change
The tool-call round loop was about 470 lines inside
generateForCharacter, the 3,800-line closure of the generation handler. It holds the requests, the abort handling, the textual tool-call rollback and the usage counters. #7570 was a defect in exactly this loop: the rollback sent raw text, and the filter that should have hidden it was out of sight. This PR moves the loop into one module with a regression that drives it with a fake provider. The handler now passes in what the loop needs and gets back what it changed.No behaviour change.
What changed
packages/server/src/routes/generate/tool-rounds.ts:runToolRounds(ctx, fullResponse)holds the tool rounds, the roll-abort and generation-abort handling, the textual tool-call rollback withcontent_replace, the usage callbacks, the final no-tools round and the about-me proposal helper. It returns{ aborted, fullResponse, finishReason, geminiResponseParts, narratorMessages }.generate.routes.ts(now about 15,200 lines) calls it. Request options, the token limits, encrypted reasoning and the usage provider are read per request through callbacks, as before. The partial reply is copied back before an abort returns, so a merged generation still saves it.scripts/regressions/generate-tool-rounds.regression.ts: the textual tool-call rollback, an abort mid-request, a roleplay roll cut mid-stream, and the final round without tools.game-mode-dice-tool,maintenance-lifecycleandroleplay-streamingfollow the moved code.Validation
pnpm checkpasses locallyCONTRIBUTING.mdAgent-run results (not a substitute for the boxes above):
pnpm check: passed.generate-tool-rounds,roleplay-function-calling,generation-usage,game-tool-outcomes,advanced-memory-post-generation,generate-agent-abort,roleplay-streaming,roleplay-commands,one-request-dice-rendering,command-only-regenerate,provider-stream-completion,maintenance-lifecycle,game-mode-dice-tool,generation-stream-output. A sweep of the 89 regressions that readgenerate.routes.tspassed after the pin updates above.Manual verification notes
[roll: …]request stops the stream, the roll shows, and the reply continues.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.