You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the harness-native Agent(isolation="worktree") primitive for per-arm subagents (#3) instead of the manual lifecycle in worktree.py.
Why this matters
worktree.py predates the harness primitive. It manually creates, tracks, and cleans up worktrees. The race condition observed on 5/18 (two executors writing to one iter dir, ghost worktrees lingering as iter-4-… for hours) wouldn't happen under harness-managed worktrees, which are auto-cleaned and tracked.
What's already shipped
worktree.py (initial impl).
This issue replaces the lifecycle, keeps the post-run patch extraction.
Capture the post-run patch via git diff in the subagent before it exits; the subagent writes the patch to iter-N/patches/<arm>.patch (already the existing convention).
Delete worktree.py's lifecycle code; keep only the patch-extraction helper.
On orphan detection (any worktree under <repo>/.nous-experiments/ older than 1 hour with no live PID), garbage collect on next nous run start.
Acceptance criteria
After running a multi-arm campaign, <repo>/.nous-experiments/ contains zero leftover worktrees.
Per-arm patches end up in iter-N/patches/<arm>.patch exactly as today.
TL;DR
Use the harness-native
Agent(isolation="worktree")primitive for per-arm subagents (#3) instead of the manual lifecycle inworktree.py.Why this matters
worktree.pypredates the harness primitive. It manually creates, tracks, and cleans up worktrees. The race condition observed on 5/18 (two executors writing to one iter dir, ghost worktrees lingering asiter-4-…for hours) wouldn't happen under harness-managed worktrees, which are auto-cleaned and tracked.What's already shipped
worktree.py(initial impl).Proposed approach
isolation="worktree"to the harness.git diffin the subagent before it exits; the subagent writes the patch toiter-N/patches/<arm>.patch(already the existing convention).worktree.py's lifecycle code; keep only the patch-extraction helper.<repo>/.nous-experiments/older than 1 hour with no live PID), garbage collect on nextnous runstart.Acceptance criteria
<repo>/.nous-experiments/contains zero leftover worktrees.iter-N/patches/<arm>.patchexactly as today.worktree.pyis reduced by ≥ 60% LoC.Part of #120.