openclaw - ✅(Solved) Fix [Bug]: Wiki Bridge deletes all sources when memory plugin artifacts unavailable [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#67658Fetched 2026-04-17 08:29:56
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
referenced ×2commented ×1cross-referenced ×1

Wiki Bridge mode incorrectly deletes all imported sources when the memory plugin is not exporting public artifacts.

Error Message

{"type":"ingest","timestamp":"2026-04-16T12:05:13.587Z","details":{"sourceType":"memory-bridge","workspaces":5,"artifactCount":73,"importedCount":43,"removedCount":0}}
{"type":"ingest","timestamp":"2026-04-16T12:05:18.869Z","details":{"sourceType":"memory-bridge","workspaces":0,"artifactCount":0,"importedCount":0,"updatedCount":0,"skippedCount":0,"removedCount":73}}

Root Cause

Wiki Bridge mode incorrectly deletes all imported sources when the memory plugin is not exporting public artifacts.

Fix Action

Fixed

PR fix notes

PR #67711: fix(memory-wiki): skip bridge prune when capability unavailable but sources intact [AI-assisted]

Description (problem / solution / changelog)

AI-assisted: yes (Antigravity / Gemini).

Summary

Fixes #67658.

When syncMemoryWikiBridgeSources runs and listActiveMemoryPublicArtifacts returns an empty array (because the memory plugin capability is temporarily unregistered or unavailable), ctiveKeys ends up as an empty Set. The subsequent call to pruneImportedSourceEntries then marks every existing group=bridge state entry as stale and deletes the corresponding wiki pages — even though the underlying source files are still on disk.

Root cause

ridge.ts conflates two distinct situations:

  1. Transient capability outage — plugin not loaded this cycle, source files still exist
  2. Genuine source deletion — artifact removed, source files also gone

Both produce an empty rtifacts list, but only case 2 should trigger pruning.

Fix

Before calling pruneImportedSourceEntries, check whether the empty artifacts list coincides with existing bridge entries whose source files are still accessible on disk. If at least one source file is reachable via s.access, skip the prune entirely ( emovedCount = 0). When all source files are also gone, pruning proceeds as before.

` s // Guard: skip pruning when capability is temporarily unavailable but // source files still exist on disk. (#67658) const existingBridgeSourcePaths = Object.values(state.entries) .filter((entry) => entry.group === 'bridge') .map((entry) => entry.sourcePath);

const shouldSkipPrune = artifacts.length === 0 && existingBridgeSourcePaths.length > 0 && (await Promise.any( existingBridgeSourcePaths.map((p) => fs.access(p).then(() => true)), ).catch(() => false)); `

Tests

Two new regression tests added to ridge.test.ts:

| Scenario | emovedCount | Pages on disk | |---|---|---| | Capability lost, source files still exist |

Changed files

  • extensions/memory-wiki/src/bridge.test.ts (modified, +145/-0)
  • extensions/memory-wiki/src/bridge.ts (modified, +28/-6)

Code Example

First call (works): 73 artifacts → 74 sources ✓
Second call (fails): 0 artifacts → removedCount: 73
---

{"type":"ingest","timestamp":"2026-04-16T12:05:13.587Z","details":{"sourceType":"memory-bridge","workspaces":5,"artifactCount":73,"importedCount":43,"removedCount":0}}
{"type":"ingest","timestamp":"2026-04-16T12:05:18.869Z","details":{"sourceType":"memory-bridge","workspaces":0,"artifactCount":0,"importedCount":0,"updatedCount":0,"skippedCount":0,"removedCount":73}}
RAW_BUFFERClick to expand / collapse

Description

Wiki Bridge mode incorrectly deletes all imported sources when the memory plugin is not exporting public artifacts.

Steps to reproduce

  1. Configure memory-wiki plugin in bridge mode (vaultMode: bridge, bridge.enabled: true)
  2. Run openclaw wiki bridge import - works and imports artifacts (e.g., 73 sources)
  3. Gateway restarts (or memory plugin capability re-initializes)
  4. Run openclaw wiki bridge import again - reads 0 artifacts
  5. Result: all previously imported sources are deleted (removedCount: 73)

Expected behavior

When artifacts are unavailable, Bridge should not delete existing sources. It should either:

  • Skip the import, or
  • Keep existing sources until new ones are confirmed imported

Actual behavior

Each subsequent call after capability loss removes all bridge sources:

First call (works): 73 artifacts → 74 sources ✓
Second call (fails): 0 artifacts → removedCount: 73 ✗

Environment

  • OpenClaw: 2026.4.14
  • macOS: 26.4.1 (arm64)
  • memory-wiki: loaded
  • memory-core: loaded

Logs

{"type":"ingest","timestamp":"2026-04-16T12:05:13.587Z","details":{"sourceType":"memory-bridge","workspaces":5,"artifactCount":73,"importedCount":43,"removedCount":0}}
{"type":"ingest","timestamp":"2026-04-16T12:05:18.869Z","details":{"sourceType":"memory-bridge","workspaces":0,"artifactCount":0,"importedCount":0,"updatedCount":0,"skippedCount":0,"removedCount":73}}

Suggestion

Add a check before deleting: if artifactCount === 0 and existingSources > 0, warn and skip deletion.

extent analysis

TL;DR

Implement a conditional check to prevent deletion of existing sources when no new artifacts are available.

Guidance

  • Review the memory-wiki plugin's bridge mode implementation to identify where the deletion logic is triggered when artifactCount is 0.
  • Add a conditional check to verify if existingSources > 0 before deleting sources, and skip deletion if true.
  • Consider adding a warning or log message when this condition is met to alert administrators of potential issues.
  • Test the updated implementation to ensure it correctly handles cases where artifactCount is 0 and existingSources is greater than 0.

Example

if (artifactCount === 0 && existingSources > 0) {
  console.warn('No new artifacts available, skipping deletion of existing sources');
  // Skip deletion logic
} else {
  // Existing deletion logic
}

Notes

This solution assumes that the existingSources variable is available and accurately reflects the number of existing sources. Additional testing and verification may be necessary to ensure the updated implementation works as expected in all scenarios.

Recommendation

Apply workaround: Implement the conditional check to prevent deletion of existing sources when no new artifacts are available, as this directly addresses the reported issue and prevents data loss.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When artifacts are unavailable, Bridge should not delete existing sources. It should either:

  • Skip the import, or
  • Keep existing sources until new ones are confirmed imported

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Wiki Bridge deletes all sources when memory plugin artifacts unavailable [1 pull requests, 1 comments, 2 participants]