@@ -961,7 +961,7 @@ jobs:
961961 for run_status in in_progress pending queued waiting requested; do
962962 gh api "repos/${{ github.repository }}/actions/runs?per_page=100&status=${run_status}" \
963963 --paginate \
964- --jq '.workflow_runs[] | {databaseId:.id, workflowName:.name , displayTitle:.display_title, status:.status, createdAt:.created_at, updatedAt:.updated_at}' 2>/dev/null \
964+ --jq '.workflow_runs[] | {databaseId:.id, workflowPath:.path , displayTitle:.display_title, status:.status, createdAt:.created_at, updatedAt:.updated_at}' 2>/dev/null \
965965 || true
966966 done
967967 } | jq -s 'unique_by(.databaseId)'
@@ -970,19 +970,19 @@ jobs:
970970 STALE_QUEUED_CUTOFF="$(date -u -d '6 hours ago' '+%Y-%m-%dT%H:%M:%SZ')"
971971 active_run_count() {
972972 printf '%s' "$ACTIVE_RUNS_JSON" \
973- | WORKFLOW_NAME ="$1" STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq '[.[] | select(.workflowName == env.WORKFLOW_NAME ) | select(.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF)))] | length' 2>/dev/null \
973+ | WORKFLOW_PATH ="$1" STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq '[.[] | select(.workflowPath == env.WORKFLOW_PATH ) | select(.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF)))] | length' 2>/dev/null \
974974 || printf '0'
975975 }
976976 active_sweep_exact_count() {
977977 printf '%s' "$ACTIVE_RUNS_JSON" \
978- | STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq '[.[] | select(.workflowName == "ClawSweeper ") | select((.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF))) and (.displayTitle | startswith("Review event item ")))] | length' 2>/dev/null \
978+ | STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq '[.[] | select(.workflowPath == ".github/workflows/sweep.yml ") | select((.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF))) and (.displayTitle | startswith("Review event item ")))] | length' 2>/dev/null \
979979 || printf '0'
980980 }
981981 active_sweep_background_workers() {
982982 local runs total id title status jobs_json active_shards total_shards
983983 total=0
984984 runs="$(printf '%s' "$ACTIVE_RUNS_JSON" \
985- | CURRENT_RUN_ID="${GITHUB_RUN_ID:-0}" STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq -r '.[] | select((.databaseId | tostring) != env.CURRENT_RUN_ID) | select(.workflowName == "ClawSweeper ") | select(.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF))) | select(.displayTitle == "Review ClawSweeper items" or .displayTitle == "Review hot ClawSweeper items" or (.displayTitle | startswith("Review target repo ")) or (.displayTitle | startswith("Review hot target repo "))) | [.databaseId, .displayTitle, .status] | @tsv' 2>/dev/null || true)"
985+ | CURRENT_RUN_ID="${GITHUB_RUN_ID:-0}" STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq -r '.[] | select((.databaseId | tostring) != env.CURRENT_RUN_ID) | select(.workflowPath == ".github/workflows/sweep.yml ") | select(.status == "in_progress" or ((.status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested") and ((.updatedAt // .createdAt // "") >= env.STALE_QUEUED_CUTOFF))) | select(.displayTitle == "Review ClawSweeper items" or .displayTitle == "Review hot ClawSweeper items" or (.displayTitle | startswith("Review target repo ")) or (.displayTitle | startswith("Review hot target repo "))) | [.databaseId, .displayTitle, .status] | @tsv' 2>/dev/null || true)"
986986 while IFS=$'\t' read -r id title status; do
987987 if [ -z "$id" ]; then
988988 continue
@@ -1022,8 +1022,8 @@ jobs:
10221022 normal_active_floor="$(limit review_shards.normal_active_floor)"
10231023 hard_shard_cap="$(limit review_shards.hard_cap)"
10241024 commit_page_size="$(limit commit_review.page_size_default)"
1025- active_critical_workers="$(( $(active_run_count "repair cluster worker") + $(active_sweep_exact_count) ))"
1026- active_background_workers="$(( $(active_run_count "ClawSweeper Commit Review ") * commit_page_size + $(active_sweep_background_workers) ))"
1025+ active_critical_workers="$(( $(active_run_count ".github/workflows/ repair- cluster- worker.yml ") + $(active_sweep_exact_count) ))"
1026+ active_background_workers="$(( $(active_run_count ".github/workflows/commit-review.yml ") * commit_page_size + $(active_sweep_background_workers) ))"
10271027 hot_intake_shards="$(worker_limit hot_intake --active-critical "$active_critical_workers" --active-background "$active_background_workers")"
10281028 normal_shards="$(worker_limit normal_review --active-critical "$active_critical_workers" --active-background "$active_background_workers")"
10291029 hot_intake="${{ ((github.event_name == 'repository_dispatch' && github.event.client_payload.hot_intake == 'true') || (github.event_name == 'workflow_dispatch' && github.event.inputs.hot_intake == 'true') || (github.event_name == 'schedule' && (github.event.schedule == '*/5 * * * *' || github.event.schedule == '2/5 * * * *'))) && 'true' || 'false' }}"
@@ -2645,7 +2645,11 @@ jobs:
26452645 set -euo pipefail
26462646 hot_intake_shards="$(pnpm run --silent workflow -- limit review_shards.hot_intake_default)"
26472647 normal_shards="$(pnpm run --silent workflow -- limit review_shards.normal_default)"
2648- runs_json="$(gh run list --repo "${{ github.repository }}" --limit 100 --json workflowName,displayTitle,status,createdAt,updatedAt)"
2648+ runs_json="$({
2649+ gh api "repos/${{ github.repository }}/actions/runs?per_page=100" \
2650+ --jq '.workflow_runs[] | {databaseId:.id, workflowPath:.path, displayTitle:.display_title, status:.status, createdAt:.created_at, updatedAt:.updated_at}' 2>/dev/null \
2651+ || true
2652+ } | jq -s 'unique_by(.databaseId)')"
26492653 eval "$(
26502654 RUNS_JSON="$runs_json" node <<'NODE'
26512655 const runs = JSON.parse(process.env.RUNS_JSON || "[]");
@@ -2661,7 +2665,7 @@ jobs:
26612665 }
26622666 function recent(title, windowMs) {
26632667 return runs.some((run) => {
2664- if (run.workflowName !== "ClawSweeper ") return false;
2668+ if (run.workflowPath !== ".github/workflows/sweep.yml ") return false;
26652669 if (run.displayTitle !== title) return false;
26662670 if (activeRun(run)) return true;
26672671 const createdAt = Date.parse(String(run.createdAt || ""));
0 commit comments