mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2983] [Issue]: Agents pinned to "Local Model" silently fall back to the paid default connection when the sidecar is unavailable #1557
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#1557
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 @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2983
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
When you explicitly set an agent's connection to "Local Model (sidecar)" and the local sidecar is unavailable, the agent does not get skipped as documented. If a default agent connection is configured (the common, recommended setup), the agent is silently routed to that default connection instead. If that default is a paid API provider, you get billed for an agent you pinned to local to avoid cost, and chat/prompt data you wanted kept on-device is sent to the cloud. Only the generic "default agent connection active" warning fires; the specific Local-Model skip warning never appears. This directly contradicts the v2.0 contract in CHANGELOG.md line 509: "Agents explicitly set to Local Model are skipped with a visible warning when the sidecar is unavailable instead of silently falling back to a paid API connection."
How to reproduce (try it yourself)
You'll see: the agent runs on the paid default connection, prompt/chat data is sent to that cloud provider, and only the generic
default_agent_connection_activewarning appears.Expected: the agent is skipped with the
local_sidecar_unavailablewarning, exactly as the CHANGELOG states.Where it is
packages/server/src/routes/generate/agent-connection-guards.ts:17-27, functionresolveAgentConnectionId— the buggy fallback is at line 23 (return args.defaultAgentConnectionId ?? "skip-local-sidecar";). Consumed atpackages/server/src/services/generation/agent-resolution.ts:298-312(theeffectiveConnectionId === "skip-local-sidecar"skip branch is bypassed) and shared on the retry path atpackages/server/src/routes/generate/retry-agents-route.ts:1101-1114.What's happening
In the sidecar-unavailable branch,
resolveAgentConnectionIdprefersdefaultAgentConnectionIdover theskip-local-sidecarsentinel. So it only returns the skip sentinel when no default agent connection exists. With a default configured, it returns that default connection's id, the skip branch at agent-resolution.ts:304 is never reached, and the agent runs on the (potentially paid) default provider. The intended contract is to ALWAYS skip when an agent explicitly requested Local Model and the sidecar is unavailable, regardless of whether a default exists.Suggested fix
Make the sidecar-unavailable branch always skip instead of falling back. In
agent-connection-guards.ts, change the body of the existingifblock so it returns the sentinel unconditionally:No call-site changes are needed — both consumers (agent-resolution.ts:304, retry-agents-route.ts:1107) already handle the sentinel identically (push to skipped list, warn, continue). Verified non-regressive: non-sidecar agents and the sidecar-available happy path never enter this branch;
defaultAgentConn.idcan never equal the synthetic LOCAL_SIDECAR_CONNECTION_ID, so the removed fallback was always to a real stored connection. The only behavior change is the exact buggy case (sidecar-pinned + unavailable + default exists) now skips correctly.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in merged staging PR #3004.