openclaw - ✅(Solved) Fix normalizeExtraMemoryPaths does not expand tilde (~) in extraPaths [1 pull requests, 1 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#58026Fetched 2026-04-08 01:54:47
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
referenced ×2cross-referenced ×1

Root Cause

expandHomePrefix() exists in the codebase (used elsewhere) but is not called in the normalizeExtraMemoryPaths() code path (query-expansion-BtWfVDLr.js).

Fix Action

Workaround

Use absolute paths in config:

"extraPaths": ["/Users/stevemini/OneDrive/MyVault"]

PR fix notes

PR #58050: fix(memory): expand tilde in extraMemoryPaths before path resolution

Description (problem / solution / changelog)

lobster-biscuit

Closes #58026 Also fixes #58027 (same root cause)

Problem

normalizeExtraMemoryPaths() does not expand ~/ before calling path.isAbsolute(). In Node.js, path.isAbsolute("~/OneDrive/MyVault") returns false because ~ is a shell expansion, not a filesystem absolute prefix. The path resolves to <workspace>/~/OneDrive/MyVault instead of /home/user/OneDrive/MyVault.

Root cause

packages/memory-host-sdk/src/host/internal.ts:70 — tilde paths are treated as relative and joined with workspaceDir.

User impact

Any user with memorySearch.extraPaths: ["~/MyVault"] gets an empty or wrong memory index. The resolved path doesn't exist, so no files are found. Affects Obsidian vault users, OneDrive users, and anyone using ~/ in their config.

Fix

Expand tilde via expandHomePrefix() (src/infra/home-dir.ts:81) before the isAbsolute check. This helper is already used in cron store path resolution and session store paths (G10: reuse existing helpers).

1 file, +2 lines (1 import + 1 map step).

How to verify

  1. Set memorySearch.extraPaths: ["~/Documents/notes"]
  2. openclaw memory index --force
  3. Before: resolves to <workspace>/~/Documents/notes (wrong). After: resolves to /home/user/Documents/notes (correct).

Tests

expandHomePrefix is tested in home-dir.test.ts. The fix adds it as a preprocessing step before the existing isAbsolute logic.

🤖 Generated with Claude Code

Changed files

  • packages/memory-host-sdk/src/host/internal.test.ts (modified, +7/-0)
  • packages/memory-host-sdk/src/host/internal.ts (modified, +2/-0)

Code Example

"extraPaths": ["~/OneDrive/MyVault"]

---

"extraPaths": ["/Users/stevemini/OneDrive/MyVault"]
RAW_BUFFERClick to expand / collapse

Bug

normalizeExtraMemoryPaths() in the memory search module does not expand ~/ prefixes in agents.defaults.memorySearch.extraPaths. The function uses path.isAbsolute() which returns false for ~/ paths, causing the path to be resolved relative to each agent's workspace directory.

Expected Behavior

"extraPaths": ["~/OneDrive/MyVault"]

Should resolve to /Users/<username>/OneDrive/MyVault for all agents.

Actual Behavior

The path resolves to something like ~/.openclaw/workspace-wine/~/OneDrive/MyVault, which doesn't exist. All agents report "additional memory path missing" and the vault is invisible to memory search.

Root Cause

expandHomePrefix() exists in the codebase (used elsewhere) but is not called in the normalizeExtraMemoryPaths() code path (query-expansion-BtWfVDLr.js).

Workaround

Use absolute paths in config:

"extraPaths": ["/Users/stevemini/OneDrive/MyVault"]

Environment

  • OpenClaw 2026.3.23-1
  • macOS (Darwin arm64)
  • Node.js v22.22.1

extent analysis

Fix Plan

To fix the issue, we need to modify the normalizeExtraMemoryPaths() function to expand ~/ prefixes in agents.defaults.memorySearch.extraPaths. We can achieve this by calling the existing expandHomePrefix() function.

Code Changes

// query-expansion-BtWfVDLr.js
const path = require('path');

function normalizeExtraMemoryPaths(extraPaths) {
  return extraPaths.map((extraPath) => {
    // Call expandHomePrefix() to expand ~/ prefixes
    const expandedPath = expandHomePrefix(extraPath);
    // Check if the path is absolute after expansion
    if (path.isAbsolute(expandedPath)) {
      return expandedPath;
    } else {
      // If not absolute, resolve relative to the user's home directory
      return path.resolve(os.homedir(), expandedPath);
    }
  });
}

Verification

To verify the fix, update the extraPaths configuration to use ~/ prefixes and check that the paths are correctly expanded and resolved. For example:

"extraPaths": ["~/OneDrive/MyVault"]

After applying the fix, the path should resolve to /Users/<username>/OneDrive/MyVault for all agents, and the "additional memory path missing" error should be resolved.

Extra Tips

  • Make sure to test the fix on different platforms and user configurations to ensure that the expandHomePrefix() function works correctly in all cases.
  • Consider adding unit tests to cover the normalizeExtraMemoryPaths() function and ensure that it behaves correctly for different input scenarios.

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…

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 normalizeExtraMemoryPaths does not expand tilde (~) in extraPaths [1 pull requests, 1 participants]