From 989b55970b76ca0b607ab87ab0286625934950cf Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Fri, 17 Jul 2026 00:32:08 +0300 Subject: [PATCH] fix: reconcile Gitea Ralph status labels --- .scratch/distributed-gguf-runtime/gitea-issues.json | 2 +- scripts/ralph-gitea-run.sh | 6 +++++- scripts/ralph_gitea_sync.py | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.scratch/distributed-gguf-runtime/gitea-issues.json b/.scratch/distributed-gguf-runtime/gitea-issues.json index 1c4bea2..7b8e7be 100644 --- a/.scratch/distributed-gguf-runtime/gitea-issues.json +++ b/.scratch/distributed-gguf-runtime/gitea-issues.json @@ -29,7 +29,7 @@ "number": 5, "url": "https://git.d-popov.com/popov/neuron-tai/issues/5", "state": "open", - "status": "in-progress" + "status": "ready" }, "DGR-022": { "number": 6, diff --git a/scripts/ralph-gitea-run.sh b/scripts/ralph-gitea-run.sh index 812b903..7dce201 100644 --- a/scripts/ralph-gitea-run.sh +++ b/scripts/ralph-gitea-run.sh @@ -8,5 +8,9 @@ cd "$ROOT" python3 scripts/ralph_gitea_sync.py sync ralph_status=0 "$@" || ralph_status=$? -python3 scripts/ralph_gitea_sync.py sync +if [ "$ralph_status" -eq 0 ]; then + python3 scripts/ralph_gitea_sync.py sync +else + python3 scripts/ralph_gitea_sync.py sync --reset-in-progress +fi exit "$ralph_status" diff --git a/scripts/ralph_gitea_sync.py b/scripts/ralph_gitea_sync.py index 3bbbefd..d181503 100644 --- a/scripts/ralph_gitea_sync.py +++ b/scripts/ralph_gitea_sync.py @@ -114,6 +114,7 @@ def main() -> int: parser.add_argument("--feature-dir", type=Path, default=DEFAULT_FEATURE) parser.add_argument("--repo-url", default="https://git.d-popov.com/popov/neuron-tai") parser.add_argument("--dry-run", action="store_true") + parser.add_argument("--reset-in-progress", action="store_true", help="Do not claim a next story after a failed Ralph start") args = parser.parse_args() feature = args.feature_dir.resolve() @@ -167,7 +168,7 @@ def main() -> int: milestones[title] = {"id": -len(milestones), "title": title} passed = {s["id"] for s in stories if s.get("passes")} - next_story = next( + next_story = None if args.reset_in_progress else next( ( s for s in stories @@ -194,6 +195,9 @@ def main() -> int: else: issue = gitea.request("PATCH", f"/issues/{issue['number']}", payload) print(f"reconciled {sid} #{issue.get('number')} {desired_status}") + # Gitea's issue PATCH does not reliably replace labels; use the + # dedicated endpoint so stale status:in-progress labels are removed. + gitea.request("PUT", f"/issues/{issue['number']}/labels", {"labels": label_ids}) mapping[sid] = {"number": issue.get("number"), "url": issue.get("html_url"), "state": "closed" if story.get("passes") else "open", "status": desired_status} if not args.dry_run: