fix(mantis): skip zombie telegram queue runs · openclaw/openclaw@1f794d2
obviyus
·
2026-05-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -309,8 +309,18 @@ jobs:
|
309 | 309 | set -euo pipefail |
310 | 310 | current_created="$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" --jq .created_at)" |
311 | 311 | stale_before="$(date -u -d '8 hours ago' +%Y-%m-%dT%H:%M:%SZ)" |
| 312 | + run_has_active_jobs() { |
| 313 | + local run_id="$1" |
| 314 | + local run_state="$2" |
| 315 | + if [[ "$run_state" != "in_progress" ]]; then |
| 316 | + return 0 |
| 317 | + fi |
| 318 | + local active_jobs |
| 319 | + active_jobs="$(gh run view "$run_id" --repo "$GITHUB_REPOSITORY" --json jobs --jq '[.jobs[] | select(.status == "queued" or .status == "in_progress" or .status == "waiting" or .status == "pending" or .status == "requested")] | length')" |
| 320 | + [[ "$active_jobs" != "0" ]] |
| 321 | + } |
312 | 322 | while true; do |
313 | | - blockers="$( |
| 323 | + candidates="$( |
314 | 324 | for workflow in mantis-telegram-desktop-proof.yml mantis-telegram-live.yml; do |
315 | 325 | for status in queued in_progress waiting pending requested; do |
316 | 326 | gh run list --repo "$GITHUB_REPOSITORY" --workflow "$workflow" --status "$status" --limit 100 --json databaseId,status,createdAt,url \ |
@@ -322,6 +332,12 @@ jobs:
|
322 | 332 | done |
323 | 333 | done | sort -u |
324 | 334 | )" |
| 335 | + blockers="" |
| 336 | + while IFS=$'\t' read -r created run_id run_state url; do |
| 337 | + if [[ -n "$run_id" ]] && run_has_active_jobs "${run_id#\#}" "$run_state"; then |
| 338 | + blockers+="${created}"$'\t'"${run_id}"$'\t'"${run_state}"$'\t'"${url}"$'\n' |
| 339 | + fi |
| 340 | + done <<<"$candidates" |
325 | 341 | if [[ -z "$blockers" ]]; then |
326 | 342 | break |
327 | 343 | fi |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -273,8 +273,18 @@ jobs:
|
273 | 273 | set -euo pipefail |
274 | 274 | current_created="$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" --jq .created_at)" |
275 | 275 | stale_before="$(date -u -d '8 hours ago' +%Y-%m-%dT%H:%M:%SZ)" |
| 276 | + run_has_active_jobs() { |
| 277 | + local run_id="$1" |
| 278 | + local run_state="$2" |
| 279 | + if [[ "$run_state" != "in_progress" ]]; then |
| 280 | + return 0 |
| 281 | + fi |
| 282 | + local active_jobs |
| 283 | + active_jobs="$(gh run view "$run_id" --repo "$GITHUB_REPOSITORY" --json jobs --jq '[.jobs[] | select(.status == "queued" or .status == "in_progress" or .status == "waiting" or .status == "pending" or .status == "requested")] | length')" |
| 284 | + [[ "$active_jobs" != "0" ]] |
| 285 | + } |
276 | 286 | while true; do |
277 | | - blockers="$( |
| 287 | + candidates="$( |
278 | 288 | for workflow in mantis-telegram-desktop-proof.yml mantis-telegram-live.yml; do |
279 | 289 | for status in queued in_progress waiting pending requested; do |
280 | 290 | gh run list --repo "$GITHUB_REPOSITORY" --workflow "$workflow" --status "$status" --limit 100 --json databaseId,status,createdAt,url \ |
@@ -286,6 +296,12 @@ jobs:
|
286 | 296 | done |
287 | 297 | done | sort -u |
288 | 298 | )" |
| 299 | + blockers="" |
| 300 | + while IFS=$'\t' read -r created run_id run_state url; do |
| 301 | + if [[ -n "$run_id" ]] && run_has_active_jobs "${run_id#\#}" "$run_state"; then |
| 302 | + blockers+="${created}"$'\t'"${run_id}"$'\t'"${run_state}"$'\t'"${url}"$'\n' |
| 303 | + fi |
| 304 | + done <<<"$candidates" |
289 | 305 | if [[ -z "$blockers" ]]; then |
290 | 306 | break |
291 | 307 | fi |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -120,7 +120,10 @@ describe("Mantis Telegram Desktop proof workflow", () => {
|
120 | 120 | expect(step.run).toContain("for status in queued in_progress waiting pending requested"); |
121 | 121 | expect(step.run).toContain("stale_before="); |
122 | 122 | expect(step.run).toContain(".createdAt >= $stale_before"); |
123 | | -expect(step.run).not.toContain('select(.status == "queued"'); |
| 123 | +expect(step.run).toContain("run_has_active_jobs()"); |
| 124 | +expect(step.run).toContain('gh run view "$run_id"'); |
| 125 | +expect(step.run).toContain("${run_id#\\#}"); |
| 126 | +expect(step.run).not.toContain('.[] | select(.status == "queued"'); |
124 | 127 | expect(step.run).toContain("sleep 60"); |
125 | 128 | } |
126 | 129 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。