Repository navigation
fix(memory-wiki): read exact canonical wiki pages without scanning the vault - #116374
sloptop-the-terrible wants to merge 3 commits into
Conversation
|
Codex review: blocked before merge. Reviewed August 17, 2026, 12:24 PM ET / 16:24 UTC. ClawSweeper reviewWhat this changesThis PR adds a direct read path for exact, canonical Memory Wiki page lookups and tests that it avoids unrelated vault reads and static directory symlinks. Merge readiness⛔ Blocked before merge - 10 items remain Keep open: current main still lacks the exact-path fast path, but this PR retains the prior P1 security finding because its raw read can race with the preceding symlink check. Priority: P1 Review scores
Verification
How this fits togetherMemory Wiki serves page content to agent tools from a local vault. A lookup is validated, resolved against visibility rules, then returned as page content or falls back to digest and vault scanning. flowchart LR
A[Wiki page lookup] --> B[Memory Wiki query]
B --> C{Canonical vault path?}
C -->|Yes| D[Direct page reader]
C -->|No| E[Digest or vault scan]
D --> F[Visibility and lookup match]
E --> F
F --> G[Page content to agent]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The new direct filesystem read has a concrete time-of-check/time-of-use vault-escape risk. PR surfaceSource +61, Tests +67. Total +128 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the exact-path optimization, but read through the existing root-bounded plugin API and prove a controlled file or parent-directory swap cannot escape the vault. Do we have a high-confidence way to reproduce the issue? Yes. A vault with a readable target and an unrelated unreadable page reproduces the current-main failure; the PR also supplies a before/after real-vault transcript, though this read-only review did not rerun it. Is this the best way to solve the issue? No. Bypassing enumeration is the right repair, but a raw read after a separate realpath check is not the safest implementation; the existing root-bounded reader owns this invariant. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 49af98c12bb4. LabelsLabel justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
6c4539b to
6088f17
Compare
|
After-fix exact-head proof (
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7822c59 to
ac7b5b7
Compare
|
@clawsweeper re-review The current head adds an external-directory-symlink containment regression test, and the PR body now includes no-mock before/after proof from an unprivileged real-vault run: current main fails the exact read on an unrelated EACCES page, this branch returns the target, and the outside-vault symlink remains unreadable. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1ce0b22 to
141e9df
Compare
|
Rebased onto current
No code changes in this refresh; the rebase applied without conflict. |
|
Curious what maintainers think here. Reading the exact canonical wiki page directly is a lot cleaner than scanning the whole vault for it. |
141e9df to
776f469
Compare
|
Rebased onto latest @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…e vault wiki.get resolved every lookup by enumerating and parsing all queryable vault dirs, so an exact page path paid whole-vault I/O and failed outright when an unrelated page was unreadable (readQueryableWikiPagesByPaths runs with stopOnError). Canonical vault-relative Markdown paths now resolve with a single read after validating the queryable dir, rejecting traversal, empty segments and symlinked targets; digest and enumeration stay the fallback for claim ids, titles and ambiguous basenames. Fixes openclaw#116048
5c08bee to
32d85c9
Compare
Read canonical pages through the shared rooted reader while preserving compiled claim precedence, large pages, hardlinks, visibility and missing-path fallbacks. Skip deleted compiled candidates without suppressing filesystem boundary errors. Reuse reconciled cache owners during ordinary initialization and activate local source sync before checking dashboard readiness. Retain cold and explicit lifecycle source validation, vault replacement fencing and publication checks. Cover reader contracts, stale candidates, lifecycle reuse and rollback with real filesystem and SQLite regressions. Document cold CLI activation costs. Fixes openclaw#116048. Related openclaw#116374; thanks @sloptop-the-terrible for the original reproduction and direct-read direction. Co-authored-by: Brian Snyder <[email protected]>
|
Superseded by merged #129897, commit 47b8889. Thank you for the original reproduction and direct-read direction; that credit is preserved in the landed PR. The landed implementation uses the rooted opened-file reader across exact and scanned paths, preserves compiled-claim precedence and the existing large-file/hardlink contract, and also removes repeated warm lifecycle validation. It passed 510 Memory Wiki tests, hosted CI and real CLI/Gateway proof on a 5,001-page synthetic vault, including an unreadable-neighbor case. Cold snapshot validation remains intentional and documented. Closing this overlapping candidate now that the verified replacement is on main. |
What Problem This Solves
wiki.getresolved exact canonical page paths by enumerating and parsing the whole MemoryWiki vault. Because that scan uses
pMap(..., { stopOnError: true }), one unrelatedunreadable page could reject a read whose target was valid and readable.
Why This Change Was Made
Exact queryable paths now take a bounded direct-read path before the existing digest and
full-scan fallbacks:
free of empty/traversal segments, and not an
index.md;intermediate-directory symlinks just as the scanner's
symlinkPolicy: "skip"does;page before it is returned.
Missing, malformed, fuzzy, claim-id, non-visible, reserved, or noncanonical lookups retain
the existing digest-then-scan behavior.
User Impact
An operator reading
sources/example.mdgets one bounded page read instead of a whole-vaultscan. The read succeeds even if an unrelated page is temporarily unreadable. Fuzzy/title
lookups and visibility behavior are unchanged, and direct reads cannot follow a path the
scanner would skip.
Evidence
Focused current-head suite:
The suite proves that an exact path does not enumerate an unrelated failing page and that
a directory symlink to a valid page outside the vault returns
null.A no-mock real-vault transcript also ran the public query entry point as an unprivileged
effective user. The requested page was readable, an unrelated Markdown page was root-only
and deterministically returned EACCES if scanned, and a queryable-directory symlink pointed
to a valid page outside the vault.
Before the patch on current
main:{ "exactLookup": { "status": "error", "code": "EACCES" }, "externalSymlinkLookup": null }At this PR's current head:
{ "exactLookup": { "status": "returned", "path": "sources/alpha.md", "containsExpected": true }, "externalSymlinkLookup": null }This reproduces the availability failure before the patch, proves the exact read after the
patch, and independently confirms that the fast path does not cross the scanner's symlink
boundary.
Fixes #116048