mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #4423] [CLOSED] AFTER UPDATE: fix(generation): centralize connection admission and provider fallback #6373
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#6373
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/4423
Author: @Gunterlie
Created: 8/1/2026
Status: ❌ Closed
Base:
staging← Head:stack/1-admission📝 Commits (7)
5a4c047fix(generation): centralize connection admission and provider fallback7f5a6ccfix(generation): thread connection ids through admission call sites84f28a3fix(generation): release the admission slot when a stream is abandonedc5e88a6fix(generation): keep teardown failures from masking provider errors4499a53fix(generation): log primary stream teardown failures instead of dropping them8b8cb1ffix(generation): key image admission by endpoint and keep provider diagnostics concretef727e13fix(image): scope endpoint-keyed admission to RunPod backends📊 Changes
14 files changed (+451 additions, -25 deletions)
View changed files
📝
packages/server/src/routes/connections.routes.ts(+3 -0)📝
packages/server/src/routes/encounter.routes.ts(+3 -0)📝
packages/server/src/routes/generate/dry-run-route.ts(+1 -0)📝
packages/server/src/routes/lorebooks.routes.ts(+1 -0)📝
packages/server/src/services/capability-packages/capability-language-model.service.ts(+4 -1)➕
packages/server/src/services/generation/connection-admission.ts(+196 -0)📝
packages/server/src/services/image/image-generation.ts(+37 -2)📝
packages/server/src/services/llm/connection-fallback-provider.ts(+44 -21)📝
packages/server/src/services/llm/provider-registry.ts(+5 -1)📝
packages/server/src/services/memory-recall-embedding.ts(+1 -0)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+1 -0)📝
packages/server/src/services/spotify/dj-mari-playlist.service.ts(+1 -0)📝
packages/server/src/services/turn-games/turn-game-bot-runner.service.ts(+1 -0)📝
scripts/regressions/provider-compat.regression.ts(+153 -0)📄 Description
Why
NoodleR posts and images generate in the background, on the same API connection the user is actively chatting on. Without a gate, a scheduled creator post fires mid-roleplay and the user queues behind their own bot, or burns rate limit they wanted for themselves.
This adds a shared admission service so background work yields to foreground work: it is admitted only when nothing is running in the foreground on that connection and the last foreground request finished at least 30s ago. Foreground work never asks permission.
Admission failures are typed distinctly (
isConnectionAdmissionFailure) so the fallback chain can tell "connection busy" apart from "provider failed" — otherwise a busy connection would look like an outage and trigger a pointless failover to the backup model.Relationship to #4503
Standalone against
staging— not a stack. This PR is the connection-admissionwork only, and it stands on its own.
The rest of what was originally split across
stack/2-docsandstack/3-servernow lives in #4503 (NoodleR Slice 8f), which is also based on
stagingand isreviewed independently.
#4503's branch does contain this PR's commits, because the Slice 8f code is
built on the admission service. Merge this PR first — once it lands, these
changes drop out of #4503's diff and what remains there is the Slice 8f work.
Notes
statesis a module-level map keyed per connection id and per image base URL, and is never pruned. Bounded by configured connections, so not a leak that matters in practice, but it is an unmarked deliberate call.Test plan
pnpm checkpnpm regression:providersSummary by CodeRabbit
New Features
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.