diff options
Diffstat (limited to 'wf.py')
| -rwxr-xr-x | wf.py | 30 |
1 files changed, 27 insertions, 3 deletions
@@ -1821,6 +1821,28 @@ def park_task(root: Path, id: str, final: str, words: list[str]) -> str: return done +def cloud_park(root: Path, id: str, final: str, words: list[str]) -> str: + """Lane cloud after a handback/lost/awaiting/needs-owner (wf cloud pull already noted/blocked it): + awaiting/needs-owner → park_task; else Cloud: no (the cloud lane never re-sends it; local lanes may retry + with pull's Recovery note) + status cleared + note. Returns what it did (alert text).""" + if final in ("awaiting", "needs-owner"): + return park_task(root, id, final, words) + p = load_project(argparse.Namespace(project=str(root)), write=True) + if id not in p.doc.ids(): + return ARCHIVED + item, done = p.doc.item(id), "Cloud: no" + if item.cloud != "no": + tasks.set_fields(p.doc, id, cloud="no") + if (item.status or "").startswith("in progress"): + tasks.set_status(p.doc, id, None) + done += ", status cleared" + tasks.add_note(p.doc, id, f"orch {datetime.date.today().isoformat()}: cloud {final} " + f"({' '.join(words[1:]) or '-'}) → {done}; lane cloud kept picking, local lanes may retry") + p.save(False) + unclaim(p.cfg, [id]) + return done + " (local lanes may retry)" + + def orch_post(main: Path, p: Project, args) -> int: cfg, id, lane = p.cfg, args.id, args.lane rec = orch_record(cfg, id) @@ -1878,8 +1900,10 @@ def orch_post(main: Path, p: Project, args) -> int: out.append("committed leftover " + " ".join(files) if not r.returncode else f"leftover commit failed: {(r.stderr.strip() or 'git error').splitlines()[-1]}") if problems or not outcome.startswith("done"): - if lane != CLOUD and (problems or outcome in PARK and not raised): # cloud: pull already re-queued + if lane != CLOUD and (problems or outcome in PARK and not raised): parked = park_task(cfg.root, id, "post-check-red" if problems else outcome, words) + elif lane == CLOUD and not problems and outcome in PARK + ("lost",) and not raised: # no re-send loop + parked = cloud_park(cfg.root, id, outcome, words) if (not problems or parked and parked != ARCHIVED) \ and git_run(main, "status", "--porcelain", "--", *files).stdout.strip(): r = git_run(main, "commit", "-q", "-m", f"{id} {'post-check-red' if problems else outcome}" @@ -1915,7 +1939,7 @@ def orch_post(main: Path, p: Project, args) -> int: print(f"fix {fix.id} not runner-ready: add its Done/Model (wf set {fix.id} --done … --model …), " f"then wf orch pick {lane} --id {fix.id}") return 0 - if final in PARK and lane != CLOUD: + if parked: print(f"alert: {id} {final} → tell the owner ({parked}); lane {lane} keeps picking") elif final not in GO_ON and final != "model-raised": print(f"stop lane {lane}: {final} → tell the owner" @@ -2356,7 +2380,7 @@ def parser() -> argparse.ArgumentParser: op.add_argument("--recovery", metavar="WHY", help="prompt gets 'Recovery: WHY' (crashed worker, one retry)") op = osub.add_parser("post", help="after the worker's report: post-check (done: archive line, branch gone, " "worktree clean and in master, else wf merge; wf check), leftover commit otherwise, " - "out/wf-orch.log line, out/wf-cost.log line (--agent); awaiting/needs-owner/handback/post-check-red park only the task (blocked / After: h-task / Sessions: owner + note, 'alert:' line); then the next pick or 'stop lane'") + "out/wf-orch.log line, out/wf-cost.log line (--agent); awaiting/needs-owner/handback/post-check-red park only the task (blocked / After: h-task / Sessions: owner (lane cloud: Cloud: no) + note, 'alert:' line); then the next pick or 'stop lane'") op.add_argument("id") op.add_argument("lane") op.add_argument("--result", metavar="LINE", help="the report's result line (default: done if archived, else no-report)") |
