Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

skills(running-tend): poll rerun jobs, not the parent run (#2449)

Worktrunk Bot26addd989fe8
diff --git a/.claude/skills/running-tend/SKILL.md b/.claude/skills/running-tend/SKILL.md
index 94786bb49..6240e407c 100644
--- a/.claude/skills/running-tend/SKILL.md
+++ b/.claude/skills/running-tend/SKILL.md
@@ -108,6 +108,45 @@ failure, not a broken link:
When in doubt, post a comment on the failed run summarizing the diagnosis and
wait — don't open a PR.
+## Polling `gh run rerun --failed`
+
+After `gh run rerun <run-id> --failed`, poll the rerun jobs directly — the
+parent run's `.status` stays `in_progress` until every sibling job finishes,
+including unrelated long-running ones.
+
+```bash
+gh run rerun <run-id> --failed --repo "$REPO"
+
+# New attempt records take a few seconds to surface; without this sleep,
+# the next query can see only the prior `failure` rows and exit immediately.
+sleep 10
+
+# `?filter=latest` returns each job's most recent attempt. Avoid `!=` in
+# --jq filters: the Bash tool rewrites `!` to `\!`, which jq rejects. Use
+# `== "completed" | not` instead.
+JOB_IDS=$(gh api "repos/$REPO/actions/runs/<run-id>/jobs?filter=latest" \
+ --jq '.jobs[] | select((.status == "completed") | not) | .id')
+
+# Rollup poll: one pass checks all reran jobs together and exits when the
+# last one is terminal.
+pending_jobs() {
+ local n=0
+ for id in $JOB_IDS; do
+ s=$(gh api "repos/$REPO/actions/jobs/$id" --jq '.status')
+ [ "$s" = "completed" ] || n=$((n + 1))
+ done
+ echo "$n"
+}
+for i in $(seq 1 15); do
+ [ "$(pending_jobs)" -eq 0 ] && break
+ sleep 60
+done
+```
+
+The bundled `running-in-ci` `pending()` recipe (statusCheckRollup) does not
+help — sibling check-runs on the head SHA still appear pending. Polling
+specific job IDs is the only fix.
+
## Applying GitHub Suggestions
Apply the literal suggestion only — change the lines it covers, nothing more.