fix: allow destructive bash retry after facts presented

Destructive bash gate previously denied every invocation with no
isChecked call, creating an infinite deny loop. Now gates per-command
on first attempt and allows retry after the model presents the required
facts (targets, rollback plan, user instruction).

Addresses greptile P1: "Destructive bash gate permanently blocks"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
seto
2026-04-12 18:08:15 +09:00
parent 96139b2dad
commit b6a290d061
2 changed files with 30 additions and 10 deletions

View File

@@ -184,7 +184,13 @@ function run(rawInput) {
const command = toolInput.command || '';
if (DESTRUCTIVE_BASH.test(command)) {
return denyResult(destructiveBashMsg());
// Gate destructive commands on first attempt; allow retry after facts presented
const key = '__destructive__' + command.slice(0, 200);
if (!isChecked(key)) {
markChecked(key);
return denyResult(destructiveBashMsg());
}
return rawInput; // allow retry after facts presented
}
if (!isChecked('__bash_session__')) {