From 811de09feb866c5b344034399154bde77acdd5ba Mon Sep 17 00:00:00 2001 From: godosa Date: Wed, 7 Oct 2026 09:37:36 +0200 Subject: split projects 5/6: wf orch pick/post use the code repo; push-failed stops the lane Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01JEAjUkQRrCYX5MZhWxdtj2 --- wf.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'wf.py') diff --git a/wf.py b/wf.py index f166208..7b5ae12 100755 --- a/wf.py +++ b/wf.py @@ -1645,8 +1645,9 @@ def lane_worktree(main: Path, p: Project, lane: str, id: str) -> Path: if f.stem != id and r.get("worktree") and other and (other.status or "").startswith("in progress"): busy.add(Path(r["worktree"])) cwds = live_session_cwds() + base = config.code_main(cfg) or main n = 1 - while not worktree_free(wt := main / ".worktrees" / (lane if n == 1 else f"{lane}-{n}"), f"{lane}/{id}", busy, cwds): + while not worktree_free(wt := base / ".worktrees" / (lane if n == 1 else f"{lane}-{n}"), f"{lane}/{id}", busy, cwds): n += 1 return wt @@ -1772,7 +1773,8 @@ def archived_meta(cfg: config.Config, id: str) -> tuple[str | None, str | None]: def orch_post(main: Path, p: Project, args) -> int: cfg, id, lane = p.cfg, args.id, args.lane rec = orch_record(cfg, id) - wt = Path(rec.get("worktree") or main / ".worktrees" / lane) + repo = config.code_main(cfg) or main + wt = Path(rec.get("worktree") or repo / ".worktrees" / lane) item = p.doc.item(id) if id in p.doc.ids() else None if item is None and id not in p.archived: raise Failure(tasks.unknown_id(id, p.doc.ids())) @@ -1780,7 +1782,7 @@ def orch_post(main: Path, p: Project, args) -> int: outcome = words[0] if words else ("done" if id in p.archived else "no-report") if outcome == "done" and item is not None and id not in p.archived and tasks.open_slices(p.doc, id): outcome = "sliced" # slice job: worker said done but the task is open with slices - master = config.git_branch(main / ".git") or "master" + master = config.git_branch(repo / ".git") or "master" files = [str(f.relative_to(main)) for f in (cfg.tasks, cfg.archive)] problems, out = [], [] with project_lock(cfg.root): @@ -1800,7 +1802,7 @@ def orch_post(main: Path, p: Project, args) -> int: except Failure as e: problems.append(f"wf merge in {wt}: {e}") branch = rec.get("branch") or f"{lane}/{id}" - if not git_run(main, "rev-parse", "--verify", "-q", f"refs/heads/{branch}").returncode: + if not git_run(repo, "rev-parse", "--verify", "-q", f"refs/heads/{branch}").returncode: problems.append(f"branch {branch} still there") errors = checks.check(config.load(cfg.root))[0] if errors: @@ -1812,11 +1814,13 @@ def orch_post(main: Path, p: Project, args) -> int: raised = bool(item and rec.get("model") and not outcome.startswith("done") and tasks.MODELS.index(item.model) > tasks.MODELS.index(rec["model"])) final = "post-check-red" if problems else ("model-raised" if raised else outcome) + if outcome.startswith("done") and not problems and (cfg.root / ".wf" / "push-failed").is_file(): + final = "push-failed" am, ae = (None, None) if item or (rec.get("model") and rec.get("effort")) else archived_meta(cfg, id) model = rec.get("model") or (item.model if item else am) or "?" dur = args.duration if args.duration else ( # None/0 (orchestrator lacked duration_ms) → since the pick int(datetime.datetime.now().timestamp()) - rec["at"] if isinstance(rec.get("at"), int) else None) - commit = args.commit or (git_run(main, "rev-parse", "--short", master).stdout.strip() + commit = args.commit or (git_run(repo, "rev-parse", "--short", master).stdout.strip() if outcome.startswith("done") else "-") now = datetime.datetime.now().isoformat(timespec="seconds") (cfg.root / "out").mkdir(exist_ok=True) @@ -1841,6 +1845,7 @@ def orch_post(main: Path, p: Project, args) -> int: return 0 if final not in GO_ON and final != "model-raised": print(f"stop lane {lane}: {final} → tell the owner" + + (f" (wf push in {cfg.root})" if final == "push-failed" else "") + (f" (crash/no report: one fresh worker: wf orch pick {lane} --id {id} --recovery \"\", then stop)" if final == "no-report" else "")) return 0 -- cgit