Skip to content

disk-hygiene: correct elevation-lane pilot status in the safety model and README #5229

Closed

Description

@kyle-sexton

Problem

The operator wants to encode standing decisions once: delete superseded versions, backups and empty files/dirs by default; use these age thresholds; treat these as in-flight. The policy overlay cannot say that.

Evidence

  • skills/clean/scripts/hygiene.py:804-809: the overlay accepts only version, disabled_hint_ids, additional_hints, additional_protected_path_globs. Any other key raises "unknown policy fields" (:810-814).
  • The baseline (skills/clean/reference/baseline-policy.json) has protected_exact_names, protected_name_globs, os_temp_recommendation_threshold_bytes, and hints with confidence_ceiling. A hint can only cap confidence; nothing raises a class to a default-approve tier or sets an age.
  • hygiene.py:786-799: overlays layer additively (user-global, project); an explicit --policy wins outright.
  • disk-hygiene: small items: recycle-or-permanent choice, absolute protect globs, belt does not reach subagents, SKILL.md understates Bash allowlist #4228 item 2 (open): protect globs are target-relative even in the user-global file.

Expected

  • Per-class rules: {class: superseded-version | backup | empty | temp | crash-dump, action: propose-by-default | never, min_age_days, min_age_basis: mtime|atime|ctime}.
  • Named in-flight rules (modified within N days, referenced by an open issue/PR or a handoff, locked or open handle).
  • Still capped by the safety floor: policy may make an item pre-selected in the approval list; it cannot bypass the per-tier approval gate or protected reasons.
  • Policy validation keeps the unknown field errors, plus a documented schema file.

Proposed direction

Add a versioned rules array to the overlay (schema version 2, loader keeps reading version 1), each rule matching on hint id or class and setting preselect and min_age_days; the report shows which rule applied.

Related: #4228 (absolute globs), #4008 (catalog of operator answers, the adjacent "remember" half), #5214, #5221.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K3VkbjLqtYZ6JtsQaDKP4v

Activity

  1. added
    needs-triage
    on Sep 29, 2026
  2. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    Another setting this issue should cover: elevation.

    disk-hygiene's SKILL.md says "Never elevate, trigger UAC/sudo ... Report needs-elevation ... and stop that tier." The operator's global instructions now say the opposite. When the agent can run a step and observe the result, it runs the step itself. That includes elevated work launched with Start-Process -Verb RunAs, which waits behind a UAC prompt the operator approves (melodic-software/dotfiles#956).

    This session hit exactly that case. The items that needed elevation were cleaned by that route:

    • duplicate C:\Windows\Installer\MSI*.tmp files
    • Steam .old files
    • an EasyAntiCheat .bak
    • empty product folders
    • about 48 MB of stale Office Click-to-Run logs in C:\Windows\Temp

    The script re-checked each path and wrote a log that the agent read back.

    Request: an operator-policy opt-in, for example elevation: "uac-prompt", that lets the skill run elevated steps behind the OS consent prompt instead of handing the operator commands to paste. The default can stay as it is.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01K3VkbjLqtYZ6JtsQaDKP4v

  3. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Deferred from the age-threshold work on branch feat/5229-disk-hygiene-policy-rules: the in-flight rule for entries "referenced by an open issue/PR or a handoff" is not implemented. The engine would need network and gh access at scan time, which it does not have. The mtime in-flight rule (files, directories by newest inventoried descendant, incomplete coverage counts as in-flight) is implemented. This item stays open as follow-up.

  4. kyle-sexton commented on Oct 1, 2026

    @kyle-sexton
    MemberAuthor

    Windows UAC pilot for the opt-in elevation lane: PASS (2026-10-01T22:17Z, melo-desk-001, the owner at the console approved the UAC prompt).

    Setup. pilot-5229.ps1 (sha256 6d5488b4ac1c7fd963f84426ae14c5a2ebb2f2e7df199c7e144c28821090ffe6, checked by the launcher and by the script itself) ran through Start-Process -Verb RunAs -Wait -PassThru from WSL. Host: pwsh 7.6.5, user azuread\kylesexton, session 1, UAC policy EnableLUA=1 ConsentPromptBehaviorAdmin=5 PromptOnSecureDesktop=1 FilterAdministratorToken=1. The fixture was a folder with an Administrators-and-SYSTEM-only ACL, standing in for C:\Windows\Temp and C:\Windows\Installer.

    Results (0 failures):

    • -Verb RunAs produced an Administrators-enabled, High-integrity token.

    • Baseline: a de-elevated child (runas /trustlevel:0x20000, Administrators deny-only) could not delete ok-file.tmp, so the fixture is a real needs-elevation case.

    • The elevated per-path re-check returned the expected verdict for every case, and removal happened only on clear:

      Path Re-check Outcome
      ok-file.tmp clear removed
      empty-dir clear removed
      missing-file.tmp missing not removed
      swap-file.tmp (replaced after the snapshot) identity-changed kept
      link-dir (junction) reparse kept, not followed
      surplus-dir (entry added after the snapshot) unrecorded-child kept
      locked-file.tmp (handle held) locked (win32 32 on a DELETE-access probe) kept
    • Start-Process -Wait returned after 10 s with the pilot's exit code (0), and it covered a hidden descendant that outlived the script by about 5 s, so the safety-model claim that -Wait returns only after descendants exit held on this host.

    • Cleanup removed every fixture path one at a time, deepest first, and a non-elevated check confirmed the folder is gone.

    Finding. The same held file probed the way the engine's windows_handle_state does (desired access 0, share mode 0) returned win32 0, i.e. "clear". That is #5756: the engine's live-handle probe cannot see an open handle on Windows. The pilot's re-check used DELETE access, which does.

    Not covered. This exercised a native replica of the lane's five re-check conditions, not hygiene.py itself on Windows: the handoff-verify trigger, per-tier approval, the script written under the run directory, the real paths from the issue comment, Recycle Bin removal, policy overlay precedence, and non-console or standard-user credential prompts.

    safety-model.md#opt-in-elevation, README.md:320 and the 0.30.0 CHANGELOG entry still say no Windows UAC pilot has run; that wording is now out of date.

  5. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Triage: what this issue asks for has shipped. Policy overlay v2 rules (#5542) cover preselect, min_age_days and the uac-prompt elevation opt-in. Class-matched rules, the atime/ctime age basis and the --in-flight-refs input for paths referenced by open issues, PRs and handoffs are in #5628. The Windows live-handle probe fix is #5758. That also resolves the "referenced by an open issue/PR or a handoff" deferral noted on 2026-09-30.

    One item is left. Per the 2026-10-01 pilot comment, the plugin docs still say no Windows UAC pilot has run the elevation lane. This issue is narrowed to that correction and closes when it lands.

    Agent Brief

    Type: Task
    Summary: Update the disk-hygiene docs' claim about the opt-in Windows elevation lane so it reflects the 2026-10-01 native-replica UAC pilot and keeps the limits of what that pilot covered.

    Current behavior:
    The disk-hygiene safety model's "opt-in elevation" section ends with an "Unverified" note saying no Windows UAC pilot has run the lane and that it should be treated as documented intent. The plugin README's policy-overlay paragraph says the same: the elevation lane "has not been proven in a Windows UAC pilot". Both are out of date. A pilot ran on 2026-10-01 and passed with 0 failures; its record is the pilot comment on this issue.

    Desired behavior:
    Both places state accurately what has been verified:

    • A native PowerShell replica of the lane's per-path re-check, launched through Start-Process -Verb RunAs -Wait, passed on Windows on 2026-10-01. It produced a High-integrity token, removed only on a clear verdict, kept the missing, identity-changed, reparse, unrecorded-child and locked cases, and -Wait returned only after descendants exited.
    • What that pilot did NOT exercise, listed from the comment: the engine itself on Windows, the handoff-verify trigger, per-tier approval, the script written under the run directory, the real paths from the issue comment, Recycle Bin removal, policy-overlay precedence, and non-console or standard-user credential prompts.
    • The wording never claims the engine's own Windows elevation path has been exercised end to end.
    • The plugin gets a new CHANGELOG entry and the version bump this repository's convention requires.

    Key interfaces:

    • The elevation policy field (never | uac-prompt) and the lane it enables: behavior unchanged, only its verification status text changes.
    • The safety model's "opt-in elevation" section and the README policy-overlay paragraph that links to it.

    Acceptance criteria:

    • No current (non-CHANGELOG-history) disk-hygiene doc says that no Windows UAC pilot has run or that the lane has not been proven in a pilot.
    • The safety model names the 2026-10-01 native-replica pass and lists what it did not cover, including the engine on Windows.
    • The README sentence agrees with the safety model and still links to it.
    • A new CHANGELOG entry records the correction, and the plugin version is bumped.
    • The repository's markdown lint and the disk-hygiene doc and skill checks pass.

    Out of scope:

    • Any change to when the elevation lane may be offered, what it may do, the guard or belt, or the elevation schema or loader.
    • Editing past CHANGELOG entries.
    • Baseline detection hints for the superseded-version, backup, empty and crash-dump classes (today they match only through operator additional_hints; a new item if wanted).
    • Running a further pilot of the engine on Windows.

    Basis: verified, the disk-hygiene safety model's opt-in elevation section and README policy-overlay paragraph on main; the 2026-10-01 pilot comment; CHANGELOG 0.30.0 and 0.41.0. Priority low: a status-text correction that gates no behavior.

  6. 3 remaining items

  7. added
    status: ready
    on Oct 4, 2026
  8. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during work-loop.

    Ratify autonomous dispatch of this C3 bug-fix item?

    Classification: work-class: scoped (C3), bug-fix-shaped (a docs status correction, narrowed at triage this cycle). Intended dispatch: the work-loop worker lane, through /work-items:work, to a draft PR the lane never merges. The lane has not completed its first drain and no item-level ratification exists, so the item is queued here instead of dispatched. Ratify it through /work-items:attend-queue, and it returns to the frontier and dispatches on a later cycle.

    Lane: work-loop, instance melo-worker-1, cycle 1.

  9. added
    needs-human
    and removed
    agent-ready
    on Oct 4, 2026
  10. changed the title [-]disk-hygiene: configurable operating policy (delete-by-default classes, age thresholds, in-flight rules) beyond hint and protect globs[/-] [+]disk-hygiene: correct elevation-lane pilot status in the safety model and README[/+] on Oct 4, 2026
  11. self-assigned this
    on Oct 4, 2026
  12. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
  13. added
    agent-ready
    and removed
    status: ready
    needs-human
    on Oct 4, 2026
  14. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during attend-queue.

    Operator direction (2026-10-04): "go with the recommendations." This records that decision.

    Operator ratification: ratified as C3 (scoped), bug-fix-shaped, priority low, on the narrowed scope in the new title.

    The behavior the old title named has merged: #5542, #5628 and #5758. What remains is docs only. Brief for the worker:

    1. Correct the stale "no UAC pilot" text at plugins/disk-hygiene/skills/clean/reference/safety-model.md (around 965-966) and plugins/disk-hygiene/README.md (around 320-322). A replica pilot of the elevation lane passed on 2026-10-01, per the comment on this issue.
    2. Do not overstate it: the engine itself has never run elevated on Windows, and the docs must not claim it has.
    3. Write no ranking-signal text. Ranking is parked under disk-hygiene: implement the ranking signals the provenance mandate currently rests on nothing #3858.
    4. Add the CHANGELOG entry ## [0.43.5] and the matching version bump.

    No code or behavior change.

  15. kyle-sexton commented on Oct 4, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-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