mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #682] [MERGED] Fix nested SillyTavern random macro parsing #4726
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4726
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/682
Author: @Xelvanis
Created: 5/11/2026
Status: ✅ Merged
Merged: 5/11/2026
Merged by: @Xelvanis
Base:
main← Head:fix/sillytavern-random-macro📝 Commits (2)
4c5b089Fix nested random macro parsing0f2186fTighten macro random test helper📊 Changes
2 files changed (+186 additions, -29 deletions)
View changed files
➕
packages/server/test/macro-engine.test.ts(+60 -0)📝
packages/shared/src/utils/macro-engine.ts(+126 -29)📄 Description
Linked issue
No linked GitHub issue yet. The original report came from a Discord "Feature request/Possible bug report" screenshot about SillyTavern random macro parity.
This should stay draft until a GitHub issue is opened/linked or a maintainer confirms the Discord report is enough context.
Why this change
{{random::...}}were parsed incorrectly.{{random::None::{{random::Alice::Bob}} appears.::The world ends.}}could leak pieces of multiple unchosen branches into the assembled prompt instead of returning exactly one selected branch.What changed
{{...}}expressions.{{random::...}}choices only on top-level::separators, leaving nested macro arguments intact.setvar/addvarvalues.getvar, andsetvarvalues containing random choices.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/macro-engine.test.tspnpm checkBob appears.pnpm --filter @marinara-engine/server testopenai-provider-reasoning.test.ts:custom compatible GPT-5.5 endpoints route through Responses without Chat Completions streaming extras, expectingbody.max_output_tokensto equal512but receivingundefined. The same provider test failed when isolated.Docs and release impact
UI evidence (if applicable)
Not applicable; this is shared prompt macro parsing logic.
Summary by CodeRabbit
New Features
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.