mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5537] Agents on the local sidecar all fail with "invalid JSON" since JSON agents force reasoning off #3076
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#3076
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 (Aug 25, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5537
Originally assigned to: @kolacheee on GitHub.
From a user report (staging, auto-updating install, the pre-linked default Gemma local model): after moving their agents back onto the local sidecar, every agent fails with
The same model ran these agents fine days earlier. The user suspects their koboldcpp-and-back connection switching broke something, but the switching is almost certainly innocent — nothing from a koboldcpp leg can survive into a sidecar request (the agent editor rewrites the settings blob wholesale, and no model/template field carries over). What actually changed in that window is staging itself.
What changed
PR #5247 (
46e7edf47, merged Aug 19) makes every JSON-result agent sendreasoningEffort: "none"(packages/server/src/services/agents/agent-executor.ts:3251). For the local sidecar specifically, the provider translates that into two request-body fields that sidecar agent calls never carried before (packages/server/src/services/llm/providers/openai.provider.ts:866-867):reasoning_format: "none"tells llama.cpp to leave any thinking inline incontentinstead of splitting it intoreasoning_content. If the shipped Gemma template does not honorenable_thinking: false, every agent response now arrives as a thinking preamble glued in front of the JSON.The agent path has no structural defense against that: agents ask for JSON by prompt only — no
response_format, nojson_schema, no grammar anywhere in the agent executor (grep it: zero hits) — and then run fence/brace extraction overcontent. A thinking preamble poisons that extraction identically on the first call, on the strict-JSON retry (agent-executor.ts:870), and on the per-agent batch fallback (:1651), which is why the user sees every agent fail the same way at once.The irony is that #5247 was itself a Gemma JSON fix — its commit message documents Gemma-4 12B burning the whole completion budget on thinking and returning empty content. It fixed that failure mode for connections that honor the flags, and plausibly created this one for the sidecar.
There is also no escape hatch on this path: a connection can defeat the override via
enabledParameters.reasoningEffort === false(agent-executor.ts:3249), but the explicit-sidecar resolution pinsenabledParameters = { temperature: true }(packages/server/src/services/generation/agent-resolution.ts:363-375), so sidecar users cannot opt out.Confirming it
One debug log settles the mechanism. With
LOG_LEVEL=debugin.env, trigger any agent and read the raw response the executor logs (agent-executor.ts:855):<think>tags in front of the JSON → this regression;Either way the sidecar agent path is broken for the default model, only the fix differs.
Try it yourself
Fix directions
json_schemaresponse format for llama.cpp/sidecar connections inexecuteAgent/executeAgentBatch— the plumbing already exists and the game-scene generation path already uses it; the sidecar provider already handlesresponseFormat. This fixes the whole class regardless of what the template does with thinking.reasoning_format: "none"+enable_thinking: falseon the local sidecar when the loaded template is known to honor it — or strip inline<think>…</think>blocks before JSON extraction so the flags can't make things worse.<|"|>string-delimiter quirk is normalized in the textual tool-call parser (normalizeGemma4Delimiters) but never in the agent JSON extraction path — worth unifying while in there.@kolacheee commented on GitHub (Aug 25, 2026):
Implementation starting — owner: @kolacheee. Draft PR will follow shortly on a
staging-targeted branch.