Skip to content

Session Handoff [auto-1905]: Judge the Installer's Hook Ownership by File Name #1952

Closed

Description

@ptr727

Next steps

  1. Fix Judge the Installer's Hook Ownership by File Name, Not Substring #1905: in host-setup/agent-safety/claude/install.py, judge whether a PreToolUse or SessionEnd hook registration belongs to the kit by the file name its command runs rather than by a substring test for GUARD_STEM / SWEEP_STEM, in both the re-registration path and registration_problems. runs_hook already compares paths and is the suggested basis. Done means: a maintainer hook whose command merely contains a stem (a constructed wrapper such as my-gh-write-guard-audit.sh) is neither removed on install nor counted by --report as the kit's registration, with a test proving both, reverted-fix check included.
  2. Drive the pull request to develop with drive-pr, body carrying Closes on promotion: #1905, then close this lane out.

External blockers

None known.

Internal dependencies

None.

State

No branch, worktree, or pull request yet. Develop head at pick time carried the substring tests unchanged. Re-derive from origin/develop.

The parked decision queue

Zero parked decisions on this lane.

What the last round did

Picker selected #1905 from the open backlog as an auto-resolvable correctness defect in code that runs: it silently deletes a maintainer's own hook.

What not to repeat

Nothing yet.

New learnings

None yet.

Activity

  1. added
    handoff
    on Sep 28, 2026
  2. ptr727 commented on Sep 28, 2026

    @ptr727
    OwnerAuthor

    Fixed and merged: PR #1954, squashed to develop as 4591dff.

    install.py's PreToolUse/SessionEnd hook-ownership check now judges a registration by the exact file name a command's own token names (names_hook), matched with runs_hook's existing boundary characters, instead of a bare substring test on the whole command. A maintainer's own hook whose command merely contains the stem (e.g. my-gh-write-guard-audit.sh) is neither stripped on install nor counted by --report as the kit's registration, with tests proving both, plus a reverted-fix check confirming the tests actually catch the regression.

    Three local-strict-review passes ran against the branch before it opened as a pull request:

    • Pass 1 and pass 2 each found real disagreements between names_hook and the existing runs_hook on unusual-but-real command shapes (bash -c wrapping, parenthesized subshells, a trailing ; true, an unbalanced quote, and a quoted path whose own directory holds shell metacharacters). Both were fixed and are covered by test_names_hook_agrees_with_runs_hook_on_every_shape_it_accepts.
    • Pass 3 found a stale top-of-file comment (fixed) and a test asserting the old substring contract rather than the real one (fixed, renamed to test_the_guard_is_deployed_and_registered_under_one_name), plus a narrower residual gap where closing it fully would mean widening runs_hook itself, a design change beyond this fix's scope. That gap is documented in names_hook's docstring and filed separately as names_hook Does Not Match Every Shape runs_hook Accepts #1953 rather than chased further here.

    Copilot review on the merged head (22de4fb) came back clean: 0 threads, 0 suppressed findings, full coverage.

    Track auto-1905 closed out, no successor needed.

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

    handoff

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions