[PR #1962] [MERGED] Fix Immersive HTML prompt injection #5362

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1947-immersive-html


📝 Commits (2)

  • ea9f6ee Fix Immersive HTML prompt injection
  • a65e788 Fix Immersive HTML lint regression

📊 Changes

3 files changed (+196 additions, -8 deletions)

View changed files

📝 src/engine/generation/agent-runner.ts (+45 -8)
➕ src/engine/generation/immersive-html-agent.test.ts (+112 -0)
📝 src/engine/generation/prompt-assembly.ts (+39 -0)

📄 Description

Linked issue

Closes #1947

Why this change

  • Immersive HTML could appear enabled while failing to affect generation when its directive never reached the main prompt.

What changed

  • Treat the built-in html agent as a static pre-generation context injection, so it does not require or spend an agent LLM call.
  • Preserve static/override injections in preInjections and agentData for prompt assembly and the Injections panel.
  • Add a prompt-assembly fallback that inserts agent instructions when the selected preset has no matching agent_data marker.
  • Add regression coverage for zero-call Immersive HTML injection and prompt fallback insertion.

Refactor impact

Primary owner:

engine generation

Impact areas reviewed:

  • Agent runtime resolution and pre-generation injection merging.
  • Prompt assembly behavior for presets with and without agent_data markers.
  • Default roleplay prompt path with no explicit agent marker.

Boundary notes:

  • Engine-only change; no React UI, shared API, Rust command, storage schema, dependency, or remote-runtime boundary changes.

Pressure points touched:

  • src/engine/generation/agent-runner.ts
  • src/engine/generation/prompt-assembly.ts

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 ran pnpm test src/engine/generation/immersive-html-agent.test.ts and it passed.
  • Codex ran pnpm typecheck and it passed.
  • Codex ran full pnpm check after the final diff and it passed.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json and it passed.
  • Bunny review pass completed locally for the current diff.
  • No manual verification needed for the core claim; this is engine prompt wiring with focused command proof.

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 for an existing agent; no new user-discoverable feature or workflow.

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 engine prompt wiring; proof is the focused regression command and full repo validation above.


🔄 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/1962 **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-1947-immersive-html` --- ### 📝 Commits (2) - [`ea9f6ee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ea9f6eec6229bdc9b9b8dd2f389f19c172bbf303) Fix Immersive HTML prompt injection - [`a65e788`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a65e78855c001755c90835794ba277bd5f50f0a7) Fix Immersive HTML lint regression ### 📊 Changes **3 files changed** (+196 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/agent-runner.ts` (+45 -8) ➕ `src/engine/generation/immersive-html-agent.test.ts` (+112 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+39 -0) </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 #1947 ## Why this change <!-- What user problem, bug, refactor goal, or maintenance need does this solve? --> - Immersive HTML could appear enabled while failing to affect generation when its directive never reached the main prompt. ## What changed <!-- List the key changes in this PR. --> - Treat the built-in `html` agent as a static pre-generation context injection, so it does not require or spend an agent LLM call. - Preserve static/override injections in `preInjections` and `agentData` for prompt assembly and the Injections panel. - Add a prompt-assembly fallback that inserts agent instructions when the selected preset has no matching `agent_data` marker. - Add regression coverage for zero-call Immersive HTML injection and prompt fallback insertion. ## 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 Impact areas reviewed: - Agent runtime resolution and pre-generation injection merging. - Prompt assembly behavior for presets with and without `agent_data` markers. - Default roleplay prompt path with no explicit agent marker. Boundary notes: <!-- Note engine/shared-api/feature/Rust/remote-runtime boundaries. Say "none" only if you checked. --> - Engine-only change; no React UI, shared API, Rust command, storage schema, dependency, or remote-runtime boundary changes. Pressure points touched: <!-- Mention ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules if touched. --> - `src/engine/generation/agent-runner.ts` - `src/engine/generation/prompt-assembly.ts` ## 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 ran `pnpm test src/engine/generation/immersive-html-agent.test.ts` and it passed. - Codex ran `pnpm typecheck` and it passed. - Codex ran full `pnpm check` after the final diff and it passed. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` and it passed. - Bunny review pass completed locally for the current diff. - No manual verification needed for the core claim; this is engine prompt wiring with focused command proof. ## 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 for an existing agent; no new user-discoverable feature or workflow. ## 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 engine prompt wiring; proof is the focused regression command and full repo validation above. --- <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:36 +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#5362
No description provided.