mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2465] [Issue]: branch_chat inherits connectedChatId from the source chat, linking the branch to the partner chat #1208
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#1208
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 @Romuromylus on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2465
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Medium — correctness regression.
branch_chatclones the entire source chat object, so a branch created from a connected chat silently inherits the source'sconnectedChatId, leaking the partner chat's content into the branch's prompts and creating a one-way/phantom link.Expected behavior
Branching should build the new chat from an explicit field allowlist (like main's
/:id/branchroute) and must not carryconnectedChatIdinto the branch. A fresh branch is not linked to anything until the user links it.Actual behavior
branch_chatloads the full source chat viaget_required, mutates onlyid/name/groupId, scrubs summary metadata, and creates the new chat —connectedChatIdis never nulled:connectedChatIdis a live, consumed field:prompt-assembly.tsloads the connected chat's last messages and injects a "linked chat" block, andconnected-commands.tsredirects message routing on it. The link is also phantom/one-way — the partner chat'sconnectedChatIdstill points at the source, never the branch, sodisconnect_connected_chat(which discovers partners by scanning forconnectedChatId == self) can never clean the branch.Steps to reproduce
connectedChatId = B).Impact area
Environment
1fae2c42Logs, screenshots, or video
Static source trace, cited to
src-tauri/src/commands/storage/chats.rs:2053-2080,prune_branch_summary_metadataat:502-509, partner-discovery atdisconnect_connected_chat(:1697).Regression notes
Regression vs main — main does this correctly.
packages/server/src/routes/chats.routes.ts/:id/branchbuilds the new chat from an explicit allowlist (name, mode, characterIds, groupId, personaId, promptPresetId, connectionId) and never copiesconnectedChatId. The refactor's whole-object clone reintroduced the leak.Additional context
Fix: after cloning (or inside
prune_branch_summary_metadata),object.insert("connectedChatId", Value::Null)— or rebuild the branch from an allowlist matching main. While here, consider also rejecting scene chats frombranch_chat(main guards that too).Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@Romuromylus commented on GitHub (Jun 6, 2026):
Sibling chat-copy guard gap: #2468 (
forkRoleplayScenedrops three guards main enforces). Both are chat/scene copy paths that the refactor rebuilt without main's field allowlist / validation, so they're good candidates to fix in one pass.@SpicyMarinara commented on GitHub (Jun 6, 2026):
Fixed on refactor in
038b7220.branch_chat now clears connectedChatId on the cloned chat so branches do not inherit partner-chat links.
Verification: pnpm typecheck; pnpm build; pnpm check:architecture; cargo check --manifest-path src-tauri/Cargo.toml --workspace; focused Rust backup/profile tests; git diff --check; no .test.ts/.test.tsx files present.