fix: clear stale accepted commit marker after deleting local IndexedDB caches

When users delete local BME IndexedDB via UI actions (delete current/all
IDB), the chat metadata's st_bme_commit_marker was not cleared. This left
an accepted high-revision promise with no local DB backing, causing
persist-mismatch:indexeddb-behind-commit-marker and blocking graph load
indefinitely.

- index.js: add clearCurrentChatCommitMarker() helper and expose via runtime
- ui-actions-controller.js: call clearCurrentChatCommitMarker before
  syncGraphLoadFromLiveContext after IDB deletion
- p0-regressions.mjs: regression test asserting marker is cleared before
  reload after current-IDB deletion
This commit is contained in:
Youzini-afk
2026-04-12 20:06:51 +08:00
parent 4643e0ad75
commit 05083ef5f0
3 changed files with 134 additions and 0 deletions

View File

@@ -1193,6 +1193,10 @@ export async function onDeleteCurrentIdbController(runtime) {
});
}
runtime.clearCachedIndexedDbSnapshot?.(chatId);
runtime.clearCurrentChatCommitMarker?.({
reason: "manual-delete-current-idb",
immediate: true,
});
runtime.syncGraphLoadFromLiveContext?.({
source: "manual-delete-current-idb",
force: true,
@@ -1245,6 +1249,10 @@ export async function onDeleteAllIdbController(runtime) {
runtime.clearAllCachedIndexedDbSnapshots?.();
const activeChatId = runtime.getCurrentChatId?.();
if (activeChatId) {
runtime.clearCurrentChatCommitMarker?.({
reason: "manual-delete-all-idb",
immediate: true,
});
runtime.syncGraphLoadFromLiveContext?.({
source: "manual-delete-all-idb",
force: true,