Repository navigation
fix(agents): show Doctor's restore-first warning before deleting a held store - #207290
Conversation
…ld store - agents delete reads Doctor's recorded recovery holds; the confirmation shows Doctor's guidance first, and --force prints it before proceeding. - Doctor's per-store held guidance moves unchanged into one formatter shared by Doctor and agents delete.
|
🦞👀 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: passed. What this changesThis PR shows Doctor’s existing restoration guidance before CLI deletion of an agent with held stores. Example: Doctor holds the registered store of an unconfigured agent named retired.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a warning gap still present on main, and source review found no actionable code defects. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe agent deletion CLI reads recovery holds from shared state, presents confirmation or forced-deletion warnings, then invokes the existing Gateway or offline deletion owner. flowchart TD
A[Operator CLI request] --> B[Agent deletion command]
C[Recorded Doctor holds] --> B
C --> D[Shared guidance formatter]
D --> E[Confirmation or stderr warning]
B --> E
E --> F[Gateway or offline deletion]
D --> G[Doctor diagnostics]
Technical reviewBest possible solution: Reuse Doctor’s guidance at the existing CLI confirmation boundary while preserving explicit deletion and its current lifecycle owner. Do we have a high-confidence way to reproduce the issue? Current main confirms deletion without consulting recovery holds; the added regression exercises that missing warning, and the body reports it failing on the base, but this read-only review ran no target code. Is this the best way to solve the issue? The shared formatter is appropriate because Doctor and deletion need identical advice, and the patch preserves the existing recovery receipt and deletion owners without adding state or permission gates. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7cbf17b5819b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +41, Tests +43. Total +84 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 28, 2026, 1:43 AM ET / 06:43 UTC. |
|
Maintainer override:
This PR changes only |
* commit '262f14aab89ca286633992760fa45aeeded998f9': (207 commits) fix(ui): remove redundant type argument from Board browser test (#207352) test(channels): distinguish status and batch fixtures (#207232) fix(ui): type the Board drop test mock as void (#207348) fix(ui): break the Skill Workshop import cycle (#207345) test(channels): expose label guard regressions (#207195) fix: explain when a previous automation run keeps the agent from starting (#207180) refactor(test): consolidate loader proof and repair rollback coverage (#207152) fix(agents): one tool-result bound on every route, untrusted-content wrapper intact (#207101) test(plugins): verify staged SDK named exports (#207170) fix(ui): truncate empty Compose hints on narrow screens (#207301) fix: keep unsent Cmd+K Compose drafts when reopened (#207307) fix: explain chat update errors when a session changes (#206419) fix(ios): keep consecutive commands on one line in chat (#207242) fix(ios): keep connection messages from flashing when chat reopens (#207233) fix(ios): give Sessions groups more breathing room (#207221) fix(ui): show chat completions as activity rows (#201891) fix(ui): make empty composer hints look distinct from drafts (#207295) fix: explain why chat won’t attach an empty file (#206402) fix(agents): show Doctor's restore-first warning before deleting a held store (#207290) test(channels): fix join failure proof and trim probe fixture (#207264) ...
* commit '262f14aab89ca286633992760fa45aeeded998f9': (207 commits) fix(ui): remove redundant type argument from Board browser test (#207352) test(channels): distinguish status and batch fixtures (#207232) fix(ui): type the Board drop test mock as void (#207348) fix(ui): break the Skill Workshop import cycle (#207345) test(channels): expose label guard regressions (#207195) fix: explain when a previous automation run keeps the agent from starting (#207180) refactor(test): consolidate loader proof and repair rollback coverage (#207152) fix(agents): one tool-result bound on every route, untrusted-content wrapper intact (#207101) test(plugins): verify staged SDK named exports (#207170) fix(ui): truncate empty Compose hints on narrow screens (#207301) fix: keep unsent Cmd+K Compose drafts when reopened (#207307) fix: explain chat update errors when a session changes (#206419) fix(ios): keep consecutive commands on one line in chat (#207242) fix(ios): keep connection messages from flashing when chat reopens (#207233) fix(ios): give Sessions groups more breathing room (#207221) fix(ui): show chat completions as activity rows (#201891) fix(ui): make empty composer hints look distinct from drafts (#207295) fix: explain why chat won’t attach an empty file (#206402) fix(agents): show Doctor's restore-first warning before deleting a held store (#207290) test(channels): fix join failure proof and trim probe fixture (#207264) ...
* commit '262f14aab89ca286633992760fa45aeeded998f9': (207 commits) fix(ui): remove redundant type argument from Board browser test (#207352) test(channels): distinguish status and batch fixtures (#207232) fix(ui): type the Board drop test mock as void (#207348) fix(ui): break the Skill Workshop import cycle (#207345) test(channels): expose label guard regressions (#207195) fix: explain when a previous automation run keeps the agent from starting (#207180) refactor(test): consolidate loader proof and repair rollback coverage (#207152) fix(agents): one tool-result bound on every route, untrusted-content wrapper intact (#207101) test(plugins): verify staged SDK named exports (#207170) fix(ui): truncate empty Compose hints on narrow screens (#207301) fix: keep unsent Cmd+K Compose drafts when reopened (#207307) fix: explain chat update errors when a session changes (#206419) fix(ios): keep consecutive commands on one line in chat (#207242) fix(ios): keep connection messages from flashing when chat reopens (#207233) fix(ios): give Sessions groups more breathing room (#207221) fix(ui): show chat completions as activity rows (#201891) fix(ui): make empty composer hints look distinct from drafts (#207295) fix: explain why chat won’t attach an empty file (#206402) fix(agents): show Doctor's restore-first warning before deleting a held store (#207290) test(channels): fix join failure proof and trim probe fixture (#207264) ...
…ld store (openclaw#207290) ## What problem this solves Follow-up to openclaw#207257. After deletion history is lost, Doctor holds back some agent stores and tells the operator to restore them first (`openclaw agents add … to abort deletion and restore`). `openclaw agents delete` on such an agent asked a plain "Delete agent?" with no hint of that, so a held store could be deleted without the user ever seeing Doctor's advice. ## Change - Doctor's per-store restore-first guidance moved, unchanged, into `formatHeldAgentStoreGuidance` (`src/commands/doctor-agent-deletion-held.ts`). Doctor's journal repair calls it; nothing else formats it. - `agents delete` reads Doctor's recorded recovery holds (`readAgentDeletionRecoveryHoldsInWorker`, the same record `agents add` checks). For each held store of the agent: - Interactive: the confirmation starts with `Warning: Doctor holds back a store of agent "<id>" because its deletion history was lost. Continuing deletes it without restoration:`, then Doctor's guidance, then the usual question. - `--force`: the same warning is printed to stderr and deletion proceeds. `--json` stdout is unchanged. - Agents without a hold keep the ordinary confirmation. Gateway: the CLI confirms locally before it calls the Gateway's `agents.delete`, so both CLI transports (through the Gateway and offline) show the warning. The Gateway method has no confirmation of its own. ## Not covered: Control UI The Control UI delete dialog does not show the held-store warning. The UI has no hold state on the wire, and adding a protocol field for it is deliberately parked (decision D56): the UI lists only configured agents while holds are mostly on unconfigured stores, deletion moves files to Trash, and Doctor already prints the restore-first guidance. Reopen if a real report shows a Control UI user deleting a held store. ## User population CLI users deleting an agent whose store Doctor holds back after a lost or unusable deletion journal. ## Evidence - `agents.delete.test.ts` "shows Doctor's restore-first warning for a held store before confirming": a registered `retired` store, a reconstructed deletion journal that holds it, then `agents delete retired`. - Interactive: the confirmation contains `Doctor holds back a store of agent "retired"` and Doctor's `openclaw agents add 'retired' … to abort deletion and restore`; cancelling changes nothing. The configured `ops` agent (no hold) keeps `Delete agent "ops" and prune workspace/state?`. - `--force --json`: stderr carries the same warning; deletion proceeds and the registration is removed. - Red on main `b4ec01fa`: the confirmation has no warning. - `doctor-agent-deletion-journal.test.ts` and the rest of `agents.delete.test.ts` stay green (40 tests): Doctor's held-store text is byte-identical after the move. Co-authored-by: Ayaan Zaidi <[email protected]>
What problem this solves
Follow-up to #207257. After deletion history is lost, Doctor holds back some agent stores and tells the operator to restore them first (
openclaw agents add … to abort deletion and restore).openclaw agents deleteon such an agent asked a plain "Delete agent?" with no hint of that, so a held store could be deleted without the user ever seeing Doctor's advice.Change
formatHeldAgentStoreGuidance(src/commands/doctor-agent-deletion-held.ts). Doctor's journal repair calls it; nothing else formats it.agents deletereads Doctor's recorded recovery holds (readAgentDeletionRecoveryHoldsInWorker, the same recordagents addchecks). For each held store of the agent:Warning: Doctor holds back a store of agent "<id>" because its deletion history was lost. Continuing deletes it without restoration:, then Doctor's guidance, then the usual question.--force: the same warning is printed to stderr and deletion proceeds.--jsonstdout is unchanged.Gateway: the CLI confirms locally before it calls the Gateway's
agents.delete, so both CLI transports (through the Gateway and offline) show the warning. The Gateway method has no confirmation of its own.Not covered: Control UI
The Control UI delete dialog does not show the held-store warning. The UI has no hold state on the wire, and adding a protocol field for it is deliberately parked (decision D56): the UI lists only configured agents while holds are mostly on unconfigured stores, deletion moves files to Trash, and Doctor already prints the restore-first guidance. Reopen if a real report shows a Control UI user deleting a held store.
User population
CLI users deleting an agent whose store Doctor holds back after a lost or unusable deletion journal.
Evidence
agents.delete.test.ts"shows Doctor's restore-first warning for a held store before confirming": a registeredretiredstore, a reconstructed deletion journal that holds it, thenagents delete retired.Doctor holds back a store of agent "retired"and Doctor'sopenclaw agents add 'retired' … to abort deletion and restore; cancelling changes nothing. The configuredopsagent (no hold) keepsDelete agent "ops" and prune workspace/state?.--force --json: stderr carries the same warning; deletion proceeds and the registration is removed.98b9f17b: the confirmation has no warning.doctor-agent-deletion-journal.test.tsand the rest ofagents.delete.test.tsstay green (40 tests): Doctor's held-store text is byte-identical after the move.