mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1896] Agent JSON repair corrupts valid strings containing comment-like text #920
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#920
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 @Xelvanis on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1896
Originally assigned to: @SpicyMarinara on GitHub.
Summary
src/engine/agents-runtime/executor/agent-executor.tsrepairs JSON by stripping//and block comments before first attemptingJSON.parse. That can corrupt valid JSON string values that contain//, such as URLs or literal text.Evidence
Refactor behavior:
repairJsonremoves//[^\n]*before parsing.{"url":"https://example.com/a","text":"keep // inside"}is transformed into invalid/truncated text before parse.Legacy behavior:
JSON.parsefirst.//text were preserved.Scratch repro from the parity pass:
Result: refactor repair path fails; legacy parse-first path succeeds.
Impact
Agents that return valid JSON containing URLs, markdown-ish text, comments as literal text, or other
//string values can fail parsing or lose data. This can break structured agent outputs even when the model produced valid JSON.Expected
Valid JSON should be parsed as-is before repair. Repair should only run after parse failure, and repair logic should avoid modifying content inside JSON strings.
Candidate Fix
Restore the legacy parse-first guard and use string-aware repair for fallback cleanup.
@SpicyMarinara commented on GitHub (Jun 2, 2026):
Fixed on refactor in
a4ba3c90: agent JSON extraction now parses valid JSON before repair, and fallback cleanup is string-aware so URLs and literal comment-like text inside strings are preserved. Verification passed: typecheck, architecture, docs, build, cargo check, diff check.