[PR #6586] [MERGED] fix(decision): ask only the decision statements a turn can reach #7237

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6586
Author: @kolacheee
Created: 9/23/2026
Status: ✅ Merged
Merged: 9/24/2026
Merged by: @kolacheee

Base: staging ← Head: fix/decision-reachable-statements


📝 Commits (10+)

  • 9976ee2 fix(decision): ask only the decision statements a turn can reach
  • 2d8c723 fix(decision): share probability rolls with the entry-text pre-scan, and filter agent plans the same way
  • e23957d fix(decision): follow a lorebook decision branch only once it is decided
  • 84594ba perf(decision): resolve discovery text once for entries without decisions
  • 3313d08 feat(decision): sticky and cooldown on decision statements, and review fixes
  • 75ee90c fix(decision): held statements leave the lorebook's share, timer saves never cost answers, and prompt parts plan their own text
  • d03f558 Merge remote-tracking branch 'origin/staging' into fix/decision-reachable-statements
  • 8cd2b56 fix(decision): plan prompt parts' extension blocks, and give held statements their answer on a Decision field
  • a4731ed fix(decision): plan only the extension blocks the dry run assembles
  • 6e9a8be perf(decision): read preset parts in parallel again

📊 Changes

21 files changed (+1784 additions, -167 deletions)

View changed files

📝 CHANGELOG.md (+6 -0)
📝 docs/connections/decision-models.md (+1 -1)
📝 docs/lorebooks/entries.md (+3 -1)
📝 docs/prompts/conditional-prompts.md (+29 -1)
📝 docs/prompts/macros.md (+1 -1)
📝 docs/prompts/preset-variables.md (+6 -0)
📝 docs/prompts/presets.md (+8 -0)
➕ e2e/decision-peek-report.e2e.ts (+93 -0)
📝 packages/client/src/components/chat/PeekPromptModal.tsx (+16 -1)
📝 packages/client/src/components/chat/chat-area.types.ts (+1 -1)
📝 packages/client/src/hooks/use-chats.ts (+1 -1)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/server/src/routes/chats.routes.ts (+53 -25)
📝 packages/server/src/routes/generate.routes.ts (+83 -23)
📝 packages/server/src/routes/generate/dry-run-route.ts (+66 -26)
➕ packages/server/src/services/decision/decision-timers.ts (+113 -0)
📝 packages/server/src/services/decision/prompt-decisions.ts (+193 -40)
📝 packages/server/src/services/lorebook/index.ts (+104 -39)
📝 packages/shared/src/schemas/gm-verb-table.schema.ts (+1 -0)
📝 packages/shared/src/utils/macro-engine.ts (+283 -7)

...and 1 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6582

Why this change

  • Decision statements per turn (32 by default) was being spent on statements that could not matter. The planner scanned every stored text that could hold a statement, not the prompt the turn builds. Statements in disabled preset sections, in unselected preset variable options, in every enabled entry of the active lorebooks, and behind conditions already ruled out (char == "Dottore" && decision:"..." while the character is Mira) all took slots. Past the limit the rest read as no, so live statements lost their slots to dead ones.
  • A decision block inside a preset variable option never worked. Options are stored as JSON text, and the planner walked the raw text, so the statement was planned under a mangled key (\"Mira is angry...\"). The prompt looks it up under the clean key, so it read as no on every turn and still took a slot.
  • Preset makers had no warning that a decision block near the top of a preset changes the system prompt whenever its answer changes, which makes caching providers bill the whole prompt again.

What changed

  • A planning mode in the macro engine (planDecisionStatements). It resolves a text with decisions unknown rather than false, keeps every branch that could be taken, and records a statement only where its answer could change the result. Values fixed for the turn (the character, persona, model, card fields, literals) still decide conditions, so a block they rule out is not asked about. Anything that can change while the prompt is built, such as a variable written by an earlier section, reads as unknown, so nothing that matters is missed. In a group chat, character conditions read as unknown because they differ per character. Answers the turn already has count. Nothing is written back.
  • The planner asks only reachable statements. Only enabled sections in enabled groups count. For choice blocks, only the selected options are parsed and counted, fixing the key bug; for a Random Pick, every option in the selected pool counts. Statements the planning pass cannot reach are dropped before the limit counts. Each planning group carries its own reachable set, so the pre-reply agents' plan (which includes the prompt's statements), the post-reply plan and retried agents all filter the same way.
  • Lorebook entry text is planned after the scan knows which entries activate. processLorebooks runs its pure pre-scan in rounds. Each round follows only branches already settled, asks newly pending Require/Trigger statements and the statements in the text of newly activating entries, and stops when nothing new comes in. An entry reached only through an undecided branch is asked about only once that branch is a yes. Pre-scan and real scan now share probability rolls whenever entry text holds statements, not only when an entry has a Decision field. Answers are merged in place into the turn's answers object, which generation now always creates, so the preset's lorebook marker and the agents see them.
  • Sticky and cooldown on statements: {{#if decision:"..." sticky:3 cooldown:5}} keeps a yes for 3 turns without asking, then reads as no for 5, then asks again. Cooldown starts when sticky ends, like a lorebook entry's. A turn is each new message the Decision model reads; a regeneration or swipe is the same turn. A held statement is planned so its held answer reaches the prompt, but it is never sent to the model and takes no statement slot. For decision_choice:, sticky keeps the chosen option and cooldown reads every comparison as no. Timers live in chat metadata under a new engine-owned decision namespace, and previews read them without moving them on. Unknown modifiers are ignored, so a later one (such as priority) does not break older builds. A lorebook entry's Decision field already works with the entry's own Sticky and Cooldown, and the docs say so.
  • Peek Prompt and the dry run mirror generation's limit and list statements the limit drops separately from those without an answer yet. Peek Prompt shows them in a matching notice.
  • Docs: docs/prompts/presets.md gains a "Decision blocks and prompt caching" section that tells preset makers to be very careful and purposeful with decision blocks near the top. docs/prompts/preset-variables.md covers decision blocks in options. The Conditional Prompts limits note lists what counts and has a stronger caching warning. The lorebook and Decision Models guides say what counts toward the limit. Conditional Prompts gains a "Sticky and cooldown" section, and the macro reference lists the modifiers. CHANGELOG entries are included.
  • Not in this PR: author-set priority and timing (check every N turns), the planned follow-up.

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

Run by the agent:

  • pnpm check, pnpm localization:check and pnpm regression:node (365 of 365, on the branch rebased onto staging 7e0f2e582).
  • New scripts/regressions/decision-reachable-statements.regression.ts:
    • Planning pass: a fixed value rules a block out, every part of an && counts, nested blocks, a settled chain stops, a variable rules nothing out, a group character condition stays unknown, {{char}} statements, known answers settle their block, settled-only text, and nothing is written.
    • Planner: disabled sections and groups, unselected options, a choice option's statement under its real key, Random Pick pools, and nothing unreachable taking a limited slot.
    • processLorebooks: only the activating entry's statement is asked and its answer reaches the text; a zero budget reports it as dropped and reads as no; shared probability rolls in both roll orders; an entry behind a decision branch is found once that branch is a yes and never asked behind a no.
    • Real routes against a fake System One server: a preset turn asks the choice option's statement under its real key and puts its yes in the prompt, asks the activating entry's statement, and never asks the disabled section, the unselected option, the inactive entry or the character-ruled-out card block. An entry's answer reaches the preset's lorebook marker when the prompt itself asks nothing. A pre-reply agent's plan skips what the prompt's skips. Peek Prompt lists the dropped statement apart from the unanswered one.
    • Sticky and cooldown: timer arithmetic (yes turn, sticky 2, cooldown 1, then asked; a no starts nothing; a run-out timer is dropped), a held statement taking no slot so a live one is still planned, a held statement in lorebook entry text staying free, and five real turns with one statement slot per turn: a held statement is never sent and the live statement gets the slot, a regeneration asks nothing and moves no timer, cooldown reads as no, and Peek Prompt shows the held branch without moving a timer.
    • Every fix was mutation-checked: reverting it makes the regression fail.
  • New e2e/decision-peek-report.e2e.ts, passing locally on desktop-chromium and mobile-chromium (mobile-webkit cannot launch on the agent's machine, so CI covers it). With 33 statements (one past the default limit), a {{prompt}} preview shows 32 unanswered and 1 dropped in separate notices, and never the disabled section's statement. It changes no global setting, so projects sharing a server cannot disturb each other.
  • Local CodeRabbit review: 6 findings over three passes, all fixed. Shared probability rolls were set up only when an entry had a Decision field, so an entry-text-only lorebook could activate an entry whose statements were never asked. The pre-reply agent plan re-planned the prompt's statements without the reachability filter. Lorebook discovery followed undecided branches and charged entries behind them before the branch was answered (now settled rounds). Three trivial: hoisting the agent-shaped context twice, and explicit outcomes in the roll regression. A later pass asked to resolve discovery text once for entries without decisions, which also keeps a random macro's roll stable across rounds; done. The final pass reviewed clean.
  • GitHub CodeRabbit review (4 threads), all fixed in 60b50048f: conversation fields (char_about and the rest) are filled in after planning, so they no longer rule statements out; settled-only planning reads every non-decision operand as the real pass does, so lorebook discovery follows a branch a variable decides; the Peek e2e no longer changes global settings; and #6532 now lists every batched docs path. The sticky and cooldown commit reviewed clean locally.
  • GitHub CodeRabbit second review (2 threads and 1 outside-diff finding), all fixed in 75ee90c0e: held statements no longer shrink the lorebook resolver's share of the limit (generation, Peek Prompt and the dry run); a failed timer save is caught and logged instead of discarding the turn's answers; and the dry run with prompt parts plans promptParts.presetText instead of the preset sections it does not assemble. Each has a regression that fails when the fix is reverted, except the save error path, which the regression harness cannot make fail. Reviewed clean locally.

Please verify manually:

  • In a preset, put a decision block in a disabled section and confirm Peek Prompt (send {{prompt}}) does not list it.
  • Add a preset variable whose option holds {{#if decision:"..."}}...{{/if}}, select that option, and with a Decision model set, confirm the block's yes branch appears in the prompt when the statement is true.
  • Set Decision statements per turn to 1 with two live statements, and confirm Peek Prompt shows one as unanswered and the other under "past the per-turn limit".
  • In a lorebook, give two entries decision blocks in their text, trigger only one by keyword, and confirm only its statement is asked (debug log: [decision] Prompt statement).

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Changed user docs for the batched [docs-i18n] follow-up (#6532, which now lists every batched path): docs/prompts/macros.md (one sentence), docs/prompts/presets.md (new "Decision blocks and prompt caching" section), docs/prompts/preset-variables.md (new "Decision blocks in options" section), docs/prompts/conditional-prompts.md (limits list, a caching paragraph, and a new "Sticky and cooldown" section), docs/lorebooks/entries.md (one sentence), docs/connections/decision-models.md (one sentence).

UI evidence (if applicable)

The new e2e attaches a screenshot of Peek Prompt with both notices: "Decision statements without an answer for this turn yet: 1" listing the first statement, and "Decision statements past the per-turn limit, read as no: 1" listing the second, in the same amber style.

Summary by CodeRabbit

  • New Features

    • Decision statements support sticky and cooldown periods: answers can be held across turns, with cooldown periods reading as no without asking again. Regenerations and swipes do not advance these timers.
    • Lorebook entries support sticky and cooldown behavior for their Decision fields.
  • Bug Fixes

    • Statements that cannot affect the current turn no longer use up the per-turn question limit. Lorebook statements are considered only when their entries activate.
    • Decision blocks in selected preset variable options now receive the correct answers.
    • Peek Prompt distinguishes unanswered statements from those skipped because they exceed the limit.
  • Documentation

    • Clarified which statements count toward the limit and how decision blocks can affect prompt caching and costs.

🔄 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/6586 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/23/2026 **Status:** ✅ Merged **Merged:** 9/24/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/decision-reachable-statements` --- ### 📝 Commits (10+) - [`9976ee2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9976ee2f777929d575337b61f2bc3f1ee7d0405f) fix(decision): ask only the decision statements a turn can reach - [`2d8c723`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2d8c7231ca9882507aceda9a1d8a838e1e9977dd) fix(decision): share probability rolls with the entry-text pre-scan, and filter agent plans the same way - [`e23957d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e23957d5b754d8e1fb87a9dd813094d6214d6a66) fix(decision): follow a lorebook decision branch only once it is decided - [`84594ba`](https://github.com/Pasta-Devs/Marinara-Engine/commit/84594ba0e2785f9dd018fe70ddf08b395d31ea0f) perf(decision): resolve discovery text once for entries without decisions - [`3313d08`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3313d08ceb0cf69bf9375adbc19f9e4b79940ad1) feat(decision): sticky and cooldown on decision statements, and review fixes - [`75ee90c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/75ee90c0ed23cfdad6d8f4622099f71c52be5b9a) fix(decision): held statements leave the lorebook's share, timer saves never cost answers, and prompt parts plan their own text - [`d03f558`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d03f5588e0e0bd710ccb6c53fe4554383449927c) Merge remote-tracking branch 'origin/staging' into fix/decision-reachable-statements - [`8cd2b56`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8cd2b56925ded5510a36a76de2b28f2b7abd1c7d) fix(decision): plan prompt parts' extension blocks, and give held statements their answer on a Decision field - [`a4731ed`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a4731ed3655a812404232e08362f87590a73a271) fix(decision): plan only the extension blocks the dry run assembles - [`6e9a8be`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6e9a8be81858b53cda310d95d72666adc91cc556) perf(decision): read preset parts in parallel again ### 📊 Changes **21 files changed** (+1784 additions, -167 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+6 -0) 📝 `docs/connections/decision-models.md` (+1 -1) 📝 `docs/lorebooks/entries.md` (+3 -1) 📝 `docs/prompts/conditional-prompts.md` (+29 -1) 📝 `docs/prompts/macros.md` (+1 -1) 📝 `docs/prompts/preset-variables.md` (+6 -0) 📝 `docs/prompts/presets.md` (+8 -0) ➕ `e2e/decision-peek-report.e2e.ts` (+93 -0) 📝 `packages/client/src/components/chat/PeekPromptModal.tsx` (+16 -1) 📝 `packages/client/src/components/chat/chat-area.types.ts` (+1 -1) 📝 `packages/client/src/hooks/use-chats.ts` (+1 -1) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+53 -25) 📝 `packages/server/src/routes/generate.routes.ts` (+83 -23) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+66 -26) ➕ `packages/server/src/services/decision/decision-timers.ts` (+113 -0) 📝 `packages/server/src/services/decision/prompt-decisions.ts` (+193 -40) 📝 `packages/server/src/services/lorebook/index.ts` (+104 -39) 📝 `packages/shared/src/schemas/gm-verb-table.schema.ts` (+1 -0) 📝 `packages/shared/src/utils/macro-engine.ts` (+283 -7) _...and 1 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #6582 ## Why this change - **Decision statements per turn (32 by default) was being spent on statements that could not matter.** The planner scanned every stored text that could hold a statement, not the prompt the turn builds. Statements in disabled preset sections, in unselected preset variable options, in every enabled entry of the active lorebooks, and behind conditions already ruled out (`char == "Dottore" && decision:"..."` while the character is Mira) all took slots. Past the limit the rest read as no, so live statements lost their slots to dead ones. - **A decision block inside a preset variable option never worked.** Options are stored as JSON text, and the planner walked the raw text, so the statement was planned under a mangled key (`\"Mira is angry...\"`). The prompt looks it up under the clean key, so it read as no on every turn and still took a slot. - Preset makers had no warning that a decision block near the top of a preset changes the system prompt whenever its answer changes, which makes caching providers bill the whole prompt again. ## What changed - **A planning mode in the macro engine** (`planDecisionStatements`). It resolves a text with decisions unknown rather than false, keeps every branch that could be taken, and records a statement only where its answer could change the result. Values fixed for the turn (the character, persona, model, card fields, literals) still decide conditions, so a block they rule out is not asked about. Anything that can change while the prompt is built, such as a variable written by an earlier section, reads as unknown, so nothing that matters is missed. In a group chat, character conditions read as unknown because they differ per character. Answers the turn already has count. Nothing is written back. - **The planner asks only reachable statements.** Only enabled sections in enabled groups count. For choice blocks, only the selected options are parsed and counted, fixing the key bug; for a Random Pick, every option in the selected pool counts. Statements the planning pass cannot reach are dropped before the limit counts. Each planning group carries its own reachable set, so the pre-reply agents' plan (which includes the prompt's statements), the post-reply plan and retried agents all filter the same way. - **Lorebook entry text is planned after the scan knows which entries activate.** `processLorebooks` runs its pure pre-scan in rounds. Each round follows only branches already settled, asks newly pending Require/Trigger statements and the statements in the text of newly activating entries, and stops when nothing new comes in. An entry reached only through an undecided branch is asked about only once that branch is a yes. Pre-scan and real scan now share probability rolls whenever entry text holds statements, not only when an entry has a Decision field. Answers are merged in place into the turn's answers object, which generation now always creates, so the preset's lorebook marker and the agents see them. - **Sticky and cooldown on statements:** `{{#if decision:"..." sticky:3 cooldown:5}}` keeps a yes for 3 turns without asking, then reads as no for 5, then asks again. Cooldown starts when sticky ends, like a lorebook entry's. A turn is each new message the Decision model reads; a regeneration or swipe is the same turn. A held statement is planned so its held answer reaches the prompt, but it is never sent to the model and takes no statement slot. For `decision_choice:`, sticky keeps the chosen option and cooldown reads every comparison as no. Timers live in chat metadata under a new engine-owned `decision` namespace, and previews read them without moving them on. Unknown modifiers are ignored, so a later one (such as priority) does not break older builds. A lorebook entry's Decision field already works with the entry's own Sticky and Cooldown, and the docs say so. - **Peek Prompt and the dry run mirror generation's limit** and list statements the limit drops separately from those without an answer yet. Peek Prompt shows them in a matching notice. - **Docs:** `docs/prompts/presets.md` gains a "Decision blocks and prompt caching" section that tells preset makers to be very careful and purposeful with decision blocks near the top. `docs/prompts/preset-variables.md` covers decision blocks in options. The Conditional Prompts limits note lists what counts and has a stronger caching warning. The lorebook and Decision Models guides say what counts toward the limit. Conditional Prompts gains a "Sticky and cooldown" section, and the macro reference lists the modifiers. CHANGELOG entries are included. - **Not in this PR:** author-set priority and timing (check every N turns), the planned follow-up. ## 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 Run by the agent: - `pnpm check`, `pnpm localization:check` and `pnpm regression:node` (365 of 365, on the branch rebased onto staging `7e0f2e582`). - New `scripts/regressions/decision-reachable-statements.regression.ts`: - **Planning pass:** a fixed value rules a block out, every part of an `&&` counts, nested blocks, a settled chain stops, a variable rules nothing out, a group character condition stays unknown, `{{char}}` statements, known answers settle their block, settled-only text, and nothing is written. - **Planner:** disabled sections and groups, unselected options, a choice option's statement under its real key, Random Pick pools, and nothing unreachable taking a limited slot. - **`processLorebooks`:** only the activating entry's statement is asked and its answer reaches the text; a zero budget reports it as dropped and reads as no; shared probability rolls in both roll orders; an entry behind a decision branch is found once that branch is a yes and never asked behind a no. - **Real routes** against a fake System One server: a preset turn asks the choice option's statement under its real key and puts its yes in the prompt, asks the activating entry's statement, and never asks the disabled section, the unselected option, the inactive entry or the character-ruled-out card block. An entry's answer reaches the preset's lorebook marker when the prompt itself asks nothing. A pre-reply agent's plan skips what the prompt's skips. Peek Prompt lists the dropped statement apart from the unanswered one. - **Sticky and cooldown:** timer arithmetic (yes turn, sticky 2, cooldown 1, then asked; a no starts nothing; a run-out timer is dropped), a held statement taking no slot so a live one is still planned, a held statement in lorebook entry text staying free, and five real turns with one statement slot per turn: a held statement is never sent and the live statement gets the slot, a regeneration asks nothing and moves no timer, cooldown reads as no, and Peek Prompt shows the held branch without moving a timer. - Every fix was mutation-checked: reverting it makes the regression fail. - New `e2e/decision-peek-report.e2e.ts`, passing locally on desktop-chromium and mobile-chromium (mobile-webkit cannot launch on the agent's machine, so CI covers it). With 33 statements (one past the default limit), a `{{prompt}}` preview shows 32 unanswered and 1 dropped in separate notices, and never the disabled section's statement. It changes no global setting, so projects sharing a server cannot disturb each other. - Local CodeRabbit review: 6 findings over three passes, all fixed. Shared probability rolls were set up only when an entry had a Decision field, so an entry-text-only lorebook could activate an entry whose statements were never asked. The pre-reply agent plan re-planned the prompt's statements without the reachability filter. Lorebook discovery followed undecided branches and charged entries behind them before the branch was answered (now settled rounds). Three trivial: hoisting the agent-shaped context twice, and explicit outcomes in the roll regression. A later pass asked to resolve discovery text once for entries without decisions, which also keeps a random macro's roll stable across rounds; done. The final pass reviewed clean. - GitHub CodeRabbit review (4 threads), all fixed in `60b50048f`: conversation fields (`char_about` and the rest) are filled in after planning, so they no longer rule statements out; settled-only planning reads every non-decision operand as the real pass does, so lorebook discovery follows a branch a variable decides; the Peek e2e no longer changes global settings; and #6532 now lists every batched docs path. The sticky and cooldown commit reviewed clean locally. - GitHub CodeRabbit second review (2 threads and 1 outside-diff finding), all fixed in `75ee90c0e`: held statements no longer shrink the lorebook resolver's share of the limit (generation, Peek Prompt and the dry run); a failed timer save is caught and logged instead of discarding the turn's answers; and the dry run with prompt parts plans `promptParts.presetText` instead of the preset sections it does not assemble. Each has a regression that fails when the fix is reverted, except the save error path, which the regression harness cannot make fail. Reviewed clean locally. Please verify manually: - In a preset, put a decision block in a disabled section and confirm Peek Prompt (send `{{prompt}}`) does not list it. - Add a preset variable whose option holds `{{#if decision:"..."}}...{{/if}}`, select that option, and with a Decision model set, confirm the block's yes branch appears in the prompt when the statement is true. - Set **Decision statements per turn** to 1 with two live statements, and confirm Peek Prompt shows one as unanswered and the other under "past the per-turn limit". - In a lorebook, give two entries decision blocks in their text, trigger only one by keyword, and confirm only its statement is asked (debug log: `[decision] Prompt statement`). ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Changed user docs for the batched `[docs-i18n]` follow-up (#6532, which now lists every batched path): `docs/prompts/macros.md` (one sentence), `docs/prompts/presets.md` (new "Decision blocks and prompt caching" section), `docs/prompts/preset-variables.md` (new "Decision blocks in options" section), `docs/prompts/conditional-prompts.md` (limits list, a caching paragraph, and a new "Sticky and cooldown" section), `docs/lorebooks/entries.md` (one sentence), `docs/connections/decision-models.md` (one sentence). ## UI evidence (if applicable) The new e2e attaches a screenshot of Peek Prompt with both notices: "Decision statements without an answer for this turn yet: 1" listing the first statement, and "Decision statements past the per-turn limit, read as no: 1" listing the second, in the same amber style. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Decision statements support sticky and cooldown periods: answers can be held across turns, with cooldown periods reading as no without asking again. Regenerations and swipes do not advance these timers. - Lorebook entries support sticky and cooldown behavior for their Decision fields. - **Bug Fixes** - Statements that cannot affect the current turn no longer use up the per-turn question limit. Lorebook statements are considered only when their entries activate. - Decision blocks in selected preset variable options now receive the correct answers. - Peek Prompt distinguishes unanswered statements from those skipped because they exceed the limit. - **Documentation** - Clarified which statements count toward the limit and how decision blocks can affect prompt caching and costs. <!-- 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:17:49 +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#7237
No description provided.