[PR #2336] [MERGED] Fix agent JSON repair ellipsis handling #5538

Closed
opened 2026-10-22 04:17:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2336
Author: @cha1latte
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2168-json-repair-ellipsis


📝 Commits (1)

  • 6805777 Fix agent JSON repair ellipsis handling

📊 Changes

2 files changed (+13 additions, -5 deletions)

View changed files

📝 src/engine/agents-runtime/executor/agent-executor.test.ts (+13 -4)
📝 src/engine/agents-runtime/executor/agent-executor.ts (+0 -1)

📄 Description

Linked issue

Closes #2168

Why this change

  • Agent JSON repair should remove inline ... placeholders without deleting valid same-line JSON fields that follow them.
  • The refactor was skipping from ... through the end of the line, so recoverable agent JSON like {"a":1, ... "b":2} stayed broken after repair.

What changed

  • Updated the agent JSON repair ellipsis pass to skip only the three-dot placeholder outside JSON strings.
  • Added an executeAgent regression test covering inline placeholder recovery and preserving literal ellipses inside string values.

Refactor impact

Primary owner:

  • engine generation

Impact areas reviewed:

  • src/engine/agents-runtime/executor/agent-executor.ts
  • src/engine/agents-runtime/executor/agent-executor.test.ts

Boundary notes:

  • Engine-only change; no React, shared API, remote runtime, storage, or Tauri boundary changes.

Pressure points touched:

  • Agent JSON response repair fallback after the initial JSON.parse fails.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • Codex reproduced the bug before the fix with pnpm exec vitest run src\engine\agents-runtime\executor\agent-executor.test.ts; the new regression failed because inline ellipsis JSON produced result.success === false.
  • Codex re-ran the same targeted command after the fix; it passed with 2 tests.
  • Codex ran pnpm typecheck; it passed.
  • Codex ran full pnpm check; it passed.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json; it passed.
  • Bunny review pass: passed before opening the PR.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • This is an internal engine compatibility bugfix for agent JSON repair behavior.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

N/A. This is a React-free engine parsing bug with command-based proof.

Summary by CodeRabbit

Bug Fixes

  • Fixed JSON parsing to correctly handle ellipsis placeholders without dropping subsequent data fields
  • Improved JSON comment removal logic for more accurate recovery during parsing

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2336 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2168-json-repair-ellipsis` --- ### 📝 Commits (1) - [`6805777`](https://github.com/Pasta-Devs/Marinara-Engine/commit/68057773f6ab80eaf825e86c16764b8a3595de1f) Fix agent JSON repair ellipsis handling ### 📊 Changes **2 files changed** (+13 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/agents-runtime/executor/agent-executor.test.ts` (+13 -4) 📝 `src/engine/agents-runtime/executor/agent-executor.ts` (+0 -1) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #2168 ## Why this change - Agent JSON repair should remove inline `...` placeholders without deleting valid same-line JSON fields that follow them. - The refactor was skipping from `...` through the end of the line, so recoverable agent JSON like `{"a":1, ... "b":2}` stayed broken after repair. ## What changed - Updated the agent JSON repair ellipsis pass to skip only the three-dot placeholder outside JSON strings. - Added an `executeAgent` regression test covering inline placeholder recovery and preserving literal ellipses inside string values. ## Refactor impact Primary owner: - engine generation Impact areas reviewed: - `src/engine/agents-runtime/executor/agent-executor.ts` - `src/engine/agents-runtime/executor/agent-executor.test.ts` Boundary notes: - Engine-only change; no React, shared API, remote runtime, storage, or Tauri boundary changes. Pressure points touched: - Agent JSON response repair fallback after the initial `JSON.parse` fails. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - Codex reproduced the bug before the fix with `pnpm exec vitest run src\engine\agents-runtime\executor\agent-executor.test.ts`; the new regression failed because inline ellipsis JSON produced `result.success === false`. - Codex re-ran the same targeted command after the fix; it passed with 2 tests. - Codex ran `pnpm typecheck`; it passed. - Codex ran full `pnpm check`; it passed. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json`; it passed. - Bunny review pass: passed before opening the PR. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [ ] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - This is an internal engine compatibility bugfix for agent JSON repair behavior. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence N/A. This is a React-free engine parsing bug with command-based proof. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Bug Fixes * Fixed JSON parsing to correctly handle ellipsis placeholders without dropping subsequent data fields * Improved JSON comment removal logic for more accurate recovery during parsing <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:10 +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#5538
No description provided.