mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #8951] [Feature]: Tell Long-Term Memory when a chat is branched #8906
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#8906
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?
Originally created by @Promansis on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8951
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
When a chat is branched, the Engine copies the parent's messages together with their "hidden from the AI" flags. The Long-Term Memory package hides older messages it has already turned into memories. It also keeps the last few visible, so a branch made from inside a hidden stretch starts with every copied message hidden. LTM can only show the branch's last messages again once it is asked about that chat, and the first time that happens is the branch's first recall. That recall runs after the Engine has already read the history, so:
Packages hear nothing about new chats, so LTM cannot fix this on its own.
Proposed solution
Add one optional method to the existing host-only
long-term-memory:runtimeservice. After the branch route has finished copying (messages, metadata and snapshots), the Engine awaits it once, before it returns the new chat:A package without the method changes nothing. A thrown error or a slow call is logged and never fails the branch: the Engine waits at most a few seconds, then returns the branch anyway.
Minimal fix
Tip checked: upstream/staging
8ee9cc2d13(2026-11-07); line hints may drift, re-grep.packages/server/src/services/generation/long-term-memory-runtime.ts:chatBranched?toLongTermMemoryRuntimeService(:20-41), with a doc comment naming the Capability API minor;recordLongTermMemoryPromptAccepted(:162-172), e.g.notifyLongTermMemoryChatBranched(input). It readsruntimeService(), returns when the method is missing, and awaits it under a fixed cap (ponytail:comment naming the cap and the upgrade path). It logs a failure or timeout withlogger.warn(err, ...)and never throws.packages/server/src/routes/chats.routes.ts,POST /:id/branch(:5559): after the snapshottry/catchends (:6048) and beforestorage.getById(newChat.id)(:6050), callawait notifyLongTermMemoryChatBranched({ chatId: newChat.id, parentChatId: sourceChat.id }). Only this route creates branch chats (storage.create:5594, metadata :5819-5830).packages/shared/src/schemas/capability-package.schema.ts:1575: bumpsupportedCapabilityApito the next free minor (1.817 at this tip), with a version comment in the existing style. Use the next free number if staging moved.docs/development/optional-agent-packages.md(near :1901, besidesummaryMemoryInstruction): documentchatBranched, when it runs, that the branch's messages and metadata already exist, and that errors and timeouts are ignored.scripts/regressions/capability-package-lifecycle.regression.ts(it already registerslong-term-memory:runtime) or the branch-route regression nearest the route. Cover three cases:chatBranchedonce with the new chat id and the source chat id, and inside the call the branch's copied messages andbranchParentChatIdmetadata are readable;Non-goals: a general chat-event bus for every package; a manifest field or permission; client changes; changing which flags the branch copies. Do not touch
CHANGELOG.md(Engine rule: release PRs only).Alternatives considered
Additional context
The package side, which runs LTM's existing branch pass from
chatBranched, lives in Pasta-Devs/Marinara-Agents. Older Engines keep the current behavior: the pass runs at the branch's first recall.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: