mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8702] [MERGED] fix(generation): a failed routing agent prompt is sent to each connection once #8754
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#8754
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/8702
Author: @SpicyMarinara
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/no-duplicate-provider-requests📝 Commits (2)
b4a7c04fix(generation): send a failed character-routing prompt to each connection once7c4fdfdfix(generation): keep the reply's fallback for character routing📊 Changes
3 files changed (+285 additions, -22 deletions)
View changed files
📝
packages/server/src/routes/generate.routes.ts(+15 -19)📝
packages/server/src/services/generation/agent-resolution.ts(+14 -3)➕
scripts/regressions/provider-requests-per-action.regression.ts(+256 -0)📄 Description
Linked issue
Closes #8694
Why this change
The maintainer saw prompts and requests appear twice for one message on Google and Claude endpoints.
The main reply never sends twice. A fake Gemini and Anthropic server counted provider requests per action through the real
/api/generateroute and through the browser client:The real duplicate was in the character-activity (routing) agent:
The debug console also logs every prompt twice per request: once as "Prompt sent to model" and once as the provider's "final request" body. That can look like a double send. #8691 makes those logs readable.
What changed
generate.routes.ts: the routing path passes the plain provider, as the reply's own agents already do, so agent resolution adds each fallback, retry and admission layer only once.Routing keeps the reply's main fallback.
resolveAgentPipelineAgentstakes an optionalchatConnectionMainFallback, so routing on the chat's connection still falls back to the reply's "If it fails" connection, as on staging. A review found that the first version of the fix dropped this, and that is fixed. The reply's own agents don't pass it, so they are unchanged.New regression
scripts/regressions/provider-requests-per-action.regression.ts. Against a fake server speaking GeminigenerateContent/streamGenerateContentand Anthropic Messages (SSE and JSON), it checks:It fails before the fix:
{ primary: 1, fallback: 2 }, and the 429 case gives{ primary: 49, fallback: 56 }.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
What the agent ran locally, rebased on staging:
node ./scripts/pnpm-runner.mjs checkexits 0.provider-requests-per-actionandagent-connection-parameterspass./v1/messagesper call. With an API key it also sends oneHEAD /api/helloconnectivity check, which carries no prompt.For a human to verify:
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No docs changes: no user-facing doc describes agent fallback order or request counts.
UI evidence (if applicable)
No UI change.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.