Repository navigation
fix(governance): route destructive git reset/clean through approval - #454
Merged
Merged
Conversation
…449) Explicitly requested `git reset --hard` and `git clean -f` were silently blocked by the git tool allowlist; the block was only visible in the internal tool trace, leaving the model to fabricate a false "working tree already clean" completion while real changes existed. - Allowlist `reset`/`clean` in the git tool with per-subcommand argument policies (no interactive options), so destructive forms are no longer hard-blocked. - Gate `reset --hard` and any force-carrying `clean` (short cluster or `--force`) on HITL approval in governance; denial surfaces as a visible error tool result the model must see. - Session integration tests run against disposable git repositories covering ask/approve/deny paths; non-destructive git forms and unrelated command safety are unchanged.
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…449) (#454) Explicitly requested `git reset --hard` and `git clean -f` were silently blocked by the git tool allowlist; the block was only visible in the internal tool trace, leaving the model to fabricate a false "working tree already clean" completion while real changes existed. - Allowlist `reset`/`clean` in the git tool with per-subcommand argument policies (no interactive options), so destructive forms are no longer hard-blocked. - Gate `reset --hard` and any force-carrying `clean` (short cluster or `--force`) on HITL approval in governance; denial surfaces as a visible error tool result the model must see. - Session integration tests run against disposable git repositories covering ask/approve/deny paths; non-destructive git forms and unrelated command safety are unchanged.
mohitranka
added a commit
that referenced
this pull request
Sep 11, 2026
…449) (#454) Explicitly requested `git reset --hard` and `git clean -f` were silently blocked by the git tool allowlist; the block was only visible in the internal tool trace, leaving the model to fabricate a false "working tree already clean" completion while real changes existed. - Allowlist `reset`/`clean` in the git tool with per-subcommand argument policies (no interactive options), so destructive forms are no longer hard-blocked. - Gate `reset --hard` and any force-carrying `clean` (short cluster or `--force`) on HITL approval in governance; denial surfaces as a visible error tool result the model must see. - Session integration tests run against disposable git repositories covering ask/approve/deny paths; non-destructive git forms and unrelated command safety are unchanged.
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.
Closes #449
Problem
Explicitly requested destructive git commands —
git reset(notably--hard) andgit clean(notably-fd) — were silently blocked by the git tool allowlist (reset and clean are not allowlisted). The block was visible only in the internal tool trace and never surfaced to the user. The agent then fabricated a falseworking tree is already clean, nothing to docompletion while real uncommitted changes and untracked files existed.Change
forge-tools:resetandcleanare allowlisted with per-subcommand argument policies (matching the existingGitPolicytable; no interactive options like-i/--interactive). Destructive forms are no longer hard-blocked.forge-governance:git reset --hardand any force-carryinggit clean(a short cluster containingfsuch as-fd/-df, or--force) are routed through HITL approval even thoughgitis not inhitl_toolsby default. A denial is surfaced as a visible error tool result the model must respond to — a block can no longer be mistaken for an empty/clean result. Non-destructive forms (status,resetwithout--hard,clean -n, etc.) are unchanged and run without prompting.forge-sessionintegration tests run against disposable repositories (git initin temp dirs — never the live repo) covering: approval prompt without approval (nothing runs), approve-and-execute (reset + clean actually revert/remove), and deny (visible denial, workspace untouched).Unrelated git subcommands, the allowlist shape, and existing protections (e.g.
GIT_DENIED_OPTIONS, workspace confinement checks) are unchanged.Validation
cargo fmt --all -- --check— okcargo clippy --workspace --all-targets --locked -- -D warnings— okcargo test --package forge-governance— 63 passedcargo test --package forge-session— 19 passedcargo test --package forge-tools— 326 passedcargo test --workspace --all-targets --locked— ok (27 suites, 0 failures)