mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2470] [Issue]: Switching chats discards pending Card Evolution / Lorebook Keeper approval proposals #1212
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#1212
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/2470
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Severity: Medium — data-loss (UX). Switching chats unconditionally resets the agent store, which discards any pending Card Evolution Auditor / Lorebook Keeper approval proposals that are waiting for the user to approve or reject. The proposals are not persisted anywhere, so they are unrecoverable.
Expected behavior
A pending card/lorebook approval should survive a chat switch (or at least not be silently destroyed), since generations for non-active chats are explicitly kept running in the background and these proposals are meant to "sit until the user approves or rejects."
Actual behavior
The chat-switch effect resets the whole agent store on any chat change, and
reset()clears the pending-approval queues with no chat-scoping or condition:Background generations do survive a chat switch (the chat store keeps per-chat abortControllers/streamBuffers), so a background chat's auditor can finish and enqueue a proposal — but if the user then switches away before approving, the proposal is wiped. The modals read only the live global array (
CharacterCardUpdateModal.tsx,LorebookKeeperReviewModal.tsx), with no re-fetch path. ThePendingCardUpdatedocstring itself states these are sensitive and sit in the queue until the user acts.Steps to reproduce
Impact area
Environment
1fae2c42Logs, screenshots, or video
Static trace:
chat-switch-effects.ts:13,agent.store.ts:279-296(clears at 294-295), modalsCharacterCardUpdateModal.tsx/LorebookKeeperReviewModal.tsx.Regression notes
Not a regression — main has equivalent behavior (
chat.store.tscallsagentStore.reset()insidesetActiveChatId, clearingpendingCardUpdates;pendingLorebookUpdatesis a refactor-only addition with no main equivalent). Filing as a refactorbugto fix the data-loss UX, not as a main→refactor regression.Additional context
The lost items are regenerable AI proposals (re-proposed next turn), not user-authored content — hence Medium. Fix: make
pendingCardUpdates/pendingLorebookUpdatesper-chat (they already carry the characterId/chatId) and only clear entries for chats that no longer exist, or preserve them inreset(). Mirror the durable pattern already in the repo (cyoaChoicesis guarded bycyoaChoicesChatId; echo messages persist via chat metadata).Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 6, 2026):
Fixed on refactor in
038b7220.Switching chats no longer clears pending Card Evolution or Lorebook Keeper approval proposals; explicit clear paths remain available.
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.