You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Guardrail for destructive-command so rm doesn't run unchallenged #604
autonomous: noNeeds your brain: a product/design decision is required before anyone acts.enhancementNew feature or requestpriority: highP1 - important bug or impactful feature, fix soontriage: needs-decisionNeeds maintainer decision/design thought
Sorry that happened, and thanks for reporting it. Losing a home directory is exactly the outcome a coding agent must never produce, so this is being treated as high priority.
I have labeled this for maintainer decision rather than patching something narrow myself. A destructive-command guardrail is a permission-model design question, not a one-line fix: it needs a decision on what is gated, how it interacts with non-interactive/run mode, and how it composes with the existing permission work tracked in #568 and #566. A half-measure here (for example, pattern-matching rm -rf) would give false confidence while still missing find -delete, shred, redirects, and shell expansions.
To help scope it, if you still have the session: which command was actually executed, and was this an interactive TUI session or jcode run? No pressure if the transcript is gone.
--- — Jcode agent (automated triage), on behalf of @1jehuang
Update: I verified this is real and have opened a fix in #618.
Confirmed the gap. Before changing anything I ran the shipped binary against a throwaway directory: rm -rf executed immediately, no prompt. The only gate in the tool path is an opt-in external pre_tool hook that is off by default, so nothing protected you. My earlier comment understated this by treating it as purely a design question.
A deterministic classifier that scores blast radius rather than matching command names, so find -delete, shred, dd, and truncating redirects are covered alongside rm.
For irreversible commands reaching outside the working directory, the harness refuses once and asks the model which specific user request requires the deletion. It only proceeds if re-issued with a real justification, so a blind retry does not get through. For /, $HOME, credential directories, and device nodes it is a hard deny that no justification unlocks.
Routine work like rm -rf target is deliberately untouched, since a guard that fires constantly is one people learn to click through.
Tested live end to end, plus a 330-command sweep over every spelling of the home directory I could think of.
@1jehuang still needs to review it, in particular where the confirm threshold sits and how it should behave in unattended jcode run. Sorry again about your home directory.
--- — Jcode agent (automated triage), on behalf of @1jehuang
autonomous: noNeeds your brain: a product/design decision is required before anyone acts.enhancementNew feature or requestpriority: highP1 - important bug or impactful feature, fix soontriage: needs-decisionNeeds maintainer decision/design thought
Activity
phenchua29 commentedon Jul 25, 2026
This issue ticket genuinely scares me. RIP your home dir. 💀
1jehuang commentedon Jul 27, 2026
Sorry that happened, and thanks for reporting it. Losing a home directory is exactly the outcome a coding agent must never produce, so this is being treated as high priority.
I have labeled this for maintainer decision rather than patching something narrow myself. A destructive-command guardrail is a permission-model design question, not a one-line fix: it needs a decision on what is gated, how it interacts with non-interactive/
runmode, and how it composes with the existing permission work tracked in #568 and #566. A half-measure here (for example, pattern-matchingrm -rf) would give false confidence while still missingfind -delete,shred, redirects, and shell expansions.To help scope it, if you still have the session: which command was actually executed, and was this an interactive TUI session or
jcode run? No pressure if the transcript is gone.--- — Jcode agent (automated triage), on behalf of @1jehuang
1jehuang commentedon Jul 27, 2026
is this real?
1jehuang commentedon Jul 27, 2026
Update: I verified this is real and have opened a fix in #618.
Confirmed the gap. Before changing anything I ran the shipped binary against a throwaway directory:
rm -rfexecuted immediately, no prompt. The only gate in the tool path is an opt-in externalpre_toolhook that is off by default, so nothing protected you. My earlier comment understated this by treating it as purely a design question.What #618 does. Two stages:
find -delete,shred,dd, and truncating redirects are covered alongsiderm./,$HOME, credential directories, and device nodes it is a hard deny that no justification unlocks.Routine work like
rm -rf targetis deliberately untouched, since a guard that fires constantly is one people learn to click through.Tested live end to end, plus a 330-command sweep over every spelling of the home directory I could think of.
@1jehuang still needs to review it, in particular where the confirm threshold sits and how it should behave in unattended
jcode run. Sorry again about your home directory.--- — Jcode agent (automated triage), on behalf of @1jehuang
test(bash): pin that background dispatch is gated too (#604)
fix(apply_patch): close the second route to protected-path deletion (#…
fix(command-risk): close three bypasses found in review (#604)
feat(bash): gate destructive commands behind a reflection turn (fixes 1…
feat(patch): apply_patch runs on the ported engine
feat(bash): gate destructive commands behind a reflection turn (fixes 1…
test(bash): pin that background dispatch is gated too (1jehuang#604)
fix(apply_patch): close the second route to protected-path deletion (1…
fix(command-risk): close three bypasses found in review (1jehuang#604)
feat(bash): gate destructive commands behind a reflection turn (fixes 1…
test(bash): pin that background dispatch is gated too (1jehuang#604)
fix(apply_patch): close the second route to protected-path deletion (1…
fix(command-risk): close three bypasses found in review (1jehuang#604)
test: cover the remaining HOME-mutating tests with lock_test_env
docs(harness): add postmortem archive for 1jehuang#604 destructive-ga…
feat(bash): gate destructive commands behind a reflection turn (fixes 1…
test(bash): pin that background dispatch is gated too (1jehuang#604)
fix(apply_patch): close the second route to protected-path deletion (1…
fix(command-risk): close three bypasses found in review (1jehuang#604)
feat(bash): gate destructive commands behind a reflection turn (fixes 1…