Repository navigation
Hold agent deletes for an explicit user yes (closes #3096) - #3147
Conversation
Pragmatic Code Review: PR #3147 (Hold agent deletes for an explicit user yes)Review Type: Initial Review SummaryThis is a sound design. The safety property comes from the structure of the code, not from prompting. Requirements Check
Code Review Findings🟡 Important1. Overlapping targets double-count the cascade, and a cascaded target is reported as "Already gone" 🟢 Suggestions2. The confirmation replaces the report of other writes that landed in the same turn 3. No end-to-end test from a held turn to the confirmed delete 4. The unreachable 5. The model in an "Other" turn sees titles but not ids 6. Pro access gate: forged Nitpicks
RecommendationAPPROVE: the safety property holds by construction and all five acceptance criteria are met. Finding 1 is worth fixing in this PR or a quick follow-up so the numbers in the confirmation are exact. The rest are optional. 🤖 Generated with Claude Code |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
Address-review summary (55552c8)✅ Addressed
⏭️ Skipped
Re-review: not needed. The changes are small, targeted and covered by the new tests. Merging is the next step, and it is the user's call. |
The local agent's delete_node no longer deletes. It resolves the target and returns what would go (title, type, version, descendant count), and the turn ends with a Yes/No confirmation naming every held target and the nested nodes the cascade removes. The held records ride on that confirmation message (pendingDeletions), so only a reply to it can confirm them. The daemon answers the reply without the model: an unqualified yes deletes exactly the confirmed ids, after checking each still has the version and subtree size the user was shown (any drift aborts the whole delete), and each delete runs under the confirmed version. An unqualified no deletes nothing. Any other reply is an ordinary turn and the held deletes lapse. Held deletes are not recorded as completed writes. The SINGLE DELETE rule no longer tells the model to confirm on its own. The external-agent CLI path is filed separately as #3142. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- A held target nested under another held target is left out of the confirmation: the outer cascade removes it and its subtree is already in the outer count. Held results carry the target's ancestor ids for this. - The confirmation names writes its turn completed, since it replaces the model's reply (shared with the duplicate-entity backstop). - The daemon's answer is two-state; the unreachable "other" arm is gone. - End-to-end daemon test: a real turn holds the model's delete, persists the confirmation, and only the next turn's yes deletes. Skipped: surfacing held ids to the model after a non-answer (prompt change, unmeasured; any new delete is held again anyway) and actor checks for forged pendingDeletions under sync (no new capability on Community). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
55552c8 to
97d24af
Compare
Closes #3096.
What changes
delete_nodeno longer deletes.GraphToolExecutor::exec_delete_noderesolves the target and returns a held result: title, type, version, and descendant count (fromcollect_subtree_ids, the same set a delete removes). A missing node is an error, as before.The turn ends with a confirmation.
run_turnnow appliesconfirm_held_deletionsalongside the existing duplicate-entity backstop. When the turn held any deletes, the reply is replaced with a one-paragraph question naming every target and the total nested count, plus theYes, delete/No, keepoptions. The frontend already renders these as chips through theroute_clarifyplumbing. The held targets travel onClarifyPrompt.pending_deletionsand are persisted on that assistant message aspendingDeletions. If the model ended the turn with its ownroute_clarify, that question stands and the held deletes lapse.The daemon answers the reply, not the model. At the start of
run_ai_chat_turn, if the user's message directly follows a confirmation:execute_confirmedon exactly the confirmed ids. It first checks every target: a version or subtree size different from what the user was shown aborts the whole delete before anything is removed. Each delete then runs under the confirmed version (OCC). The result is recorded as completeddelete_nodewrites.delete_nodeis held again.Held results are excluded from completed writes (
landed_write), so the cross-turn duplicate guard never refuses the real delete.The local agent's
SINGLE DELETEimperative no longer tells the model to confirm on its own, since that would ask the user twice. The SKILL.md phrasing for external agents is unchanged.Acceptance criteria
nodespace node deletevia SKILL.md) was assessed and filed as External-agent deletes run without NodeSpace-side confirmation (CLI node delete path) #3142Not in scope
merge_conflictalso counts asremoves_user_data, but it archives the loser rather than hard-deleting it, so it stays recoverable. It is unchanged here.delete_node(Node Deletion skill is retrieved for creation and query requests, scoping away create_node #2240/"remove the resolved tickets" routes to Graph Editing, silently withholding delete_node #3076). The issue says to do that on measured evidence, so it belongs in a follow-up.delete_nodeper match for bulk requests. The tool description asks it to.Tests
deletion_confirmation: reply classification, question text, dedupe; real-store preview, exact execution, version-drift abort, added-child abort, nested-target handlingagent_loop: a held delete ends the turn with the confirmation (overriding a false "I deleted it"); a model clarification supersedes a held deletetools:delete_nodethroughGraphToolExecutorholds and leaves the node in placependingDeletionspersist🤖 Generated with Claude Code