[PR #1961] [MERGED] Fix Consistency Editor HTML preservation #5360

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1945-consistency-html


📝 Commits (1)

  • 3a7bf0a Fix consistency editor HTML prompt preservation

📊 Changes

3 files changed (+84 additions, -3 deletions)

View changed files

➕ src/engine/agents-runtime/executor/agent-executor.test.ts (+76 -0)
📝 src/engine/agents-runtime/executor/agent-executor.ts (+5 -1)
📝 src/engine/contracts/constants/agent-prompts.ts (+3 -2)

📄 Description

Linked issue

Closes #1945

Why this change

  • Consistency Editor received HTML-heavy assistant responses after the executor stripped HTML/XML tags for token compaction, so the editor could either make useful text edits while returning plain text or preserve visuals while declining meaningful edits.

What changed

  • Preserves the raw current mainResponse only for the Consistency Editor prompt so the editor can see the original HTML/CSS scaffolding inside <assistant_response>.
  • Tightens the default Consistency Editor prompt to treat HTML/CSS/visual markup as structure and edit only visible readable text where possible.
  • Adds a focused regression test with a fake provider that verifies HTML-heavy mainResponse markup reaches the editor prompt intact.

Refactor impact

Primary owner:

Engine generation / agent runtime

Impact areas reviewed:

  • Standard post-processing agent prompt assembly.
  • Consistency Editor default prompt contract.
  • Non-editor agent compaction path remains scoped to stripHtmlTags.

Boundary notes:

  • Engine-only change. No React feature code, shared API wrapper, Tauri command, storage, provider, schema, or dependency changes.

Pressure points touched:

  • Agent executor prompt assembly for context.mainResponse.

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 verification:
  • git grep -n "stripHtmlTags(context.mainResponse)" upstream/refactor -- src/engine/agents-runtime/executor/agent-executor.ts showed the pre-fix prompt flattened the editor's current response.
  • pnpm test src/engine/agents-runtime/executor/agent-executor.test.ts passed: 1 test file, 1 test.
  • pnpm typecheck passed.
  • pnpm check passed: line endings, architecture, frontend typecheck, Rust cargo check, docs, discovery metadata, and unused-code checks.
  • Bunny review passed on the focused diff.
  • Proof gate passed for scratch/bugfix-verification.json.
  • Manual limitation: this proves the editor input/prompt contract and scoped compaction behavior; individual provider quality for subjective "useful edits" can still vary by model.

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:

  • Bugfix to existing Consistency Editor behavior; no new discoverable feature.

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 an engine prompt-contract fix, verified with a focused fake-provider regression and full repo checks rather than a visible UI surface.


🔄 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/1961 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1945-consistency-html` --- ### 📝 Commits (1) - [`3a7bf0a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3a7bf0a296e5ffd9a6a181ed39e0fdce1332cc12) Fix consistency editor HTML prompt preservation ### 📊 Changes **3 files changed** (+84 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `src/engine/agents-runtime/executor/agent-executor.test.ts` (+76 -0) 📝 `src/engine/agents-runtime/executor/agent-executor.ts` (+5 -1) 📝 `src/engine/contracts/constants/agent-prompts.ts` (+3 -2) </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 <!-- Every user-facing PR should reference a feature request or issue report when practical. --> Closes #1945 ## Why this change <!-- What user problem, bug, refactor goal, or maintenance need does this solve? --> - Consistency Editor received HTML-heavy assistant responses after the executor stripped HTML/XML tags for token compaction, so the editor could either make useful text edits while returning plain text or preserve visuals while declining meaningful edits. ## What changed <!-- List the key changes in this PR. --> - Preserves the raw current `mainResponse` only for the Consistency Editor prompt so the editor can see the original HTML/CSS scaffolding inside `<assistant_response>`. - Tightens the default Consistency Editor prompt to treat HTML/CSS/visual markup as structure and edit only visible readable text where possible. - Adds a focused regression test with a fake provider that verifies HTML-heavy `mainResponse` markup reaches the editor prompt intact. ## Refactor impact Primary owner: <!-- Examples: app shell, catalog, chat mode, roleplay mode, game mode, runtime generation, world-state, shared API, engine generation, Rust storage, imports, remote runtime. --> Engine generation / agent runtime Impact areas reviewed: - Standard post-processing agent prompt assembly. - Consistency Editor default prompt contract. - Non-editor agent compaction path remains scoped to `stripHtmlTags`. Boundary notes: <!-- Note engine/shared-api/feature/Rust/remote-runtime boundaries. Say "none" only if you checked. --> - Engine-only change. No React feature code, shared API wrapper, Tauri command, storage, provider, schema, or dependency changes. Pressure points touched: <!-- Mention ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules if touched. --> - Agent executor prompt assembly for `context.mainResponse`. ## 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 <!-- Describe exact commands and manual steps, including typecheck/build/docs/architecture/Rust/browser/remote-runtime checks when they apply. If an AI agent filled this out, verify it yourself before ticking boxes. --> - Codex verification: - `git grep -n "stripHtmlTags(context.mainResponse)" upstream/refactor -- src/engine/agents-runtime/executor/agent-executor.ts` showed the pre-fix prompt flattened the editor's current response. - `pnpm test src/engine/agents-runtime/executor/agent-executor.test.ts` passed: 1 test file, 1 test. - `pnpm typecheck` passed. - `pnpm check` passed: line endings, architecture, frontend typecheck, Rust cargo check, docs, discovery metadata, and unused-code checks. - Bunny review passed on the focused diff. - Proof gate passed for `scratch/bugfix-verification.json`. - Manual limitation: this proves the editor input/prompt contract and scoped compaction behavior; individual provider quality for subjective "useful edits" can still vary by model. ## 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: - Bugfix to existing Consistency Editor behavior; no new discoverable feature. ## 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 <!-- Add before/after screenshots or recordings for visible UI changes. --> N/A. This is an engine prompt-contract fix, verified with a focused fake-provider regression and full repo checks rather than a visible UI surface. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:15:34 +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#5360
No description provided.