[GH-ISSUE #2168] [Issue]: Agent JSON-repair ellipsis stripping deletes to end-of-line, breaking recoverable inline-ellipsis JSON #1078

Closed
opened 2026-10-21 05:26:24 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2168

Originally assigned to: @cha1latte on GitHub.

Summary

In the LLM-JSON repair fallback, the legacy app removed only the three dots of a ... placeholder. The refactor advances past the dots and then consumes everything up to the next newline, so when an LLM emits an inline ellipsis on a line that also carries real JSON, the trailing valid JSON is discarded and the response no longer parses.

Expected behavior

Stripping a ... placeholder removes just the placeholder, leaving surrounding JSON intact. Verified on {"a":1, ... "b":2} -> legacy yields {"a":1, "b":2} (valid).

Actual behavior

The refactor deletes from ... to end-of-line: {"a":1, ... "b":2} -> {"a":1, (invalid). A JSON agent whose response contained an inline ... mid-line is recovered in legacy but fails to parse in the refactor (makeError for single agents, or an extra individual-retry round for batched agents).

Steps to reproduce

  1. Trigger the JSON-repair fallback (reached after JSON.parse already failed) with a response containing an inline ellipsis sharing a line with valid trailing JSON.
  2. The repaired string is truncated at the ellipsis and fails to parse.

Impact area

  • React-free engine behavior, contracts, agents, or capability ports

Environment

  • Branch or commit: refactor @ 93555d4b
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: n/a (static parity audit, main vs refactor)
  • Rust version, if relevant: n/a
  • Remote Runtime URL configured? not relevant

Regression notes

Worked in legacy (main @ c49f1d95). main: packages/server/src/services/agents/agent-executor.ts:1495-1498 (stripJsonRepairTokens; index += 2; continue;). refactor @ 93555d4b: src/engine/agents-runtime/executor/agent-executor.ts:1806-1830 (removeEllipsesOutsideJsonStrings adds a while-to-EOL loop). Narrow: only the repair-after-parse-failure fallback, and only inline (same-line) ellipses.

Originally created by @Romuromylus on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2168 Originally assigned to: @cha1latte on GitHub. ## Summary In the LLM-JSON repair fallback, the legacy app removed only the three dots of a `...` placeholder. The refactor advances past the dots and then consumes everything up to the next newline, so when an LLM emits an inline ellipsis on a line that also carries real JSON, the trailing valid JSON is discarded and the response no longer parses. ## Expected behavior Stripping a `...` placeholder removes just the placeholder, leaving surrounding JSON intact. Verified on `{"a":1, ... "b":2}` -> legacy yields `{"a":1, "b":2}` (valid). ## Actual behavior The refactor deletes from `...` to end-of-line: `{"a":1, ... "b":2}` -> `{"a":1, ` (invalid). A JSON agent whose response contained an inline `... ` mid-line is recovered in legacy but fails to parse in the refactor (makeError for single agents, or an extra individual-retry round for batched agents). ## Steps to reproduce 1. Trigger the JSON-repair fallback (reached after `JSON.parse` already failed) with a response containing an inline ellipsis sharing a line with valid trailing JSON. 2. The repaired string is truncated at the ellipsis and fails to parse. ## Impact area - [x] React-free engine behavior, contracts, agents, or capability ports ## Environment - Branch or commit: refactor @ 93555d4b - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: n/a (static parity audit, main vs refactor) - Rust version, if relevant: n/a - Remote Runtime URL configured? not relevant ## Regression notes Worked in legacy (main @ c49f1d95). main: `packages/server/src/services/agents/agent-executor.ts:1495-1498` (stripJsonRepairTokens; `index += 2; continue;`). refactor @ 93555d4b: `src/engine/agents-runtime/executor/agent-executor.ts:1806-1830` (removeEllipsesOutsideJsonStrings adds a while-to-EOL loop). Narrow: only the repair-after-parse-failure fallback, and only inline (same-line) ellipses.
bsakaguchi 2026-10-21 05:26:24 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1078
No description provided.