mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2479] [Issue]: Batch agent result parser truncates content at a literal </result substring #1221
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#1221
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/2479
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Low — correctness. The batched-agent result-block parser closes each agent's segment at the last bare
</resultsubstring (lastIndexOf("</result")), so an agent whose content legitimately contains that token gets truncated, marking it failed and forcing a redundant individual retry.Expected behavior
Match the closing tag with a strict pattern (e.g.
/<\/result\s*>/i) and prefer the first balanced close after the content start, so agent content that merely mentions</resultis not truncated.Actual behavior
The open-tag side (
:923) is strict, but the close side matches the bare prefix</result. Any agent content containing that literal substring (HTML agent output,</resultset>, JSON/prose mentioning it) truncates the block;lastIndexOfalso picks the last occurrence, so a stray late</resultdrops everything before it. The affected agent then falls into the individual-retry path, so it self-heals at the cost of an extra LLM call.Steps to reproduce
</result(e.g. an HTML-emitting agent, or prose discussing the tag).Impact area
Environment
1fae2c42Logs, screenshots, or video
Static trace:
agent-executor.ts:937(lastIndexOf("</result")), open-tag pattern at:923.Regression notes
Not a regression — main uses a strict close pattern too, and in the well-formed common case both implementations agree; the divergent degenerate case (missing real close) also fails under main's patterns. Filing as a refactor
bug(robustness hardening). Self-heals via retry, hence Low.Additional context
Fix: replace the bare-prefix
lastIndexOf("</result")with a strict/<\/result\s*>/imatch, preferring the first balanced close after the content start.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.Batch agent result parsing now only treats a strict closing tag as the result terminator, preserving literal </result text in generated content.
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.