fix(issue-21): PR #29 delta review follow-up - prepare installs the delegate-job requirements, removes a half-made venv on install failure; prompt dirty flag sees untracked files

- worktree_prepare.sh installs the same files deploy/install.sh does
  (.agents/skills/multi-agent-mux-delegate-job/requirements.txt: paho-mqtt,
  PyYAML) plus requirements*.txt. Without paho the loop wrapper, stop_session
  and the subscriber tests fail in the worktree - seen as 4 suite failures
  in a worktree without its own venv, all passing with one.
- review D1: a failed pip install removes the venv it half made, so the next
  run recreates it instead of reporting VENV=kept (test w1c).
- review D3: the [worktree context] block's uncommitted-changes flag uses
  --untracked-files=all like the guards.
- review D2: the create skill doc says the install needs the package index.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
GodopuandClaude Fable 5.1 committed 2026-09-20 21:33:57 +09:00
1 parent 08db1da9d5
commit 80a5614f7c
5 files changed
+26 -7

No files matched your search

+15
View File
@@ -290,6 +290,21 @@ def test_w1b_prepare_refuses_a_venv_link_and_skips_without_a_control_root_interp
assert os.path.islink(wt / ".venv"), "nothing is changed by the refusal"
def test_w1c_failed_requirements_install_removes_the_half_made_venv(ctl):
"""Review D1 (PR #29 delta): after a failed pip install the next run must
not report VENV=kept for an environment without the requirements."""
main = ctl
shutil.rmtree(main / ".venv")
subprocess.run([sys.executable, "-m", "venv", "--without-pip", str(main / ".venv")], check=True)
(main / "requirements.txt").write_text("this-package-does-not-exist-mam-w1c==0.0.0\n")
_git(main, "add", "requirements.txt")
_git(main, "commit", "-q", "-m", "req")
wt = _wt(main)
res = _prepare(main, wt, env={**os.environ, "PIP_INDEX_URL": "http://127.0.0.1:9/simple", "PIP_RETRIES": "0", "PIP_TIMEOUT": "1"})
assert res.returncode == 1 and "pip install" in res.stderr, res.stdout + res.stderr
assert not (wt / ".venv").exists() and os.path.realpath(wt) in _worktrees(main)
def test_w2_prepare_refusals_and_dry_run(ctl):
main = ctl
res = _run(main, PREP, "--path", str(main / "inside"), "--branch", "x")