From 067a11a5e29bbe0e528f519cfe087cc6da1c4112 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Sat, 22 Aug 2026 16:58:18 +0800 Subject: [PATCH 1/2] publish: un-draft an existing release on idempotent re-run gh release create that dies mid-upload leaves the release as a draft with partial/no assets; the existing-release branch re-uploads and edits notes but never published it. heb-diac-small hit this today. --- scripts/publish_model.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/publish_model.py b/scripts/publish_model.py index 42c780f..f15ea66 100644 --- a/scripts/publish_model.py +++ b/scripts/publish_model.py @@ -193,6 +193,12 @@ def main() -> None: print(f"release {tag} exists; re-uploading assets (clobber)") run(["gh", "release", "upload", tag, *[str(a) for a in assets], "--clobber"]) run(["gh", "release", "edit", tag, "--notes-file", notes_path]) + # a create that died mid-upload leaves the release as a draft; + # the re-run must publish it + is_draft = run(["gh", "release", "view", tag, "--json", "isDraft"], + capture_output=True, text=True).stdout + if yaml.safe_load(is_draft): + run(["gh", "release", "edit", tag, "--draft=false"]) else: run(["gh", "release", "create", tag, *[str(a) for a in assets], "--title", tag, "--notes-file", notes_path]) From 734b175cee1b7ce75b418e5556e6964b86298075 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Sat, 22 Aug 2026 17:04:06 +0800 Subject: [PATCH 2/2] publish: retry gh pr create (branch push propagates asynchronously) Failed identically on tha-g2p-small and heb-diac-small: the pr create right after push -u exits 1; a manual retry a minute later succeeds. Three attempts with -R and 20s spacing. --- scripts/publish_model.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/publish_model.py b/scripts/publish_model.py index f15ea66..be073c9 100644 --- a/scripts/publish_model.py +++ b/scripts/publish_model.py @@ -250,8 +250,23 @@ def git_wt(*cmd: str): f"## Test plan\n- [ ] CI green\n- [ ] runtime fetch " f"`Model.load(\"{args.model_id}\")` resolves and verifies\n") body_path = fh.name - run(["gh", "pr", "create", "--title", f"release: {args.model_id}", - "--body-file", body_path]) + # the branch push propagates asynchronously; an immediate + # pr create reliably fails with "head branch not found" + import time + + for attempt in range(3): + proc = subprocess.run( + ["gh", "pr", "create", "-R", args.repo, + "--head", branch, "--title", f"release: {args.model_id}", + "--body-file", body_path], + capture_output=True, text=True, + ) + if proc.returncode == 0: + break + print(f"pr create attempt {attempt + 1} failed: {proc.stderr.strip()}") + time.sleep(20) + else: + raise SystemExit("gh pr create failed after retries") finally: run(["git", "worktree", "remove", "--force", str(worktree)]) print(f"published {args.model_id}: release {tag}, branch {branch}")