[PR #4307] [MERGED] fix: trim card names, scope agent context, and render Markdown #6328

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4307
Author: @SpicyMarinara
Created: 7/30/2026
Status: ✅ Merged
Merged: 7/30/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/4303-4306-issue-sweep


📝 Commits (4)

  • 0822934 chore: start open issue sweep
  • 5b45bea fix: address July 30 issue sweep
  • 7dc15cf fix: address CodeRabbit review
  • 95fccca fix: tighten agent context boundaries

📊 Changes

20 files changed (+1016 additions, -191 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 e2e/core-flows.e2e.ts (+41 -0)
📝 packages/client/src/components/agents/AgentEditor.tsx (+103 -0)
📝 packages/client/src/components/characters/CharacterEditor.tsx (+21 -15)
📝 packages/client/src/components/characters/CharacterLibraryView.tsx (+12 -12)
📝 packages/client/src/components/lorebooks/LorebookEntryRow.tsx (+98 -32)
📝 packages/client/src/components/lorebooks/LorebookFormFields.tsx (+5 -5)
📝 packages/client/src/components/personas/PersonaEditor.tsx (+6 -8)
📝 packages/client/src/components/ui/MacroTextarea.tsx (+90 -28)
📝 packages/client/src/localization/locales/en.json (+21 -0)
📝 packages/server/src/routes/generate.routes.ts (+8 -2)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+14 -0)
📝 packages/server/src/services/agents/agent-executor.ts (+119 -30)
📝 packages/server/src/services/generation/agent-resolution.ts (+2 -0)
📝 packages/server/src/services/storage/characters.storage.ts (+19 -8)
📝 packages/shared/src/schemas/character.schema.ts (+1 -1)
📝 packages/shared/src/types/agent.ts (+43 -0)
📝 scripts/regressions/open-issues.regression.ts (+85 -3)
📝 scripts/regressions/prompt.regression.ts (+222 -45)
📝 scripts/regressions/regeneration-context.regression.ts (+102 -2)

📄 Description

Linked issues

Closes #4303
Closes #4304
Closes #4305
Closes #4306

Why this change

The latest issue sweep found four user-visible gaps: pasted Character names retain accidental edge whitespace, edited chat text needs durable Memory Recall protection, custom agents receive context they do not need, and card/lorebook fields have no rendered Markdown view. Each correction stays within the existing subsystem without introducing a parallel framework.

What changes

  • Trim Character names on editor blur, schema validation, persistence, restore, reset, and duplication boundaries.
  • Protect edited-message Memory Recall behavior with an end-to-end regression proving stale native chunks are removed and rebuilt only from the saved edit.
  • Add per-custom-agent selectors for chat history, Character, Persona, activated lorebook, summary, Author's Notes, tracker, and recalled-memory context. Shared calls use the union requested by their participating agents.
  • Stop unrelated background and tracker context from leaking into custom-agent requests.
  • Add source/preview Markdown toggles to Character, Persona, and lorebook fields, and render formatted card text in library detail views through the existing safe renderer.

Validation

  • Run pnpm check
  • Run relevant regression checks
  • Manually verify affected browser paths
  • Read and follow CONTRIBUTING.md

Automated evidence run locally:

  • pnpm check passed.
  • Prompt regression passed, including individual custom-agent filtering and batched context unions.
  • Regeneration-context regression passed, including edited-message invalidation and rebuild.
  • Focused desktop browser proof for Markdown source/preview passed.
  • The full UI smoke matrix completed with 152 passes and 87 expected skips; 13 unrelated existing accent/theme and background-library cases failed. None overlap files or behavior changed here.

Manual verification needed

  • Manually verify pasted Character names lose leading and trailing whitespace after leaving the field and after save/import.
  • Manually verify edited messages are the only native message version injected by Memory Recall.
  • Manually verify each custom-agent context toggle independently and in a combined agent call.
  • Manually verify Markdown source/preview controls for Character, Persona, and lorebook fields on desktop and mobile.

Summary by CodeRabbit

  • New Features
    • Custom agents can configure which context sources they use (including per-source enablement in the editor).
    • Markdown preview and formatted rendering are now available across more character/persona/lorebook and library views (textarea preview UI).
    • Agent generation can include selected author notes and activated lorebook entry content.
  • Bug Fixes
    • Character names are trimmed of leading/trailing whitespace when saved, imported, and persisted across versions.
    • Memory Recall now injects only the currently edited message revision.
  • Tests
    • Added E2E and expanded regression coverage for Markdown preview integrity, context-source selection semantics, name normalization, and edited-message regeneration.

🔄 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/4307 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/30/2026 **Status:** ✅ Merged **Merged:** 7/30/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/4303-4306-issue-sweep` --- ### 📝 Commits (4) - [`0822934`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0822934ee18aff574f63301462c7a67c8b0e3d3c) chore: start open issue sweep - [`5b45bea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5b45beae93c5c6a7d1ad263f566524c5ceba260d) fix: address July 30 issue sweep - [`7dc15cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7dc15cff4e2e6199f0b9a82c80aa034cb1ab287a) fix: address CodeRabbit review - [`95fccca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/95fccca7d50a62c0a867160c8832aaa88c90b74d) fix: tighten agent context boundaries ### 📊 Changes **20 files changed** (+1016 additions, -191 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `e2e/core-flows.e2e.ts` (+41 -0) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+103 -0) 📝 `packages/client/src/components/characters/CharacterEditor.tsx` (+21 -15) 📝 `packages/client/src/components/characters/CharacterLibraryView.tsx` (+12 -12) 📝 `packages/client/src/components/lorebooks/LorebookEntryRow.tsx` (+98 -32) 📝 `packages/client/src/components/lorebooks/LorebookFormFields.tsx` (+5 -5) 📝 `packages/client/src/components/personas/PersonaEditor.tsx` (+6 -8) 📝 `packages/client/src/components/ui/MacroTextarea.tsx` (+90 -28) 📝 `packages/client/src/localization/locales/en.json` (+21 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+8 -2) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+14 -0) 📝 `packages/server/src/services/agents/agent-executor.ts` (+119 -30) 📝 `packages/server/src/services/generation/agent-resolution.ts` (+2 -0) 📝 `packages/server/src/services/storage/characters.storage.ts` (+19 -8) 📝 `packages/shared/src/schemas/character.schema.ts` (+1 -1) 📝 `packages/shared/src/types/agent.ts` (+43 -0) 📝 `scripts/regressions/open-issues.regression.ts` (+85 -3) 📝 `scripts/regressions/prompt.regression.ts` (+222 -45) 📝 `scripts/regressions/regeneration-context.regression.ts` (+102 -2) </details> ### 📄 Description ## Linked issues Closes #4303 Closes #4304 Closes #4305 Closes #4306 ## Why this change The latest issue sweep found four user-visible gaps: pasted Character names retain accidental edge whitespace, edited chat text needs durable Memory Recall protection, custom agents receive context they do not need, and card/lorebook fields have no rendered Markdown view. Each correction stays within the existing subsystem without introducing a parallel framework. ## What changes - Trim Character names on editor blur, schema validation, persistence, restore, reset, and duplication boundaries. - Protect edited-message Memory Recall behavior with an end-to-end regression proving stale native chunks are removed and rebuilt only from the saved edit. - Add per-custom-agent selectors for chat history, Character, Persona, activated lorebook, summary, Author's Notes, tracker, and recalled-memory context. Shared calls use the union requested by their participating agents. - Stop unrelated background and tracker context from leaking into custom-agent requests. - Add source/preview Markdown toggles to Character, Persona, and lorebook fields, and render formatted card text in library detail views through the existing safe renderer. ## Validation - [ ] Run pnpm check - [ ] Run relevant regression checks - [ ] Manually verify affected browser paths - [ ] Read and follow CONTRIBUTING.md Automated evidence run locally: - pnpm check passed. - Prompt regression passed, including individual custom-agent filtering and batched context unions. - Regeneration-context regression passed, including edited-message invalidation and rebuild. - Focused desktop browser proof for Markdown source/preview passed. - The full UI smoke matrix completed with 152 passes and 87 expected skips; 13 unrelated existing accent/theme and background-library cases failed. None overlap files or behavior changed here. ## Manual verification needed - Manually verify pasted Character names lose leading and trailing whitespace after leaving the field and after save/import. - Manually verify edited messages are the only native message version injected by Memory Recall. - Manually verify each custom-agent context toggle independently and in a combined agent call. - Manually verify Markdown source/preview controls for Character, Persona, and lorebook fields on desktop and mobile. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Custom agents can configure which context sources they use (including per-source enablement in the editor). * Markdown preview and formatted rendering are now available across more character/persona/lorebook and library views (textarea preview UI). * Agent generation can include selected author notes and activated lorebook entry content. * **Bug Fixes** * Character names are trimmed of leading/trailing whitespace when saved, imported, and persisted across versions. * Memory Recall now injects only the currently edited message revision. * **Tests** * Added E2E and expanded regression coverage for Markdown preview integrity, context-source selection semantics, name normalization, and edited-message regeneration. <!-- 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-23 04:09:22 +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#6328
No description provided.