Repository navigation
fix(agents): preserve survivor-owned databases offline - #129085
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 3:54 AM ET / 07:54 UTC. ClawSweeper reviewWhat this changesThis PR prevents offline agent deletion from moving a journaled database to Trash when that database lies inside another configured agent’s directory. Merge readinessThe patch follows the Gateway’s established survivor-ownership boundary and its focused regression covers the reported offline path. Keep it open for a rebase onto current main and exact-head validation; the protected Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherWhen the Gateway is unavailable, the CLI deletes an agent from local config and uses its deletion journal to remove files. Before issuing Trash operations, it must preserve paths owned by surviving agents while still releasing the deleted agent’s registry state. flowchart LR
A[Offline delete command] --> B[Deletion journal paths]
C[Configured surviving agents] --> D[Directory ownership registry]
B --> E[Ownership and workspace filter]
D --> E
E --> F[Eligible files moved to Trash]
E --> G[Survivor-owned files preserved]
F --> H[Registry release and journal completion]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +10, Tests +14. Total +24 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:
Technical reviewBest possible solution: Rebase onto current main, retain the shared ownership predicate as the single policy boundary, and rerun the focused offline deletion tests on the rebased head. Do we have a high-confidence way to reproduce the issue? Yes, from source: with Gateway reachability failing, register a deleted agent database below a surviving agent directory and invoke offline deletion; the changed test encodes that path, though this read-only review did not execute it. Is this the best way to solve the issue? Yes, subject to an exact-head rebase check: the CLI now prepares surviving directories and reuses the Gateway’s existing ownership predicate rather than inventing a parallel rule. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7ba58abd93d6. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Landing proof for exact head Offline agent deletion previously filtered journaled database paths before preparing every surviving configured agent directory, so a deleted-agent database nested beneath a survivor's directory could incorrectly reach Trash. The fix prepares all surviving agent directories and reuses the canonical The pre-fix regression attempted to Trash that survivor-owned database. The corrected regression proves the path never reaches Trash and remains on disk while eligible external database cleanup still proceeds. Verification: ClawSweeper completed its exact-head review with no actionable findings and no security findings: #129085 (comment). Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/32819982867. Its earlier failure was an unrelated UI The optional rebase rank-up move was consciously skipped: current-main drift is advisory, the PR is mergeable without conflicts, and exact-head CI is green. Production delta +11/-1 (net +10); tests +17/-3 (net +14). Remaining proof gap: no real host Trash run; isolated boundary tests mock only Gateway reachability and the final Trash transport. |
|
Merged via squash.
|
Prepare surviving agent-directory ownership before filtering journaled SQLite paths, addressing the post-merge review of openclaw#129017. Refs openclaw#129014
Closes #129014
Follow-up to #129017.
What Problem This Solves
Fixes the remaining ownership gap in offline agent deletion: a database journaled for the deleted agent could be physically located beneath another configured agent's
agentDir. The first repair protected exact surviving database registrations and workspaces, but could still move this survivor-directory-owned file to Trash.Why This Change Was Made
Offline deletion now prepares every surviving configured agent directory in the existing process-local agent-directory registry before evaluating journaled database paths. It then applies the same
isPathOwnedByAnotherRegisteredAgentboundary used by Gateway deletion, so a path inside or overlapping a surviving agent directory is preserved.This is the focused correction requested by ClawSweeper's completed review of #129017. It does not change the journal schema, Gateway flow, or plugin-owned binding cleanup.
User Impact
Operators can delete agents offline without risking a database file stored under another surviving agent's state directory. Eligible external database files are still removed, while registry cleanup and journal completion retain the behavior landed in #129017.
Production LOC: +11/-1 (net +10) | Tests: +17/-3 (net +14)
Evidence
main's directory-containedops.sqlite.node scripts/run-vitest.mjs src/commands/agents.delete.test.ts— 17 passed.node scripts/run-vitest.mjs src/commands/agents.delete.workspace.test.ts— 10 passed.node scripts/check-changed.mjs -- src/commands/agents.commands.delete.ts src/commands/agents.delete.test.ts— passed after rebasing onto currentmain.A separate live CLI deletion was not run because the terminal action moves real host paths into Trash. The regression exercises isolated config, state SQLite, database registry, deletion journal, configured agent directories, and filesystem paths while mocking only Gateway reachability and the final Trash transport.