mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2466] [Issue]: Setting a connection as default does not clear the previous default (multiple isDefault connections) #1210
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#1210
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 @Romuromylus on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2466
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Medium — correctness regression. Marking a connection as the global default (
isDefault) never clears the previous default, so multiple connections end up withisDefault: trueand the no-connection fallback resolves to whichever sorts first — not the one the user just picked.Expected behavior
isDefaultis a singleton: setting a new default should unsetisDefaulton every other connection, so exactly one connection is the fallback. Main enforces this on both create and update.Actual behavior
storage_createandstorage_updatefor connections call onlyclear_other_default_agent_connections, which de-duplicatesdefaultForAgents(a per-agent-category flag) — it never touches the generalisDefault:isDefaultis the fallback used whenever a request supplies noconnectionId:resolve_llm_connection_for_request(llm.rs) returns the firstisDefaultmatch in storage order, and many frontend services do the same first-match-wins pick (generation/context.ts,scene-service.ts,use-chats.ts,combat-init,schedule.service,auto-summary,use-magic-rewrite,encounter-service). With twoisDefault:truerows the resolution is order-dependent, so background/auto operations can silently use the stale connection (wrong provider/model/key).Steps to reproduce
isDefault → true).isDefault: true; the no-connectionIdfallback resolves to whichever sorts first (A), not B.Impact area
Environment
1fae2c42Logs, screenshots, or video
Static trace:
entities.rs:716-721(create),:772-779(update),clear_other_default_agent_connections:1356-1392(onlydefaultForAgents), fallback resolverllm.rsresolve_llm_connection_for_request.Regression notes
Regression vs main.
packages/server/src/services/storage/connections.storage.ts(create ~48-49, update ~113-117) runsdb.update(apiConnections).set({ isDefault: "false" })before setting the new default. The refactor dropped that singleton enforcement forisDefault(it kept it fordefaultForAgents).Additional context
Fix (fix-pattern-already-in-repo): add a
clear_other_default_connectionshelper mirroringclear_other_default_agent_connectionsbut patchingisDefault: falseon every other connection, invoked from the create/update branches when the saved connection has truthyisDefault. The prompt-preset singleton path already follows this pattern inprompts.rs.Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 6, 2026):
Fixed on refactor in
038b7220.Setting a connection as default now clears isDefault/default on the other connections before saving the new default.
Verification: pnpm typecheck; pnpm build; pnpm check:architecture; cargo check --manifest-path src-tauri/Cargo.toml --workspace; focused Rust backup/profile tests; git diff --check; no .test.ts/.test.tsx files present.