[GH-ISSUE #799] [Issue]: LTM scope picker ignores branch renames (metadata.branchName) — renamed branches unsearchable and mislabeled #412

Closed
opened 2026-10-20 17:27:19 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Sep 12, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/799

Originally assigned to: @Promansis on GitHub.

Summary

The Long-Term Memory Sources scope picker ("Find sources in") labels and searches chats using the database chat.name field only. It ignores chat.metadata.branchName, which is where branch renames are stored and which the rest of the chat UI uses as the display name. Additionally, branch-family entries only expose chat IDs as search text, so a renamed branch can never be found by searching for its name.

Affected package

long-term-memory

Expected behavior

LTM should display and search the same chat display name the main chat UI uses: chat.metadata.branchName when set, falling back to chat.name. Concretely:

  1. Chat entries in the "Find sources in" picker should be labeled with the branch display name and match searches for it.
  2. The pinned "Current" target should expose the current chat's actual name in its label or subtext and be findable by searching for it.
  3. Branch-family entries ("All branches: …") should be searchable by member chat/branch display names, not just by opaque chat IDs.
  4. Chat-summary candidate titles in the Sources table should use the branch display name.

Actual behavior

  • GET /scope-targets builds chat labels from chat.name only and never reads chat.metadata.branchName, so a branch renamed to e.g. "Final Branch" still appears under its original name.
  • Branch-family entries are rendered as All branches: <first member's chat.name>; individual renamed branches are hidden and unsearchable.
  • The client builds branch-group searchText from group.chatIds.join(" ") (raw IDs), so searching for a branch display name returns nothing.
  • The current chat is pinned as "Current" and its real name is not part of the search text, so searching for the current branch's name also fails.
  • Chat-summary candidate titles ("<chat.name>, msgs <range>") and the chat_name: evidence use chat.name, so imported source notes carry the pre-rename name.

User-visible result (reported): with a pre-2.0 chat whose current branch was renamed to "Final Branch", searching the picker for "Final Branch" returns nothing, and the summaries are only reachable under the original chat name's "All branches" entry.

Relevant code paths:

  • packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/routes.ts (/scope-targets: label: chat.name?.trim() || "Untitled chat", group label from first member)
  • packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/interop.ts (candidate title = \${chat.name || "Chat"}, msgs ${entry.range}`, chat_name:` evidence)
  • packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/SourcesWorkspace.tsx (chatTarget label/searchText, branch-group searchText: group.chatIds.join(" "))

Note the display-name helper already exists in Engine (sources/engine/packages/client/src/lib/chat-display.ts, getChatDisplayName) — LTM needs the same branchName-fallback logic for its labels/search.

Steps to reproduce

  1. Open a chat, create a branch of it, and rename the current branch to a distinctive name (e.g. "Final Branch").
  2. Open LTM → Sources → Chat Summaries and open the "Find sources in" picker.
  3. Search for the renamed branch name ("Final Branch"). No target matches; the branch family only appears as "All branches: ", and the current chat is only listed as "Current".

Environment

  • Marinara Engine version: 2.4.1
  • Package version: long-term-memory 1.2.26
  • Install type: source
  • OS + version: reported on user install (version-independent; logic-level bug)
  • Browser or app shell: web client

Logs, screenshots, or video

Not applicable — deterministic labeling/search logic, reproducible from UI alone.

Additional context

Proposed fix (root cause, shared helper):

  1. Resolve labels via a small shared helper: metadata.branchName (trimmed) || chat.name in /scope-targets and in interop candidate titles/evidence.
  2. Extend branch-group searchText to include the family label and member display names; include the current chat's display name in the pinned "Current" target's label/searchText.
  3. Keep all scope/provenance IDs unchanged — display and search only.
  4. Regression test: rename a branch, assert /scope-targets exposes the renamed label and the picker search text matches it; assert chat-summary candidate title uses the renamed display name.

Workaround for affected users: source summaries from "All" or the "All branches: " entry; the original name can be found by browsing the picker without a search query.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Sep 12, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/799 Originally assigned to: @Promansis on GitHub. ## Summary The Long-Term Memory Sources scope picker ("Find sources in") labels and searches chats using the database `chat.name` field only. It ignores `chat.metadata.branchName`, which is where branch renames are stored and which the rest of the chat UI uses as the display name. Additionally, branch-family entries only expose chat IDs as search text, so a renamed branch can never be found by searching for its name. ## Affected package `long-term-memory` ## Expected behavior LTM should display and search the same chat display name the main chat UI uses: `chat.metadata.branchName` when set, falling back to `chat.name`. Concretely: 1. Chat entries in the "Find sources in" picker should be labeled with the branch display name and match searches for it. 2. The pinned "Current" target should expose the current chat's actual name in its label or subtext and be findable by searching for it. 3. Branch-family entries ("All branches: …") should be searchable by member chat/branch display names, not just by opaque chat IDs. 4. Chat-summary candidate titles in the Sources table should use the branch display name. ## Actual behavior - `GET /scope-targets` builds chat labels from `chat.name` only and never reads `chat.metadata.branchName`, so a branch renamed to e.g. "Final Branch" still appears under its original name. - Branch-family entries are rendered as `All branches: <first member's chat.name>`; individual renamed branches are hidden and unsearchable. - The client builds branch-group `searchText` from `group.chatIds.join(" ")` (raw IDs), so searching for a branch display name returns nothing. - The current chat is pinned as "Current" and its real name is not part of the search text, so searching for the current branch's name also fails. - Chat-summary candidate titles (`"<chat.name>, msgs <range>"`) and the `chat_name:` evidence use `chat.name`, so imported source notes carry the pre-rename name. User-visible result (reported): with a pre-2.0 chat whose current branch was renamed to "Final Branch", searching the picker for "Final Branch" returns nothing, and the summaries are only reachable under the original chat name's "All branches" entry. Relevant code paths: - `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/routes.ts` (`/scope-targets`: `label: chat.name?.trim() || "Untitled chat"`, group label from first member) - `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/interop.ts` (candidate `title = \`\${chat.name || "Chat"}, msgs \${entry.range}\``, `chat_name:` evidence) - `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory/SourcesWorkspace.tsx` (`chatTarget` label/searchText, branch-group `searchText: group.chatIds.join(" ")`) Note the display-name helper already exists in Engine (`sources/engine/packages/client/src/lib/chat-display.ts`, `getChatDisplayName`) — LTM needs the same branchName-fallback logic for its labels/search. ## Steps to reproduce 1. Open a chat, create a branch of it, and rename the current branch to a distinctive name (e.g. "Final Branch"). 2. Open LTM → Sources → Chat Summaries and open the "Find sources in" picker. 3. Search for the renamed branch name ("Final Branch"). No target matches; the branch family only appears as "All branches: <original chat name>", and the current chat is only listed as "Current". ## Environment - Marinara Engine version: 2.4.1 - Package version: long-term-memory 1.2.26 - Install type: source - OS + version: reported on user install (version-independent; logic-level bug) - Browser or app shell: web client ## Logs, screenshots, or video Not applicable — deterministic labeling/search logic, reproducible from UI alone. ## Additional context Proposed fix (root cause, shared helper): 1. Resolve labels via a small shared helper: `metadata.branchName (trimmed) || chat.name` in `/scope-targets` and in interop candidate titles/evidence. 2. Extend branch-group `searchText` to include the family label and member display names; include the current chat's display name in the pinned "Current" target's label/searchText. 3. Keep all scope/provenance IDs unchanged — display and search only. 4. Regression test: rename a branch, assert `/scope-targets` exposes the renamed label and the picker search text matches it; assert chat-summary candidate title uses the renamed display name. Workaround for affected users: source summaries from "All" or the "All branches: <original chat name>" entry; the original name can be found by browsing the picker without a search query. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:27:19 +07:00
  • closed this issue
  • added the
    bug
    label
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-Agents#412
No description provided.