[PR #2248] [MERGED] Fix agent injection review guards #5509

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-2171-agent-injection-review


📝 Commits (5)

  • a85e5f2 Fix agent injection review guards
  • 03ece21 Record agent review PR metadata
  • db5e0ae Keep generic proof ledger unchanged
  • d7ac277 Merge remote-tracking branch 'upstream/refactor' into fix/issue-2171-agent-injection-review
  • 78bca08 Refresh agent review PR state

📊 Changes

2 files changed (+182 additions, -4 deletions)

View changed files

📝 src/engine/generation/start-generation.test.ts (+156 -1)
📝 src/engine/generation/start-generation.ts (+26 -3)

📄 Description

Linked issue

Closes #2171

Why this change

  • Agent injection review lost legacy guards in the refactor path: non-reviewable knowledge/static injections could appear in the writer review event, regenerate/swipe turns could reopen the review pause, and non-roleplay modes could pause if the metadata flag and injections were present.

What changed

  • Restored the legacy-derived reviewable writer injection filter in startGeneration, based on built-in writer pre-generation agents while excluding knowledge retrieval/router.
  • Restored the regenerate skip and roleplay/visual_novel mode gate before emitting agent_injection_review.
  • Added focused regression coverage for the writer-positive path, knowledge/static filtering, regenerate skip, conversation skip, and visual_novel positive mode.

Refactor impact

Primary owner:

  • engine generation

Impact areas reviewed:

  • src/engine/generation/start-generation.ts
  • src/engine/generation/start-generation.test.ts

Boundary notes:

  • The fix stays in the React-free engine event contract. The runtime modal consumer continues receiving agent_injection_review, but now receives only reviewable writer injections.
  • No React feature, shared API, Rust, storage, import/export, schema, dependency, auth, or version files changed.

Pressure points touched:

  • Runtime generation event emission for agent injection review.

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 production fix with pnpm exec vitest run src/engine/generation/start-generation.test.ts --reporter=verbose: the focused regression rows failed because HTML/static injection was included in the review payload, regenerate still emitted agent_injection_review, and conversation mode still paused.
  • After the fix, Codex reran pnpm exec vitest run src/engine/generation/start-generation.test.ts --reporter=verbose; all 6 tests passed, including the 3 issue-2171 regression rows.
  • Codex ran pnpm check; it passed line endings, architecture, frontend/typecheck, Rust cargo check, docs, discovery metadata, launcher safety, and unused-code checks.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\issue2171-bugfix-verification.json; it passed locally.
  • Bunny review pass: pass for the current diff.
  • No human-only verification is required for the core claim; this is a non-UI engine event contract fix.

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 a bugfix for existing agent review behavior and does not add discoverable product 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 non-UI engine event contract fix; focused command proof is recorded in the validation notes and proof ledger.

🔄 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/2248 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2171-agent-injection-review` --- ### 📝 Commits (5) - [`a85e5f2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a85e5f2c5708639b3623415849004303b7f6f711) Fix agent injection review guards - [`03ece21`](https://github.com/Pasta-Devs/Marinara-Engine/commit/03ece21d9c4cead77f730db6250bb0413e8d804e) Record agent review PR metadata - [`db5e0ae`](https://github.com/Pasta-Devs/Marinara-Engine/commit/db5e0aed26284c8f13b4c0039ffa51941e580b1a) Keep generic proof ledger unchanged - [`d7ac277`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d7ac2772f792cbbb52cda2cb40f7080b2f80cff7) Merge remote-tracking branch 'upstream/refactor' into fix/issue-2171-agent-injection-review - [`78bca08`](https://github.com/Pasta-Devs/Marinara-Engine/commit/78bca085a702a28fe5a9992ba6c894970a5bacab) Refresh agent review PR state ### 📊 Changes **2 files changed** (+182 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/start-generation.test.ts` (+156 -1) 📝 `src/engine/generation/start-generation.ts` (+26 -3) </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 #2171 ## Why this change - Agent injection review lost legacy guards in the refactor path: non-reviewable knowledge/static injections could appear in the writer review event, regenerate/swipe turns could reopen the review pause, and non-roleplay modes could pause if the metadata flag and injections were present. ## What changed - Restored the legacy-derived reviewable writer injection filter in `startGeneration`, based on built-in writer pre-generation agents while excluding knowledge retrieval/router. - Restored the regenerate skip and roleplay/visual_novel mode gate before emitting `agent_injection_review`. - Added focused regression coverage for the writer-positive path, knowledge/static filtering, regenerate skip, conversation skip, and visual_novel positive mode. ## Refactor impact Primary owner: - engine generation Impact areas reviewed: - `src/engine/generation/start-generation.ts` - `src/engine/generation/start-generation.test.ts` Boundary notes: - The fix stays in the React-free engine event contract. The runtime modal consumer continues receiving `agent_injection_review`, but now receives only reviewable writer injections. - No React feature, shared API, Rust, storage, import/export, schema, dependency, auth, or version files changed. Pressure points touched: - Runtime generation event emission for agent injection review. ## 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 production fix with `pnpm exec vitest run src/engine/generation/start-generation.test.ts --reporter=verbose`: the focused regression rows failed because HTML/static injection was included in the review payload, regenerate still emitted `agent_injection_review`, and conversation mode still paused. - After the fix, Codex reran `pnpm exec vitest run src/engine/generation/start-generation.test.ts --reporter=verbose`; all 6 tests passed, including the 3 issue-2171 regression rows. - Codex ran `pnpm check`; it passed line endings, architecture, frontend/typecheck, Rust cargo check, docs, discovery metadata, launcher safety, and unused-code checks. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\issue2171-bugfix-verification.json`; it passed locally. - Bunny review pass: pass for the current diff. - No human-only verification is required for the core claim; this is a non-UI engine event contract fix. ## 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 a bugfix for existing agent review behavior and does not add discoverable product 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 non-UI engine event contract fix; focused command proof is recorded in the validation notes and proof ledger. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:56 +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#5509
No description provided.