Skip to content

fix(governance): route destructive git reset/clean through approval - #454

Merged
mohitranka merged 1 commit into
mainfrom
fix/449-destructive-git-approval
Aug 27, 2026
Merged

mohitranka merged 1 commit into
mainfrom
fix/449-destructive-git-approval

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Closes #449

Problem

Explicitly requested destructive git commands — git reset (notably --hard) and git 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 false working tree is already clean, nothing to do completion while real uncommitted changes and untracked files existed.

Change

  • forge-tools: reset and clean are allowlisted with per-subcommand argument policies (matching the existing GitPolicy table; no interactive options like -i/--interactive). Destructive forms are no longer hard-blocked.
  • forge-governance: git reset --hard and any force-carrying git clean (a short cluster containing f such as -fd/-df, or --force) are routed through HITL approval even though git is not in hitl_tools by 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, reset without --hard, clean -n, etc.) are unchanged and run without prompting.
  • forge-session integration tests run against disposable repositories (git init in 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 — ok
  • cargo clippy --workspace --all-targets --locked -- -D warnings — ok
  • cargo test --package forge-governance — 63 passed
  • cargo test --package forge-session — 19 passed
  • cargo test --package forge-tools — 326 passed
  • cargo test --workspace --all-targets --locked — ok (27 suites, 0 failures)

…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
mohitranka merged commit aca38ac into main Aug 27, 2026
7 checks passed
@mohitranka
mohitranka deleted the fix/449-destructive-git-approval branch August 27, 2026 20:13
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silently blocked git reset/clean leads agent to fabricate false 'nothing to do' completion

1 participant