Repository navigation
fix(ai-vault): prune remote OpenClaw discovery - #11395
Turtle-Hwan wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change adds directory-level notice callbacks to local and remote session scanners. OpenClaw sources now descend only into each agent’s canonical Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to OpenClaw discovery now limits scanning to canonical session directories while retaining nested session archives and reporting pruned transcript content. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/ai-vault/remote-session-scanner.test.ts (1)
261-269: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover recursion inside the canonical
sessionssubtree.The fixture only places the valid JSONL directly under
main/sessions. Add a transcript below a nested directory there and assert it is discovered; otherwise a regression that stops recursion atsessionswould still pass, despite the requirement to preserve recursive discovery.Based on the PR objective to preserve recursive JSONL discovery within the canonical
sessionssubtree.Also applies to: 280-285
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 998f1362-9dc4-4745-95b4-fea58ed46e6d
📒 Files selected for processing (2)
src/main/ai-vault/remote-session-scanner-sources.tssrc/main/ai-vault/remote-session-scanner.test.ts
Greptile SummaryThis PR fixes excessive remote filesystem traversal in the OpenClaw discovery path by adding a
Confidence Score: 5/5Safe to merge — the change narrows traversal scope with no risk of dropping legitimate sessions. The predicate logic is correct at every depth: agent dirs (depth 0) are always entered, sessions is the only allowed entry at depth 1, and traversal inside sessions/ (depth 2+) is completely unrestricted. The regression test validates both discovered session IDs and the exact set of directories visited. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/main/ai-vault/remote-session-scanner-sources.ts | Switches remoteOpenClawSources from jsonlSource to source, adds ['.jsonl'] explicitly, and introduces a directoryPredicate that prunes all depth-1 siblings of "sessions" while leaving agent-level (depth 0) and deeper (depth 2+) traversal unrestricted. |
| src/main/ai-vault/remote-session-scanner.test.ts | Adds a regression test that verifies the canonical sessions subtree is walked (including date subdirectories) while nested agent homes (e.g. agent/codex-home/sessions) are never entered; a new messageGraphTranscript helper supplies parseable JSONL content for OpenClaw/Pi/OMP format tests. |
Reviews (2): Last reviewed commit: "test(ai-vault): cover recursion inside t..." | Re-trigger Greptile
|
looking into it |
Review feedback. The fixture only placed a transcript directly under main/sessions, so a regression that stopped recursing at sessions would still have passed. Add one under a date directory and assert both the transcript and the nested readdir.
|
Addressed the review nitpick in 13462cc. The fixture placed its only valid transcript directly under |
- Apply the same per-agent `sessions` directory predicate to the local OpenClaw source (local host and every WSL home) so local and SSH discovery agree for the same tree; shared in session-scanner-openclaw-layout.ts. - Emit a 'notice' scan issue when an agent directory is pruned but holds transcripts outside <agent>/sessions, on both local and remote hosts. - Regression tests: session-scanner-openclaw-prune.test.ts (local + WSL) and a pruned-archive case in remote-openclaw-discovery.test.ts.
|
Parking this for now — needs more thought, and it is not a priority. Reviewed with the full readiness checklist and adversarially verified; no correctness defect was found. What is holding it is a deliberate product trade-off, not a bug, so it wants a decision rather than another round of patching. The trade-off: the fix restricts OpenClaw discovery to each agent's canonical So: which is worse, an asymmetry between local and SSH, or uniform invisibility of relocated transcripts? A third option worth considering is keeping the fast canonical walk but emitting a scan issue when an agent directory containing candidate JSONL is pruned, so rows do not vanish silently. Relay note for whoever picks this up: the host runs the scan, so a server that updates ahead of its clients silently narrows what every paired client sees, including older ones — no wire change involved, only published content. See |
|
Thanks for putting this together, and sorry for the slow turnaround. The area has since been reworked and this is now covered on main by #27089 (bounded OpenClaw session discovery), so we're closing this as superseded. If you still see the problem on the latest build, please open a fresh report or reopen with a current repro. Thanks for the PR. |
ELI5
When loading OpenClaw history over SSH, Orca now searches the standard session folders while skipping unrelated caches. This avoids unnecessary directory scans and keeps the supported session history available.
Details
SSH AI Vault history scanned every subtree under
.openclaw/agentsand.clawdbot/agents, including embedded Codex homes and sibling caches. A fixture with 512 cache branches required 1,540 directory listings and exposed unrelated JSONL as OpenClaw history. Discovery now lists three directories for that fixture and returns only its canonical session.Keep every agent directory, then descend only into its
sessionssubtree. Recursion within that subtree remains intact. The existing source/walker handles paths, cancellation and errors; unreadable canonical directories still report an issue while healthy agents remain visible. This covers current and legacy JSONL archive locations. It does not add support for OpenClaw's newer SQLite transcript store.Fixes #11394.
Validation against main
ef6eeab26e4a2ba817b19e8d68b37546f58d293e:ORCA_BACKGROUND_LAUNCH=1.The original contributor history is preserved and current main is merged into this branch. No rendered UI change or Electron launch. The remote provider owns all filesystem reads; this changes no RPC fields or process-status decisions. Existing scope-path handling supports folder workspaces as well as Git worktrees.
Supported folders and compatibility
Compatibility requires preserving the standard supported JSONL archive folders:
~/.openclaw/agents/<agent>/sessions/**and legacy~/.clawdbot/agents/<agent>/sessions/**, including every agent and nested archives. The implementation and regression tests preserve both.Manually relocated JSONL archives outside an agent's standard
sessionssubtree are no longer discovered by this scan. Their files are not deleted. Canonical nested session archives remain included; custom archive locations would need explicit support.