fix(issue-19): match the daemon's whole script path so spaced sandbox paths are reaped

Review round 2 (planner-reviewer-codex-01, NOT PASS P2):

- conftest `_is_subscriber_daemon_argv`: `ps -o args=` joins argv unquoted,
  so the script path is taken from the shell word up to the first
  `/reconcile.sh --subscribe` instead of as one whitespace token. A sandbox
  or --basetemp path with a space no longer hides its daemon from the
  fixture reaper and the session leak guard. A candidate with whitespace
  counts only when it names an existing file, so a bash wrapper under the
  root whose later argv carries the words is still excluded.
- tests: a whitespace-path selector regression and an owned live-process
  cleanup check (both fail on c096cb4); the R-2 test also pins the bash
  wrapper exclusion.
- docs: the polling fallback's signal handling is stated precisely in
  monitor SKILL.md and VERSIONS.md (a running --once pass finishes first,
  the interval's sleep child ends on its own); create SKILL.md says an
  already-running daemon's PID is still reported under the opt-out;
  VERSIONS selector wording and test count (14).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCGpJXhSZasJLU38ksDghe
This commit is contained in:
GodopuandClaude Opus 5 committed 2026-09-13 16:36:16 +09:00
1 parent c096cb455b
commit 8f9745b128
5 files changed
+95 -14

No files matched your search

+20 -8
View File
@@ -34,16 +34,28 @@ def _is_subscriber_daemon_argv(args, root):
--subscribe ...`. A process that merely *quotes* those words (a loop driver
or delegate wrapper carrying a brief in argv) and a sibling root that is a
string prefix of `root` (`.../pytest-9` vs `.../pytest-99`) are excluded
(review R-2) - the reaper kills what it selects."""
argv = args.split()
if len(argv) < 3:
(review R-2) - the reaper kills what it selects.
`ps -o args=` joins argv with single spaces and quotes nothing, so the
script path is taken whole - from the shell word up to the first
`/reconcile.sh --subscribe` - not as one whitespace token: a sandbox or
`--basetemp` path with a space in it must not hide its daemon from the
reaper and the leak guard (codex review P2). In that flat form a path with
whitespace is ambiguous - a bash wrapper under `root` can carry the words
later in its argv - so such a path counts only when it names an existing
file. A daemon whose workspace is already gone exits on its own (Issue #19)."""
import re as _re
shell, _, rest = args.strip().partition(" ")
if os.path.basename(shell) not in ("bash", "sh"):
return False
if os.path.basename(argv[0]) not in ("bash", "sh"):
rest = rest.lstrip()
if not rest.startswith(str(root).rstrip(os.sep) + os.sep):
return False
script = argv[1]
return (script.startswith(str(root).rstrip(os.sep) + os.sep)
and script.endswith(os.sep + "reconcile.sh")
and argv[2] == "--subscribe")
m = _re.match(r"(.*?" + _re.escape(os.sep) + r"reconcile\.sh) --subscribe(?: |$)", rest)
if not m:
return False
script = m.group(1)
return not any(c.isspace() for c in script) or os.path.isfile(script)
def _subscriber_daemon_pids(root):