summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/tests/test_launcher_unreadable_script.py
AgeCommit message (Collapse)Author
2026-10-15security-guidance: report launcher fallback and give-up as metricsMohamed Hegazy
Two count-only metrics, emitted only when nonzero, so the launcher change can be checked in the field: - launcher_fallback: the hook ran, but only because the launcher started the interpreter by its real path (the names on PATH could not read the plugin files). Added to the hook's and the SessionStart bootstrap's existing metrics. - launcher_unreadable: no interpreter could read the hook script. No Python runs in that case, so the launcher prints the metrics line itself before exiting 1.
2026-10-15security-guidance: never run a hook with a Python that cannot read itMohamed Hegazy
On Windows, python/python3/py can be packaged launcher aliases (Microsoft Store Python, Python Install Manager). Started through the alias, the interpreter answers `-c` but has a different view of %APPDATA% and cannot see a plugin staged there. sg-python.sh picked it, CPython failed with "can't open file ... [Errno 2]" and exit code 2, and exit 2 from the asyncRewake Stop hook was delivered to the model as review findings. The model's reply ran the Stop hook again, so the session looped without ever reviewing anything (#6251, #5781). The launcher's probe now also checks that the interpreter can read the hook script. When no name on PATH qualifies, it tries the other python3/python entries on PATH by full path and the real executable each alias reports. If nothing can read the script it says so and exits 1, so a launch failure is never reported as findings.