[PR #3813] [MERGED] Add logical group macros and fix tracker retry persistence #6113

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

📋 Pull Request Information

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

Base: staging ← Head: agent/conditional-macro-logic


📝 Commits (2)

  • e91c014 Add logical conditional macros
  • 7f48675 Apply CodeRabbit macro review suggestions

📊 Changes

14 files changed (+541 additions, -71 deletions)

View changed files

📝 CHANGELOG.md (+5 -0)
📝 docs/prompts/conditional-prompts.md (+33 -1)
📝 docs/prompts/macros.md (+5 -0)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+2 -2)
📝 packages/client/src/components/ui/MacroTextarea.tsx (+3 -3)
📝 packages/client/src/lib/slash-commands.ts (+1 -1)
📝 packages/server/src/routes/generate.routes.ts (+2 -0)
📝 packages/server/src/routes/generate/dry-run-route.ts (+2 -0)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+51 -31)
📝 packages/server/src/services/prompt/assembler.ts (+3 -0)
📝 packages/server/src/services/prompt/macro-context.ts (+6 -0)
📝 packages/shared/src/utils/macro-engine.ts (+283 -33)
📝 scripts/regressions/prompt.regression.ts (+121 -0)
📝 scripts/regressions/roleplay-streaming.regression.ts (+24 -0)

📄 Description

Linked issue

Closes #3812

Why this change

  • Prompt authors need reusable character conditions that can combine OR/AND checks and refer to every other active character in a group.
  • Successful Roleplay tracker re-runs were discarded when a refreshed scene had no assistant-message anchor, despite the provider returning valid tracker data.
  • Installed Theme and Extension names in Settings > Addons inherited the pink primary accent instead of the user's selected chroma text color.

What changed

  • Added ||, &&, parentheses, and equality-list shorthand to conditional prompt macros.
  • Added {{group}}, preserving the full active character roster through targeted Roleplay generation and Peek Prompt assembly while excluding only the current responder.
  • Updated the in-app macro guidance, slash-command help, and prompt documentation.
  • Persisted World State, Character, Persona, Quest, and Custom tracker re-runs against the visible/latest tracker state when no assistant reply exists, creating a baseline snapshot only when necessary.
  • Applied the existing chroma text helper to installed Theme and Extension names.
  • Added prompt and Roleplay regression coverage for the affected integration boundaries.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • The maintainer tested the combined branch in Roleplay and confirmed the requested changes work.
  • The saved three-character manual Roleplay preset was assembled read-only with Pantalone targeted; {{group}} resolved to Powers That Be, Maukie, while the same-named active persona remained available separately through {{user}}.
  • Automated checks run: pnpm check, pnpm regression:prompt, pnpm regression:roleplay, pnpm smoke:ui (72 passed, 46 intentionally skipped), pnpm version:check, and git diff --check.
  • Docker/Podman validation was not run.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Prompt macro documentation and CHANGELOG.md are updated. This PR does not bump the application version.

UI evidence (if applicable)

No screenshot is attached. The Settings change reuses the existing mari-chrome-text token on two installed-item name labels and was manually confirmed on the combined branch.

Risk notes

Prompt assembly is the highest-risk path touched. Current and targeted/manual Roleplay paths are covered by regression checks and the saved-preset probe; Peek Prompt receives the same full-roster input. Existing identity macros remain unchanged.

Summary by CodeRabbit

  • New Features

    • Added {{group}} for listing other active chat characters.
    • Conditional prompt blocks now support ||, &&, parentheses, and equality-list shorthand.
    • Group-aware prompt generation is supported for targeted roleplay responses.
  • Bug Fixes

    • Fixed empty group values in targeted roleplay prompts.
    • Fixed theme colors for addon names in Settings.
    • Improved tracker persistence after roleplay retries without a new assistant reply.
  • Documentation

    • Updated macro and conditional prompt guides with syntax details and examples.

🔄 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/3813 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/19/2026 **Status:** ✅ Merged **Merged:** 7/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/conditional-macro-logic` --- ### 📝 Commits (2) - [`e91c014`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e91c014cd063a175ae670397ec2ca43b58d87826) Add logical conditional macros - [`7f48675`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7f4867585b1cac81322ebc8d29d54fb29c6715bb) Apply CodeRabbit macro review suggestions ### 📊 Changes **14 files changed** (+541 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+5 -0) 📝 `docs/prompts/conditional-prompts.md` (+33 -1) 📝 `docs/prompts/macros.md` (+5 -0) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+2 -2) 📝 `packages/client/src/components/ui/MacroTextarea.tsx` (+3 -3) 📝 `packages/client/src/lib/slash-commands.ts` (+1 -1) 📝 `packages/server/src/routes/generate.routes.ts` (+2 -0) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+2 -0) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+51 -31) 📝 `packages/server/src/services/prompt/assembler.ts` (+3 -0) 📝 `packages/server/src/services/prompt/macro-context.ts` (+6 -0) 📝 `packages/shared/src/utils/macro-engine.ts` (+283 -33) 📝 `scripts/regressions/prompt.regression.ts` (+121 -0) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+24 -0) </details> ### 📄 Description ## Linked issue Closes #3812 ## Why this change - Prompt authors need reusable character conditions that can combine OR/AND checks and refer to every other active character in a group. - Successful Roleplay tracker re-runs were discarded when a refreshed scene had no assistant-message anchor, despite the provider returning valid tracker data. - Installed Theme and Extension names in Settings > Addons inherited the pink primary accent instead of the user's selected chroma text color. ## What changed - Added `||`, `&&`, parentheses, and equality-list shorthand to conditional prompt macros. - Added `{{group}}`, preserving the full active character roster through targeted Roleplay generation and Peek Prompt assembly while excluding only the current responder. - Updated the in-app macro guidance, slash-command help, and prompt documentation. - Persisted World State, Character, Persona, Quest, and Custom tracker re-runs against the visible/latest tracker state when no assistant reply exists, creating a baseline snapshot only when necessary. - Applied the existing chroma text helper to installed Theme and Extension names. - Added prompt and Roleplay regression coverage for the affected integration boundaries. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - The maintainer tested the combined branch in Roleplay and confirmed the requested changes work. - The saved three-character manual Roleplay preset was assembled read-only with Pantalone targeted; `{{group}}` resolved to `Powers That Be, Maukie`, while the same-named active persona remained available separately through `{{user}}`. - Automated checks run: `pnpm check`, `pnpm regression:prompt`, `pnpm regression:roleplay`, `pnpm smoke:ui` (72 passed, 46 intentionally skipped), `pnpm version:check`, and `git diff --check`. - Docker/Podman validation was not run. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) Prompt macro documentation and `CHANGELOG.md` are updated. This PR does not bump the application version. ## UI evidence (if applicable) No screenshot is attached. The Settings change reuses the existing `mari-chrome-text` token on two installed-item name labels and was manually confirmed on the combined branch. ## Risk notes Prompt assembly is the highest-risk path touched. Current and targeted/manual Roleplay paths are covered by regression checks and the saved-preset probe; Peek Prompt receives the same full-roster input. Existing identity macros remain unchanged. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added `{{group}}` for listing other active chat characters. - Conditional prompt blocks now support `||`, `&&`, parentheses, and equality-list shorthand. - Group-aware prompt generation is supported for targeted roleplay responses. - **Bug Fixes** - Fixed empty group values in targeted roleplay prompts. - Fixed theme colors for addon names in Settings. - Improved tracker persistence after roleplay retries without a new assistant reply. - **Documentation** - Updated macro and conditional prompt guides with syntax details and examples. <!-- 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:07:12 +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#6113
No description provided.