Repository navigation
refactor(fs): reuse prefix resolution and bounded reads - #150414
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 11:03 PM ET / September 17, 2026, 03:03 UTC (Revision 6). ClawSweeper reviewWhat this changesReuses shared filesystem helpers for database-path matching and four plugin readers, extends ownership coverage, and stabilizes two test fixtures without intended user-visible changes. Merge readiness✅ Ready for maintainer review This maintainer-requested consolidation remains useful and is not implemented on current main. No actionable defects were found, and the previous UI prerequisite no longer blocks this branch. Priority: P3 Review scores
Verification
How this fits togetherDatabase-path matching determines which agent owns a session database. Shared file readers supply bounded attachment, transcript, Memory Wiki, and QA preview content while callers retain their existing access checks and handle cleanup. flowchart TD
A[Stored database paths] --> B[Shared path resolution]
B --> C[Existing ownership rules]
C --> D[Agent session database]
E[Opened plugin files] --> F[Shared bounded readers]
F --> G[Attachments and text content]
F --> H[Caller cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -86, Tests +38, Docs 0, Other 0. Total -48 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep filesystem traversal and bounded reads owned by fs-safe, with OpenClaw retaining its caller-specific ownership, limits, errors, and cleanup contracts. Do we have a high-confidence way to reproduce the issue? Not applicable to the central refactor: duplicated implementations are directly visible in current main. The PR separately records reproductions for its two fixture repairs. Is this the best way to solve the issue? Yes. Reusing the pinned dependency through the existing private filesystem facade removes competing implementations while preserving caller-specific behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9ca2d1dfcd16. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
CI follow-up: the registry assertion count is now reduced from 7 to 5, matching the deleted implementation. No baseline was raised. The plugin skill bounded-read fixture also failed on unchanged base The UI budget failure is inherited: paired builds of exact CI merge |
d17d704 to
2a0e85c
Compare
Write the scratch path to a sibling file before exposing the readiness marker. Preserve the existing budget and cache assertions while preventing the parent from observing an empty path during the child write.
2a0e85c to
00d98d9
Compare
|
Merged via squash.
|
) * refactor(fs): reuse prefix resolution and bounded reads * chore(fs): shrink registry assertion baseline * test(update): publish budget fixture readiness atomically Write the scratch path to a sibling file before exposing the readiness marker. Preserve the existing budget and cache assertions while preventing the parent from observing an empty path during the child write.
Related: #147473
What Problem This Solves
OpenClaw maintains filesystem path resolution and borrowed-file read loops already supplied by its pinned fs-safe dependency.
User Impact
No intended user-visible change. Registered database paths retain their existing owner, including repeated separators in stored locators and raw dangling-symlink targets. Plugin reads retain their byte limits, short-read handling, truncation errors, UTF-8 preview boundaries, and caller-owned descriptor lifetime. Schemas and on-disk formats are unchanged; no migration is needed.
Why This Change Was Made
Use
resolvePathPrefixSyncfor the registry's missing-path fallback, and shared bounded/positional readers for iMessage attachments, Memory Wiki Notes recovery, QA evidence previews, and Anthropic transcript paging. The existing private filesystem SDK facade supplies the plugin helpers. This removes 86 production lines and 50 lines overall, using the fs-safe 0.13.1 version already adopted in #150263.The registry retains its existing-file fast path, per-operation identity cache, Unicode/suffix probing, and ambiguity policy. Its input adapter collapses locator separator runs while preserving physical
..traversal and raw expanded symlink-target suffixes.Validation also exposed an inherited updater-test race: the parent could see its ready marker before the scratch path had been written. The fixture now writes a sibling file and renames it into place, preserving its waits, budget assertions, and subprocess cleanup.
Evidence
pnpm build, explicit changed-file checks, and the marker's focused formatting/lint checks passed. Independent Codex P0–P2 reviews found no actionable findings. Retained filesystem production and ownership-test bytes match the built/live-tested revisiond25f550abc46913fd813021942da0681245b0593.pnpm openclaw sessions --all-agents --json, passed with isolated synthetic config/state. An existingfuture//shared.sqliteregistry row resolved to its registeredopsowner while the missing directory stayed absent. Registry/config bytes were unchanged; V8 coverage confirmed six executions of both the shared resolver call and fs-safe's missing-prefix return.00d98d99d7dcf7e062929ed98ec2701ec0723341.