Skip to content

disk-hygiene: always-on engine gate and session belt emit identical denial text with opposite scopes #3348

Closed

Description

@kyle-sexton

plugins/disk-hygiene v0.20.21. Split out of the audit umbrella. F13, medium-high. Cheapest high-value fix in that report: a message change, no behavior change.

Problem

The plugin has two Bash-denying surfaces with opposite scopes:

  1. The always-on engine gate — registered in hooks/hooks.json on PreToolUse matcher Bash|PowerShell with no invocation predicate. Active in every session whether or not /disk-hygiene:clean was ever invoked.
  2. The session belt — the skill's frontmatter hooks, registered when the skill is invoked and staying registered for the rest of the session (disk-hygiene:clean: frontmatter Bash belt is session-lifetime, not skill-scoped (+6 findings from a post-use audit) #2618).

They emit identical denial text. A user who has never invoked the skill triggers the always-on gate and is told their Bash lane is restricted to the skill's scan/preview/handoff-verify/apply shapes — describing a lockout they did not opt into, in the words of a different guard.

Evidence

This misled the audit itself. A Bash denial was initially attributed to the session belt and written up as such. A two-cell control isolated it to the always-on gate, and the finding was withdrawn (F9.1/F9.2). If an audit reading the plugin's own source got this wrong from the message text, an ordinary user has no chance.

The withdrawal also corrected a related claim: the belt does not reach subagents. That non-inheritance is undocumented and build-specific, so it should not be documented as a recovery lane without that caveat.

Suggested fix

Branch the denial message on resolve_mode() so each guard explains itself:

  • Always-on gate: say that this specific engine invocation is what is gated, that the rest of the Bash lane is unaffected, and that the skill need not have been invoked for this to fire.
  • Session belt: say that /disk-hygiene:clean was invoked in this session, that the belt persists until the session ends, and name the recovery lanes — including that a subagent does not inherit it, caveated as undocumented.

No behavior change, no scope change. The two guards keep doing exactly what they do; they stop claiming to be each other.

Related

Umbrella: #3347. F9.3/F9.4 in that issue cover the belt's missing escape hatch and its over-broad scope, which are separate and larger.

🤖 Generated with Claude Code

Activity

  1. claude commented on Sep 5, 2026

    @claude
    Contributor

    Generated by Claude Code

  2. claude commented on Sep 5, 2026

    @claude
    Contributor

    This was generated by AI during triage.

    Triage: verified → briefed (delegable)

    Lane: autonomous triage, instance vm-triage-202609050304. Claimed via the tracker seam.

    Verification — the finding still reproduces, and it reproduced on this triage session

    The issue was filed against disk-hygiene v0.20.21; current main ships v0.21.7. The finding survives the version gap.

    Re-checked against the current source:

    • hooks/hooks.json still registers the engine gate on PreToolUse for both Bash and PowerShell, with --mode engine-gate.
    • destructive_guard.py branches on mode in only four places (resolve_mode() call sites at L2007, L2046, L2084, and the _MODE_ENGINE_GATE comparison at L2084 selecting ask vs allow). None of them branches the denial text.
    • The deny reason is built by _bash_denial_guidance(authority) (L2116), which is keyed on authority, not on resolve_mode(). That is the mechanism behind the finding: one message body serves both guards.

    First-hand reproduction, this session. This triage session never invoked /disk-hygiene:clean. A routine read-only inspection command that merely named the engine file was denied by the always-on engine gate with the belt's wording:

    Disk-hygiene fails closed: Bash is restricted to exact bundled scan, preview, handoff-verify, and apply invocations of ... Supporting inspection may use that small Bash allowlist or non-Bash read-only tools; everything else stays denied.

    That is exactly F13: a session that never opted in is told its Bash lane is restricted, in the session belt's words. The audit's own misattribution (F9.1/F9.2, withdrawn) is reproduced here by an independent reader.

    Classification

    • Work class: work-class: scoped (already applied, and correct — message text only, no behavior change).
    • Priority: priority: medium retained. The reporter's medium-high maps to the repo's medium band; the surviving reproduction argues for the top of that band, not above it.
    • Exit: briefed → delegable. No open decision: the fix is to make each guard describe its own scope, and both scopes are already documented facts in the source.

    Brief (executable from this comment alone)

    Goal. The always-on engine gate and the session belt stop claiming to be each other. No behavior change, no scope change.

    Change. In plugins/disk-hygiene/skills/clean/scripts/destructive_guard.py, branch the denial guidance on resolve_mode() in addition to authority. _bash_denial_guidance() currently takes only authority; give it the mode (or call it from a mode-aware wrapper) and emit two distinct bodies:

    • engine-gate mode — say that this specific engine invocation is what was gated; that the rest of the Bash lane is unaffected; and that /disk-hygiene:clean need not have been invoked for this to fire.
    • belt mode — say that /disk-hygiene:clean was invoked in this session; that the belt persists until the session ends; and name the recovery lanes.

    One caveat that must ride along. When the belt message names recovery lanes, the "a subagent does not inherit the belt" lane must be marked as undocumented and build-specific. The audit withdrew the opposite claim (belt does reach subagents) after a two-cell control; stating the non-inheritance as a supported recovery route without that caveat would re-introduce a withdrawn claim as documentation.

    Acceptance criteria.

    • A denial raised in engine-gate mode and a denial raised in belt mode produce textually distinct reasons, each naming its own trigger condition.
    • The engine-gate text does not assert that the Bash lane in general is restricted.
    • The belt text names the subagent non-inheritance lane with the undocumented/build-specific caveat attached.
    • Tests in skills/clean/scripts/test_hygiene.py assert the two texts differ and that each contains its own trigger phrase (the file already has resolve_mode coverage around L7037 and L7618 to extend).
    • No change to any allow/deny decision — only to the reason string. Existing decision assertions stay green.

    Out of scope (tracked separately in the #3347 umbrella). F9.3 / F9.4 — the belt's missing escape hatch and its over-broad Bash scope. Those are behavior changes; this is not.

    Verification command

    Python in this repo lints through the pinned wrapper: scripts/run-ruff.sh check plugins/disk-hygiene. Select suites with scripts/affected-tests.sh --run.


    Raw marker cleared; agent-ready + status: ready applied. Lease released on completion of this triage.


    Generated by Claude Code

  3. added
    status: ready
    agent-ready
    and removed on Sep 5, 2026
  4. removed their assignment
    on Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readystatus: ready

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions