land #665: feat(hosthooks): recheck a delete's blast radius before execution (#649) - #680
Merged
Conversation
Before a risky delete runs, Doberman counts what it would touch, shows that to the human, and recounts right before execution, blocking if the count moved (ADR 0094's TOCTOU guard, reason code effect_set_diverged). That guard lived only in proxy/executor.py, so none of the four supported hosts had it, even though a host hook is how most agents actually reach a tool. `grep -rln effect_set_diverged src/doberman/` now lists hosthooks/hookio.py. The host-hook path computed no preview at all, so there was nothing a recheck could compare against and the challenge rendered no blast radius. This adds both halves in hookio.resolve_auth_result, the one place every adapter turns an approval into an execution: * before the challenge, compute the bounded effect set and attach it to the decision the prompters render, so the human approves a blast radius they can actually see; * after they answer, recompute the same operands and deny if the digest moved. Drift in either direction denies, and so does a known count degrading to unknown. A dynamic delete is `unknown` at both ends and cannot re-deny on dynamism alone. A recheck that raises denies too: a guard that cannot verify must not report success. Cost is unchanged for everything else. Both helpers early-out before any filesystem work for a non-delete action, and both imports are lazy, so the PASS/BLOCK hot path this module's docstring protects still pays nothing. Mutation-checked: forcing `diverged = False` turns six of the new tests red. OpenClaw is deliberately not covered and LIMITATIONS.md now says so: it defers an AUTH to its own /approve flow, which resolves outside this process, so there is no moment inside the hook where a recheck could run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit da48b49)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 82989e8)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lands #665 (feat(hosthooks): recheck a delete's blast radius before execution) by @harshitagrawal2O via a landing branch: their commits cherry-picked onto current main with authorship preserved, because main requires up-to-date branches and refuses merge commits.
Mechanical changes on this branch: none.
Closes #649