Skip to content

Validate the Interpreter the Agent-Safety Installer Writes Into settings.json #1172

Closed

Description

@ptr727

Raised out of #1166. The gh-write-guard hook can be installed with a command that never runs, and nothing would say so.

The defect

host-setup/agent-safety/claude/install.py picks the interpreter it writes into settings.json on bare presence:

def hook_launcher():
    if shutil.which("python3"):
        return "python3"
    return sys.executable

shutil.which answers for anything on PATH under that name. On a Windows host carrying the Microsoft Store app execution alias, that is a stub which cannot run a script at all, so the hook command written into settings.json would be one that never executes. The hook is the enforcement layer for this repo's write-safety rules, so a hook that silently never runs is the worst shape this failure can take.

install.sh has a weaker form of the same problem. It does run the candidate:

for c in python3 python; do
    if command -v "$c" >/dev/null 2>&1 && "$c" -c 'import sys; raise SystemExit(0 if sys.version_info[0] == 3 else 1)' 2>/dev/null; then

but it reads only the exit code, and it sends stderr to /dev/null. install.ps1 is the one that gets it right, preferring py -3 first.

Severity, honestly stated

Latent rather than live on the maintainer's host: ~/.claude/settings.json there carries no hooks block at all, so nothing is currently mis-wired. #1166 also removes the App Installer alias stub that triggers the Windows case, and supplies a real python3, so the specific trigger is narrower after it. Neither of those fixes the validation, which is what this issue is about, and the agent-safety tree is deliberately standalone and must keep working on a host install-tools.ps1 has never touched.

What a fix looks like

Run the candidate and read its output rather than its presence or its exit code: something that prints a known value and a version, checked against the 3.11 floor the installer and hook already require, with the failure reported rather than swallowed. install.sh should stop discarding stderr on the probe for the same reason.

Worth checking at the same time whether an already-written settings.json carrying a stale or non-working launcher is detected by --report, since a host installed before a fix would otherwise stay broken and pass its own check.

Activity

  1. added
    script
    on Sep 5, 2026
  2. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Decision needed (decision triage, 2026-11-01)

    Question: Should the agent-safety installer stop choosing the interpreter it writes into settings.json by presence alone, and instead run the candidate and check its version against the 3.11 floor, stop install.sh's probe discarding stderr, and have --report execute the registered launcher?

    Options, recommended first:

    1. Approve as proposed (recommended): The kit already executes a deployed file before trusting it (README: the installer and --report "execute the deployed file directly"). Doing the same for the launcher closes the remaining way to register a hook that silently never runs, and fixes hosts installed before the fix, since --report compares only the path today. No work in flight.
    2. Approve with change: always write sys.executable: Drop the python3 preference for the interpreter that already passed the 3.11 check by running the installer. Simpler, but an absolute path breaks when the interpreter is upgraded or moved, common on Windows. No work in flight.
    3. Decline, keep the presence check: The defect is latent where the Windows Store alias was removed (Supply a Real python3 on Windows and Remove the Alias Stubs #1166), but the issue states the kit must work on hosts install-tools.ps1 never touched. No work in flight.

    Evidence: install.py:465-472 unchanged: if shutil.which("python3"): return "python3". install.sh:15 ends its probe with 2>/dev/null and reads only the exit code. install.py:115-118 (runs_hook): "The path is compared and the launcher is not". The self-test at install.py:1600 runs sys.executable, not the written launcher. install.ps1 already prefers py -3.

    Blocks: none

  3. added
    decision
    on Nov 1, 2026
  4. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer (decision triage, 2026-11-01): Option 1: approved as proposed. This agent-safety installer change is approved for implementation: run-validate the launcher against the 3.11 floor, stop install.sh's probe discarding stderr, and have --report execute the registered launcher.

  5. removed
    decision
    on Nov 1, 2026
  6. ptr727 commented on Nov 10, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-10): PR #4032 merged into develop at 4673434 on the maintainer's go-ahead, and its branch and worktree are removed, so this claim holds no files.

    Backlog burndown claim (attended run 2026-11-10, round 1, group G2). Branch: burndown/1172-agent-safety-launcher-and-clusters. Issues: #1172, #3783.

    Predicted file set:

    • host-setup/agent-safety/claude/install.py
    • host-setup/agent-safety/claude/install.sh
    • host-setup/agent-safety/claude/test_install.py
    • host-setup/agent-safety/claude/README.md
    • host-setup/agent-safety/README.md
    • host-setup/agent-safety/ guard files including gh-write-guard.py
    • tests/test_guard_size.py

    No other group may edit these files while this claim stands. The orchestrator releases it at cleanup.

  7. ptr727 commented on Nov 10, 2026

    @ptr727
    OwnerAuthor

    Stopped for the maintainer (burndown round 1, 2026-11-10). PR #4032 carries this fix, at head 6818c267.

  8. ptr727 commented on Nov 10, 2026

    @ptr727
    OwnerAuthor

    Maintainer go-ahead (2026-11-10), for PR #4032 only: squash-merge it into develop once #4033's fix lands and its checks are green. The Merge Gate must otherwise hold with no new findings. A change to the diff before then comes back to the maintainer first.

  9. ptr727 commented on Nov 10, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-10): PR #4041 merged into develop at a735c0a on the maintainer's go-ahead, and its branch and worktree are removed, so this claim holds no files.

    Backlog burndown claim (attended run 2026-11-10, promotion fix for #4039, group G14). Branch: burndown/4039-agent-safety-launcher-probe-fixes. Issues: #1172.

    This fixes three findings Copilot raised on promotion #4039 against the launcher probe #4032 added. The merge waits on the maintainer's go-ahead after reading the diff.

    Predicted file set:

    • host-setup/agent-safety/claude/install.py
    • host-setup/agent-safety/claude/install.sh
    • host-setup/agent-safety/claude/test_install.py
    • host-setup/agent-safety/claude/README.md

    No other group may edit these files while this claim stands. The orchestrator releases it at cleanup.

  10. ptr727 commented on Nov 10, 2026

    @ptr727
    OwnerAuthor

    Maintainer go-ahead (2026-11-10), for PR #4041 only: squash-merge it into develop at head da99c18f, after reading its diff. It fixes two of promotion #4039's findings against #4032's launcher probe, and the third is deferred to #4040.

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

    script

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions