[GH-ISSUE #1544] [Issue]: Long-Term Memory: Undo, Save, Delete and Rename detail in the Memory Vault stop half-way when another memory is opened meanwhile #1516

Closed
opened 2026-10-22 04:02:52 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Promansis on GitHub.

Summary

In the Memory Vault, four actions stop half-way when you open another memory before they finish: Undo after an archive, Save, permanent Delete and Rename detail (whose dialog Escape closes while it runs). Depending on the action, the buttons stay disabled, the list keeps showing the old memories, a memory reopened during its own save shows the copy from before the save, deleted memories stay ticked and open, and a partly failed Undo does not put the memories it did restore back into the archive.

Affected package

long-term-memory 1.4.72 (upstream/staging bcaebd07d), which has the fix for bulk changes undone by the open memory (#1535; it adds refreshAfterBatch and reloads an open memory after an archive Undo), Memory Vault (client).

C = packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory

Expected behavior

When one of these actions finishes, the work that belongs to the whole vault is done, whatever memory you opened meanwhile: the busy state clears so the buttons work again, the list reloads, a partly failed Undo archives again the memories it restored, and deleted memories leave the selection. A memory you reopened while its own save ran shows what was saved. A deleted memory you opened closes, with the delete message that says why. Other messages (notices and errors) belong to the memory that was open when the action started, so they are not shown over the new one. The Rename detail dialog stays open while the rename runs, as its disabled Cancel button already intends, so Escape does not close it.

Actual behavior

Each action remembers the editor session when it starts, and when its request answers it returns at once if the session changed. Opening a memory, starting a new one, closing the editor or choosing a place all change the session.

  • Undo archive (undoArchive, C/vault/MemoryVault.tsx:1441): returns at :1459, and its finally clears the busy flag only for the same session (:1508). After you open a memory during an Undo:
    • the flag stays "undo-archive", so the Select toolbar, each row's Archive and Delete, Remove detail, Rename detail and Undo stay disabled until another action such as a save resets it;
    • the lists do not reload;
    • if only some memories were restored, the rollback that archives them again (:1481-1489) is skipped, so the archive is left half-undone in storage.
  • Save (save(), :1543): returns at :1626, and its finally (:1699) clears the flag only for the same session. If you open a memory while a slow save runs and choose "Discard and continue", the flag stays "save" and the save state stays "saving": the button reads "Saving", and Save stays disabled for every memory until you leave the Vault. The list is not reloaded, so it keeps the copy from before the save, and reopening the memory you were saving shows that old copy.
  • Permanent delete (deleteSelected, :1703): returns at :1708. The flag does clear (the caller's finally, :1914), but the selection clear, closing a deleted open memory, the notice and the list reload (:1728) are skipped. The deleted memories stay listed and ticked; a deleted memory you opened meanwhile stays open and fails to save; a later bulk action reports the deleted ids as failed. The open-memory check also reads the memory that was open when the delete started (draft at :1715), not the one open now.
  • Rename detail (renameSection, :1772): its dialog disables Cancel while the rename runs, but Escape still closes the dialog (onCancel, :2524). Another memory can then be opened; the rename returns at :1796 and its finally (:1829) leaves the flag at "rename-section", with the same disabled controls as the Undo.

Reproduced in the browser suite by holding each request's answer, opening a memory (or pressing Escape for Rename detail), then releasing it: the reopened memory keeps its old title (30 s timeout), Undo stays disabled (30 s timeout), no list request follows the delete, and the Rename detail dialog closes on Escape.

Steps to reproduce

Slow the network in the browser's developer tools so each request takes a few seconds.

Undo archive:

  1. Choose Select, tick two memories, and choose Archive. Then press Undo.
  2. Before the Undo finishes, open another memory.
  3. The Select toolbar, each row's Archive and Delete, and Undo stay disabled.

Save:

  1. Open a memory, change its title and press Save.
  2. Before the save finishes, open the same memory from the list and choose "Discard and continue".
  3. The memory shows its title from before the save, and the Save button reads "Saving". Edit it: Save stays disabled.

Permanent delete:

  1. Choose Select, tick two memories, choose Delete and confirm.
  2. Before the deletion finishes, open one of the two memories.
  3. The deleted memories stay in the list, still ticked, and the one you opened stays open. Saving it fails.

Rename detail:

  1. Open a memory, choose Rename detail on one of its details, type a new name and choose Save detail name.
  2. Before the rename finishes, press Escape: the dialog closes. Open another memory.
  3. The Select toolbar, each row's Archive and Delete, Remove detail, Rename detail and Undo stay disabled.

Minimal fix

One PR, patch bump, client only: C/vault/MemoryVault.tsx. The same pattern as the bulk-change fix: what belongs to the whole vault runs whatever was opened meanwhile; the notice and error stay with the old session.

  • Undo archive: drop the early return, so the rollback and the reload always run. Keep the bulk-change fix's reload of the restored memories (refreshAfterBatch), and check the session after it, before the notice. Clear the Undo only if it is still the one that ran (setArchiveUndo((current) => (current === recovery ? null : current))). Clear the busy flag with the functional form the delete path uses, setBusy((current) => (current === "undo-archive" ? "" : current)).
  • Save: when the session changed, set the save state back to idle and reload with refreshAfterBatch([saved memory id]): the lists, and the open memory if it is the one just saved, so a memory reopened during its own save shows what was saved. Then return as before. Clear the flag with the functional form.
  • Permanent delete: drop the early return. Check the memory that is open now (draftRef.current) when closing a deleted one. Reload the lists, then show the notice for the same session, or when the deletion closed the open memory.
  • Rename detail: the dialog's onCancel returns while busy, like its disabled Cancel button. renameSection itself is unchanged: with the dialog kept open, the vault behind it cannot open another memory while the rename runs.
  • CHANGELOG under ## Unreleased: "In the Memory Vault, opening another memory while an archive Undo, a save or a permanent delete is still running no longer leaves it half-finished: the buttons work again, the list reloads, an Undo that could only restore some memories archives them again, a memory reopened during its own save shows what was saved, and deleted memories leave the list and the selection, closing one you had opened with a message that says so. Escape no longer closes the Rename detail dialog while the rename is still running."

Not included

  • Apart from the delete message for a memory the deletion closed, the notice or error of an action that answers after another memory was opened is not shown, as for bulk changes. A partly failed Undo then shows no error; its Undo button stays, enabled, to try again.
  • A memory reopened during its own save and edited before the save answers keeps those edits and takes only the saved availability and version, as after a bulk change. Its other fields stay as they were before the save, so saving it writes the old title back, as any edit made over an older copy does. The version check on save proposed with the bulk-change fix would cover it.
  • A save that answers after you chose "Discard and continue" still stored its changes; only the editor drops them, as before. If the memory came from a rejected suggestion, that suggestion is not removed.

Regression proof

In tests/long-term-memory-browser.regression.ts:

  • Save: after the existing availability checks, the test holds the memory's PATCH, edits its title and presses Save, reopens the same memory with "Discard and continue", then releases the answer. It expects the reopened memory to show the saved title, Save to read "Save" again and to be enabled after an edit, and a new list request.
  • Rename detail: the test holds the rename request, presses Escape while it runs, and expects the dialog to stay open; after the answer it closes.
  • Undo archive: after the existing partial-failure Undo, the test holds both restore requests, presses Undo again, opens one of the two memories, then releases them. It expects Undo to be enabled again and the rollback request (archived for the restored memory) to have been sent.
  • Permanent delete: in the existing confirmed delete, with another memory open, the test holds the deletion, opens one of the deleted memories, then releases it. It expects a new list request, the deleted memories unticked, the opened memory closed and the "2 memories deleted." notice.
  • Each part of the fix was removed in turn, and the suite failed each time, except three guards that need timing the browser test cannot produce: the Undo's current === recovery check, the Undo notice's session check, and the delete notice's session check for a deletion that did not close the open memory.

Environment

  • Marinara Engine version: 2.5.1 (staging 87d1ccadc)
  • Package version: long-term-memory 1.4.72 (upstream/staging bcaebd07d)
  • Install type: source (code reading and the local browser suite)
  • OS + version: Linux 6.8 (Ubuntu); not platform-specific
  • Browser or app shell: any (reproduced in Playwright Chromium)

Logs, screenshots, or video

From the browser suite with each answer held, each action without its fix:

Save (reopened memory never shows the saved title):
page.waitForFunction: Timeout 30000ms exceeded.

Undo archive:
locator.waitFor: Timeout 30000ms exceeded.
  - waiting for locator('[data-ltm-vault-feedback] button:enabled').filter({ hasText: 'Undo' }) to be visible

Permanent delete:
AssertionError [ERR_ASSERTION]: the memory list reloads after the deletion

Rename detail:
AssertionError [ERR_ASSERTION]: Escape keeps the dialog open while the rename runs
0 !== 1

Additional context

Tracker item OT-11. Follow-up to #1535 (bulk change undone by the open memory), whose review found the same early return in these actions.

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 (Oct 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1544 Originally assigned to: @Promansis on GitHub. ## Summary In the Memory Vault, four actions stop half-way when you open another memory before they finish: Undo after an archive, Save, permanent Delete and Rename detail (whose dialog Escape closes while it runs). Depending on the action, the buttons stay disabled, the list keeps showing the old memories, a memory reopened during its own save shows the copy from before the save, deleted memories stay ticked and open, and a partly failed Undo does not put the memories it did restore back into the archive. ## Affected package `long-term-memory` 1.4.72 (`upstream/staging` bcaebd07d), which has the fix for bulk changes undone by the open memory (#1535; it adds `refreshAfterBatch` and reloads an open memory after an archive Undo), Memory Vault (client). `C` = `packages/long-term-memory/src/engine/packages/client/src/features/long-term-memory` ## Expected behavior When one of these actions finishes, the work that belongs to the whole vault is done, whatever memory you opened meanwhile: the busy state clears so the buttons work again, the list reloads, a partly failed Undo archives again the memories it restored, and deleted memories leave the selection. A memory you reopened while its own save ran shows what was saved. A deleted memory you opened closes, with the delete message that says why. Other messages (notices and errors) belong to the memory that was open when the action started, so they are not shown over the new one. The Rename detail dialog stays open while the rename runs, as its disabled Cancel button already intends, so Escape does not close it. ## Actual behavior Each action remembers the editor session when it starts, and when its request answers it returns at once if the session changed. Opening a memory, starting a new one, closing the editor or choosing a place all change the session. - **Undo archive** (`undoArchive`, `C/vault/MemoryVault.tsx:1441`): returns at `:1459`, and its `finally` clears the busy flag only for the same session (`:1508`). After you open a memory during an Undo: - the flag stays "undo-archive", so the Select toolbar, each row's Archive and Delete, Remove detail, Rename detail and Undo stay disabled until another action such as a save resets it; - the lists do not reload; - if only some memories were restored, the rollback that archives them again (`:1481-1489`) is skipped, so the archive is left half-undone in storage. - **Save** (`save()`, `:1543`): returns at `:1626`, and its `finally` (`:1699`) clears the flag only for the same session. If you open a memory while a slow save runs and choose "Discard and continue", the flag stays "save" and the save state stays "saving": the button reads "Saving", and Save stays disabled for every memory until you leave the Vault. The list is not reloaded, so it keeps the copy from before the save, and reopening the memory you were saving shows that old copy. - **Permanent delete** (`deleteSelected`, `:1703`): returns at `:1708`. The flag does clear (the caller's `finally`, `:1914`), but the selection clear, closing a deleted open memory, the notice and the list reload (`:1728`) are skipped. The deleted memories stay listed and ticked; a deleted memory you opened meanwhile stays open and fails to save; a later bulk action reports the deleted ids as failed. The open-memory check also reads the memory that was open when the delete started (`draft` at `:1715`), not the one open now. - **Rename detail** (`renameSection`, `:1772`): its dialog disables Cancel while the rename runs, but Escape still closes the dialog (`onCancel`, `:2524`). Another memory can then be opened; the rename returns at `:1796` and its `finally` (`:1829`) leaves the flag at "rename-section", with the same disabled controls as the Undo. Reproduced in the browser suite by holding each request's answer, opening a memory (or pressing Escape for Rename detail), then releasing it: the reopened memory keeps its old title (30 s timeout), Undo stays disabled (30 s timeout), no list request follows the delete, and the Rename detail dialog closes on Escape. ## Steps to reproduce Slow the network in the browser's developer tools so each request takes a few seconds. Undo archive: 1. Choose Select, tick two memories, and choose Archive. Then press Undo. 2. Before the Undo finishes, open another memory. 3. The Select toolbar, each row's Archive and Delete, and Undo stay disabled. Save: 1. Open a memory, change its title and press Save. 2. Before the save finishes, open the same memory from the list and choose "Discard and continue". 3. The memory shows its title from before the save, and the Save button reads "Saving". Edit it: Save stays disabled. Permanent delete: 1. Choose Select, tick two memories, choose Delete and confirm. 2. Before the deletion finishes, open one of the two memories. 3. The deleted memories stay in the list, still ticked, and the one you opened stays open. Saving it fails. Rename detail: 1. Open a memory, choose Rename detail on one of its details, type a new name and choose Save detail name. 2. Before the rename finishes, press Escape: the dialog closes. Open another memory. 3. The Select toolbar, each row's Archive and Delete, Remove detail, Rename detail and Undo stay disabled. ## Minimal fix One PR, patch bump, client only: `C/vault/MemoryVault.tsx`. The same pattern as the bulk-change fix: what belongs to the whole vault runs whatever was opened meanwhile; the notice and error stay with the old session. - **Undo archive**: drop the early return, so the rollback and the reload always run. Keep the bulk-change fix's reload of the restored memories (`refreshAfterBatch`), and check the session after it, before the notice. Clear the Undo only if it is still the one that ran (`setArchiveUndo((current) => (current === recovery ? null : current))`). Clear the busy flag with the functional form the delete path uses, `setBusy((current) => (current === "undo-archive" ? "" : current))`. - **Save**: when the session changed, set the save state back to idle and reload with `refreshAfterBatch([saved memory id])`: the lists, and the open memory if it is the one just saved, so a memory reopened during its own save shows what was saved. Then return as before. Clear the flag with the functional form. - **Permanent delete**: drop the early return. Check the memory that is open now (`draftRef.current`) when closing a deleted one. Reload the lists, then show the notice for the same session, or when the deletion closed the open memory. - **Rename detail**: the dialog's `onCancel` returns while busy, like its disabled Cancel button. `renameSection` itself is unchanged: with the dialog kept open, the vault behind it cannot open another memory while the rename runs. - **CHANGELOG under `## Unreleased`**: "In the Memory Vault, opening another memory while an archive Undo, a save or a permanent delete is still running no longer leaves it half-finished: the buttons work again, the list reloads, an Undo that could only restore some memories archives them again, a memory reopened during its own save shows what was saved, and deleted memories leave the list and the selection, closing one you had opened with a message that says so. Escape no longer closes the Rename detail dialog while the rename is still running." **Not included** - Apart from the delete message for a memory the deletion closed, the notice or error of an action that answers after another memory was opened is not shown, as for bulk changes. A partly failed Undo then shows no error; its Undo button stays, enabled, to try again. - A memory reopened during its own save and edited before the save answers keeps those edits and takes only the saved availability and version, as after a bulk change. Its other fields stay as they were before the save, so saving it writes the old title back, as any edit made over an older copy does. The version check on save proposed with the bulk-change fix would cover it. - A save that answers after you chose "Discard and continue" still stored its changes; only the editor drops them, as before. If the memory came from a rejected suggestion, that suggestion is not removed. ## Regression proof In `tests/long-term-memory-browser.regression.ts`: - **Save**: after the existing availability checks, the test holds the memory's `PATCH`, edits its title and presses Save, reopens the same memory with "Discard and continue", then releases the answer. It expects the reopened memory to show the saved title, Save to read "Save" again and to be enabled after an edit, and a new list request. - **Rename detail**: the test holds the rename request, presses Escape while it runs, and expects the dialog to stay open; after the answer it closes. - **Undo archive**: after the existing partial-failure Undo, the test holds both restore requests, presses Undo again, opens one of the two memories, then releases them. It expects Undo to be enabled again and the rollback request (`archived` for the restored memory) to have been sent. - **Permanent delete**: in the existing confirmed delete, with another memory open, the test holds the deletion, opens one of the deleted memories, then releases it. It expects a new list request, the deleted memories unticked, the opened memory closed and the "2 memories deleted." notice. - Each part of the fix was removed in turn, and the suite failed each time, except three guards that need timing the browser test cannot produce: the Undo's `current === recovery` check, the Undo notice's session check, and the delete notice's session check for a deletion that did not close the open memory. ## Environment - Marinara Engine version: 2.5.1 (`staging` 87d1ccadc) - Package version: long-term-memory 1.4.72 (`upstream/staging` bcaebd07d) - Install type: source (code reading and the local browser suite) - OS + version: Linux 6.8 (Ubuntu); not platform-specific - Browser or app shell: any (reproduced in Playwright Chromium) ## Logs, screenshots, or video From the browser suite with each answer held, each action without its fix: ``` Save (reopened memory never shows the saved title): page.waitForFunction: Timeout 30000ms exceeded. Undo archive: locator.waitFor: Timeout 30000ms exceeded. - waiting for locator('[data-ltm-vault-feedback] button:enabled').filter({ hasText: 'Undo' }) to be visible Permanent delete: AssertionError [ERR_ASSERTION]: the memory list reloads after the deletion Rename detail: AssertionError [ERR_ASSERTION]: Escape keeps the dialog open while the rename runs 0 !== 1 ``` ## Additional context Tracker item OT-11. Follow-up to #1535 (bulk change undone by the open memory), whose review found the same early return in these actions. ## 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-22 04:02:52 +07:00
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#1516
No description provided.