mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7705] [MERGED] feat(macros): add {{reasoning}} for the request's reasoning level #7891
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#7891
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/7705
Author: @ylli-selmani
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ylli-selmani
Base:
staging← Head:feat/model-reasoning-macros-hgo3l3📝 Commits (3)
aa653b5feat(macros): add {{reasoning}} for the request's reasoning levelb2a3371fix(macros): let a variable own {{reasoning}} in any spelling6456383fix(macros): match {{reasoning}} previews to their requests📊 Changes
12 files changed (+395 additions, -4 deletions)
View changed files
📝
docs/prompts/conditional-prompts.md(+24 -2)📝
docs/prompts/macros.md(+3 -0)📝
packages/server/src/routes/chats.routes.ts(+23 -0)📝
packages/server/src/routes/generate.routes.ts(+18 -1)📝
packages/server/src/routes/generate/dry-run-route.ts(+21 -0)📝
packages/server/src/routes/prompts.routes.ts(+14 -1)📝
packages/server/src/services/generation/provider-generation-runtime.ts(+43 -0)📝
packages/server/src/services/prompt/assembler.ts(+3 -0)📝
packages/server/src/services/prompt/macro-context.ts(+2 -0)📝
packages/shared/src/utils/macro-engine.ts(+36 -0)➕
scripts/regressions/reasoning-macro-routes.regression.ts(+138 -0)➕
scripts/regressions/reasoning-macro.regression.ts(+70 -0)📄 Description
Linked issue
Closes #7704
Why this change
Before: a preset can't tell whether the model is thinking, so chain-of-thought sections have to be toggled by hand whenever the reasoning level changes.
After:
{{reasoning}}resolves to the level the model is actually sent (low…max) oroff, so{{#if reasoning}}…{{else}}…{{/if}}keeps a CoT section only when it's needed, and{{#if reasoning == "max"}}targets one level.{{model}}already existed; the docs now show model-specific conditionals with it ({{#if model contains "opus"}}).What changed
macro-engine.ts: newreasoningcontext field,{{reasoning}}macro,reasoningcondition operand (fixed for the turn in decision planning), and a Macro Reference entry. A preset or chat variable that already owns the name (in any spelling, e.g.Reasoning) keeps it, so existing presets don't change.resolveReasoningMacroValue(provider-generation-runtime): runs the same layering as the request (preset → connection → chat → scene force → Codex default → provider/model mapping) but before assembly, because macros resolve while the prompt is built and the final parameters are only known afterwards. It reusesresolveGenerationParameters, so the two can't drift.macros.mdandconditional-prompts.md(two new worked examples).reasoning-macro.regression.ts.How: the macro reads
resolvedEffort, the same value that turns thinking mode on, so "Maximum" shows asmax,xhighorhighdepending on the model.Notes:
{{reasoning}}from the chat's own or default connection, exactly like{{model}}there already does. Matching per-request/random connection selection is out of scope on purpose.{{reasoning}}follows each route's own parameters, so it matches what each one reports.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
{{model}}, {{reasoning}}and checked the sent prompt:deepseek/deepseek-v4.1-flash:thinking, mediumwith Medium set, and on a random-connection chatz-ai/glm-5.3-flash, medium.reasoning-macro(incl. aReasoningpreset variable,@reasoningoperand, deferred preset value),prompt,decision-conditionals,chat-variablesall pass.b2a3371ed, the third is the Peek Prompt note above.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation): #7710🤖 Generated with Claude Code
Summary by CodeRabbit
{{reasoning}}prompt macro that reflects the effective reasoning setting, includingoff,medium,high, andmax.reasoningretain precedence over the macro.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.