mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[GH-ISSUE #1759] [Feature]: Long-Term Memory: branch dropdown for the Chat Messages source #1739
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1739
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 (Oct 27, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1759
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
The Long-Term Memory "Chat Messages" source (1.5.0, #1744) lists every piece of a chat's history for import. Marinara branches are separate chats in the same group, with the same messages copied under new ids. The list covers the whole group, so with several branches the user sees pieces from all of them mixed together and cannot tell which branch a piece belongs to. Identical pieces are already merged into one row, but a piece that exists in only one branch sits beside pieces from other branches with nothing to separate them.
Example: a chat has the branches "New Branch" and "Rewrite". Both share the first 40 messages, then diverge. The list shows the shared pieces once, then the pieces from both endings interleaved. A user who only wants the "Rewrite" ending has to guess which pieces those are, and may import the abandoned ending by mistake.
Proposed package or change
Package:
long-term-memory. Server preview filter and Sources screen change, no Engine change.When the selected chat's group has more than one chat, the Chat Messages tab shows a Branch dropdown next to the Mode dropdown:
The dropdown only filters the list. Import still goes to the whole chat's memory, so a piece imported from any branch keeps counting as imported everywhere it is shared.
Version: ships as 1.5.1 (patch). Not a minor: no new setting, no stored data change.
Minimal fix
Server,
packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/sources/interop.ts:branchChatIds?: string[]toCandidate.resolvePreviewCandidates: when it merges identicalchat_transcriptrows, accumulate the producing chat ids (row.provenance.sourceId) on the kept row.previewPackageInterop: afterresolvePreviewCandidatesand beforepreviewPageand thetotals, filterrowsbyrequest.branchChatIdwhen set andsource === "messages".previewPage: includebranchChatIdin the cursor binding hash, so a cursor from one filter is rejected under another.Shared,
packages/long-term-memory/src/engine/packages/shared/src/features/agents/long-term-memory/schema/sources.ts:ltmInteropPreviewRequestSchema: addbranchChatId: z.string().min(1).max(200).optional().Client,
packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/sources/SourcesWorkspace.tsxandlocales/en.json:branchChatIdstate, default the current chat, reset when the chat or source target changes.scopeTargets.data.groups/chats, shown only forsource === "messages"and a group with more than one chat.branchChatIdto the preview request body and topreviewQueryKey.<select>like the Mode select (data-ltm-source-branch, aria-label), usingconfirmSelectionChange()andclearImportResult()on change.ui.longTermMemory.sourcesworkspace(the existingallBrancheskey is reused for "All branches").packages/long-term-memory/CHANGELOG.md: one user-facing line under## Unreleased.Regression: extend
tests/long-term-memory-chat-transcript-import.regression.ts. Add a sibling branch whose messages diverge frombranchChat, preview withbranchChatIdset to each branch, and expect the shared piece under both, each branch-only piece under only its own,totalsconsistent with the rows, and a cursor from one filter rejected under another. AbranchChatIdoutside the group yields no rows.Why should this be optional?
It lives in the Long-Term Memory package, which is already optional. Within the package it adds no setting: a chat without branches sees no dropdown, and "All branches" keeps today's list.
Alternatives considered
branchParentMessageId): rejected for now. Branches of branches and edited copies make it unreliable; piece text equality already drives the existing de-duplication.Known limit: shared history is recognised by identical piece text, so a piece that spans the fork point (shared plus branch-only messages) differs per branch and shows under its own branch only.
Additional context
Follow-up to #1747 (LTM 1.5.0). Requested by the maintainer after trying the Chat Messages tab on a chat with several drafts.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: