aboutsummaryrefslogtreecommitdiffziptar.gz
path: root/wf.py
diff options
context:
space:
mode:
authorgodosa <godosa@godosa.eu>2026-10-07 11:06:25 +0200
committergodosa <godosa@godosa.eu>2026-10-07 11:06:25 +0200
commitf23d7d865eb042512ebabad87e89b35b11cc1c64 (patch)
treeae575d025b2c0d0d86c72ec9e79f1d833a38371b /wf.py
parent959275f862e84ee20207f7eef3f1c0f999f6993d (diff)
downloadworkflow-f23d7d865eb042512ebabad87e89b35b11cc1c64.tar.gz
workflow-f23d7d865eb042512ebabad87e89b35b11cc1c64.zip
wf orch post: commit leftover books with code sha; reject private sha in split
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JEAjUkQRrCYX5MZhWxdtj2
Diffstat (limited to 'wf.py')
-rwxr-xr-xwf.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/wf.py b/wf.py
index dda4914..108f3da 100755
--- a/wf.py
+++ b/wf.py
@@ -1793,6 +1793,17 @@ def orch_post(main: Path, p: Project, args) -> int:
master = config.git_branch(repo / ".git") or "master"
files = [str(f.relative_to(main)) for f in (cfg.tasks, cfg.archive)]
problems, out = [], []
+ split = repo.resolve() != main.resolve()
+
+ def report_commit() -> str: # after any merge below; split: a private sha → the code repo's master
+ c = args.commit or (git_run(repo, "rev-parse", "--short", master).stdout.strip()
+ if outcome.startswith("done") else "-")
+ if split and c != "-" and git_run(repo, "cat-file", "-e", f"{c}^{{commit}}").returncode:
+ fixed = git_run(repo, "rev-parse", "--short", master).stdout.strip()
+ out.append(f"commit {c} not in code repo {repo} (a private sha?): using its {master} {fixed}")
+ c = fixed
+ return c
+ commit = None
with project_lock(cfg.root):
if outcome.startswith("done"):
if id not in p.archived:
@@ -1815,6 +1826,12 @@ def orch_post(main: Path, p: Project, args) -> int:
errors = checks.check(config.load(cfg.root))[0]
if errors:
problems.append(f"wf check: {len(errors)} errors: {errors[0]}")
+ commit = report_commit()
+ if not problems and git_run(main, "status", "--porcelain", "--", *files).stdout.strip():
+ msg = f"{id} done" + (f" (code {commit})" if split and commit != "-" else " (orchestrator)")
+ r = git_run(main, "commit", "-q", "-m", msg, "--", *files)
+ out.append("committed leftover " + " ".join(files) if not r.returncode
+ else f"leftover commit failed: {(r.stderr.strip() or 'git error').splitlines()[-1]}")
elif git_run(main, "status", "--porcelain", "--", *files).stdout.strip():
r = git_run(main, "commit", "-q", "-m", f"{id} {outcome} (orchestrator)", "--", *files)
out.append("committed leftover " + " ".join(files) if not r.returncode
@@ -1828,8 +1845,7 @@ def orch_post(main: Path, p: Project, args) -> int:
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(repo, "rev-parse", "--short", master).stdout.strip()
- if outcome.startswith("done") else "-")
+ commit = commit or report_commit()
now = datetime.datetime.now().isoformat(timespec="seconds")
(cfg.root / "out").mkdir(exist_ok=True)
with open(cfg.root / "out" / "wf-orch.log", "a") as f: