@@ -16,6 +16,12 @@ run-name: >-
1616 (github.event_name == 'repository_dispatch' &&
1717 github.event.action == 'clawsweeper_target_sweep') &&
1818 format('Review target repo {0}', github.event.client_payload.target_repo || 'openclaw/openclaw') ||
19+ (github.event_name == 'repository_dispatch' && github.event.client_payload.queue_lease_id != '') &&
20+ github.event.client_payload.source_action == 'scheduled_hot_intake' &&
21+ format('Review scheduled hot item {0} rev {1}', github.event.client_payload.queue_claim.item_key || github.event.client_payload.item_key || '?', github.event.client_payload.queue_claim.lease_revision || github.event.client_payload.lease_revision || '?') ||
22+ (github.event_name == 'repository_dispatch' && github.event.client_payload.queue_lease_id != '') &&
23+ github.event.client_payload.source_action == 'scheduled_normal_backfill' &&
24+ format('Review scheduled normal item {0} rev {1}', github.event.client_payload.queue_claim.item_key || github.event.client_payload.item_key || '?', github.event.client_payload.queue_claim.lease_revision || github.event.client_payload.lease_revision || '?') ||
1925 (github.event_name == 'repository_dispatch' && github.event.client_payload.queue_lease_id != '') &&
2026 format('Review exact item {0} rev {1} head {2}', github.event.client_payload.queue_claim.item_key || github.event.client_payload.item_key || '?', github.event.client_payload.queue_claim.lease_revision || github.event.client_payload.lease_revision || '?', github.event.client_payload.queue_claim.source_head_sha || github.event.client_payload.source_head_sha || 'na') ||
2127 (github.event_name == 'repository_dispatch' && github.event.client_payload.dispatch_key != '') &&
@@ -2496,6 +2502,13 @@ jobs:
24962502 batch_size : ${{ steps.mode.outputs.batch_size }}
24972503 codex_timeout_ms : ${{ steps.mode.outputs.codex_timeout_ms }}
24982504 hot_intake : ${{ steps.mode.outputs.hot_intake }}
2505+ queue_feed : ${{ steps.mode.outputs.queue_feed }}
2506+ queue_offered : ${{ steps.enqueue-scheduled.outputs.offered || '0' }}
2507+ queue_attempted : ${{ steps.enqueue-scheduled.outputs.attempted || '0' }}
2508+ queue_enqueued : ${{ steps.enqueue-scheduled.outputs.queued || '0' }}
2509+ queue_deduped : ${{ steps.enqueue-scheduled.outputs.deduped || '0' }}
2510+ queue_shed : ${{ steps.enqueue-scheduled.outputs.shed || '0' }}
2511+ queue_deferred : ${{ steps.enqueue-scheduled.outputs.deferred || '0' }}
24992512 matrix : ${{ steps.select.outputs.matrix }}
25002513 max_pages : ${{ steps.mode.outputs.max_pages }}
25012514 min_active_shards : ${{ steps.mode.outputs.min_active_shards }}
@@ -2633,7 +2646,7 @@ jobs:
26332646 for run_status in in_progress pending queued waiting requested; do
26342647 gh api "repos/${{ github.repository }}/actions/runs?per_page=100&status=${run_status}" \
26352648 --paginate \
2636- --jq '.workflow_runs[] | {databaseId:.id, workflowPath:.path, displayTitle:.display_title, status:.status, createdAt:.created_at, updatedAt:.updated_at}' 2>/dev/null \
2649+ --jq '.workflow_runs[] | {databaseId:.id, workflowPath:.path, displayTitle:.display_title, event:.event, status:.status, createdAt:.created_at, updatedAt:.updated_at}' 2>/dev/null \
26372650 || true
26382651 done
26392652 } | jq -s 'unique_by(.databaseId)'
@@ -2646,19 +2659,19 @@ jobs:
26462659 || printf '0'
26472660 }
26482661 active_sweep_exact_workers() {
2649- local runs total id title status jobs_json active_shards total_shards
2662+ local runs total id title status run_event jobs_json active_shards total_shards
26502663 local reserved_shards hard_cap requested_shards item_numbers commas item_count
26512664 total=0
26522665 hard_cap="$(limit review_shards.hard_cap)"
26532666 runs="$(printf '%s' "$ACTIVE_RUNS_JSON" \
2654- | STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq -r '.[] | 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 | startswith("Review event item ")) or (.displayTitle | startswith("Review event items "))) | [.databaseId, .displayTitle, .status] | @tsv' 2>/dev/null || true)"
2655- while IFS=$'\t' read -r id title status; do
2667+ | STALE_QUEUED_CUTOFF="$STALE_QUEUED_CUTOFF" jq -r '.[] | 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 | startswith("Review exact item ")) or (.displayTitle | startswith("Review scheduled hot item ")) or (.displayTitle | startswith("Review scheduled normal item ")) or (. event == "workflow_dispatch" and ((.displayTitle | startswith("Review event item ")) or (.displayTitle | startswith("Review event items "))))) | [.databaseId, .displayTitle, .status, .event ] | @tsv' 2>/dev/null || true)"
2668+ while IFS=$'\t' read -r id title status run_event ; do
26562669 if [ -z "$id" ]; then
26572670 continue
26582671 fi
26592672 active_shards=0
26602673 total_shards=0
2661- if [[ "$title" == Review\ event\ item\ * ]]; then
2674+ if [[ "$title" == Review\ exact\ item\ * ]] || [[ "$title" == Review\ scheduled\ hot\ item\ * ]] || [[ "$title" == Review\ scheduled\ normal\ item\ * ]] || { [ "$run_event" = "workflow_dispatch" ] && [[ "$title" == Review\ event\ item\ * ]]; } ; then
26622675 active_shards=1
26632676 total=$((total + active_shards))
26642677 continue
@@ -2776,6 +2789,7 @@ jobs:
27762789 echo "queue pressure: $pressure_level ($pressure_numbers) — hot_intake $hot_intake_unpressured->$hot_intake_shards, normal_review $normal_unpressured->$normal_shards"
27772790 fi
27782791 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' }}"
2792+ queue_feed="${{ ((github.event_name == 'repository_dispatch' && github.event.action == 'clawsweeper_target_sweep') || github.event_name == 'schedule') && 'true' || 'false' }}"
27792793 target_repo="${{ steps.target.outputs.target_repo }}"
27802794 if [ "$hot_intake" = "true" ] && [ -n "$exact_item" ]; then
27812795 batch_size="1"
@@ -2812,6 +2826,14 @@ jobs:
28122826 min_active_shards="0"
28132827 min_backfill_review_age_minutes="360"
28142828 fi
2829+ if [ "$queue_feed" = "true" ] && [ -z "$exact_item" ]; then
2830+ # The Durable Object turns every selected item into an independent exact-review
2831+ # workflow. Plan a bounded feed batch here; the Worker owns the global 200/hour
2832+ # admission target and queue backpressure across overlapping target sweeps.
2833+ batch_size="20"
2834+ shard_count="1"
2835+ min_active_shards="0"
2836+ fi
28152837 if ! [[ "$shard_count" =~ ^[0-9]+$ ]]; then
28162838 shard_count="$normal_shards"
28172839 fi
@@ -2835,6 +2857,7 @@ jobs:
28352857 echo "batch_size=$batch_size"
28362858 echo "codex_timeout_ms=${{ github.event.client_payload.review_options.codex_timeout_ms || github.event.client_payload.codex_timeout_ms || github.event.inputs.codex_timeout_ms || vars.CLAWSWEEPER_CODEX_TIMEOUT_MS || '1200000' }}"
28372859 echo "hot_intake=$hot_intake"
2860+ echo "queue_feed=$queue_feed"
28382861 echo "max_pages=$max_pages"
28392862 echo "min_active_shards=$min_active_shards"
28402863 echo "min_backfill_review_age_minutes=$min_backfill_review_age_minutes"
@@ -2887,7 +2910,47 @@ jobs:
28872910 --shard-count "$SHARD_COUNT" >> "$GITHUB_OUTPUT"
28882911 cat plan.json
28892912
2913+ - name : Enqueue scheduled review candidates
2914+ id : enqueue-scheduled
2915+ if : ${{ steps.mode.outputs.queue_feed == 'true' && steps.select.outputs.planned_count != '0' }}
2916+ working-directory : clawsweeper
2917+ env :
2918+ CLAWSWEEPER_WEBHOOK_SECRET : ${{ secrets.CLAWSWEEPER_WEBHOOK_SECRET }}
2919+ QUEUE_URL : ${{ vars.CLAWSWEEPER_EXACT_REVIEW_QUEUE_URL || 'https://clawsweeper.openclaw.ai' }}
2920+ run : |
2921+ set -euo pipefail
2922+ lane="normal_backfill"
2923+ if [ "${{ steps.mode.outputs.hot_intake }}" = "true" ]; then
2924+ lane="hot_intake"
2925+ fi
2926+ result="$(pnpm run --silent repair:scheduled-review-enqueue -- \
2927+ --plan plan.json \
2928+ --lane "$lane" \
2929+ --target-repo "${{ steps.target.outputs.target_repo }}" \
2930+ --target-branch "${{ steps.target.outputs.target_branch }}" \
2931+ --queue-url "$QUEUE_URL" \
2932+ --delivery-prefix "scheduled:${{ github.run_id }}:${{ github.run_attempt }}")"
2933+ jq -e '.offered >= .attempted and .attempted >= (.queued + .deduped + .shed + .rejected)' <<<"$result" >/dev/null
2934+ {
2935+ echo "offered=$(jq -r .offered <<<"$result")"
2936+ echo "attempted=$(jq -r .attempted <<<"$result")"
2937+ echo "queued=$(jq -r .queued <<<"$result")"
2938+ echo "deduped=$(jq -r .deduped <<<"$result")"
2939+ echo "shed=$(jq -r .shed <<<"$result")"
2940+ echo "deferred=$(jq -r .deferred <<<"$result")"
2941+ } >> "$GITHUB_OUTPUT"
2942+ {
2943+ echo "### Scheduled review funnel"
2944+ echo
2945+ echo "| Selected | Attempted | Enqueued | Deduped | Shed | Deferred |"
2946+ echo "| ---: | ---: | ---: | ---: | ---: | ---: |"
2947+ echo "| $(jq -r .offered <<<"$result") | $(jq -r .attempted <<<"$result") | $(jq -r .queued <<<"$result") | $(jq -r .deduped <<<"$result") | $(jq -r .shed <<<"$result") | $(jq -r .deferred <<<"$result") |"
2948+ echo
2949+ echo "Selected candidate age (hours): p50 $(jq -r '.ageHours.p50 // "n/a"' <<<"$result"), p90 $(jq -r '.ageHours.p90 // "n/a"' <<<"$result"), oldest $(jq -r '.ageHours.max // "n/a"' <<<"$result")."
2950+ } >> "$GITHUB_STEP_SUMMARY"
2951+
28902952 - name : Prepare review runtime artifact
2953+ if : ${{ steps.mode.outputs.queue_feed != 'true' }}
28912954 working-directory : clawsweeper
28922955 env :
28932956 TARGET_REPO : ${{ steps.target.outputs.target_repo }}
@@ -2901,6 +2964,7 @@ jobs:
29012964 tar -czf .artifacts/review-runtime.tar.gz -C .artifacts/review-runtime .
29022965
29032966 - uses : actions/upload-artifact@v7
2967+ if : ${{ steps.mode.outputs.queue_feed != 'true' }}
29042968 with :
29052969 name : clawsweeper-runtime-dist
29062970 path : clawsweeper/.artifacts/review-runtime.tar.gz
@@ -2909,7 +2973,7 @@ jobs:
29092973 retention-days : 1
29102974
29112975 - name : Publish planning status
2912- if : ${{ (github.event_name != 'workflow_dispatch' || github.event.inputs.apply_existing != 'true') && (steps.mode.outputs.hot_intake != 'true' || github.event.inputs.item_number != '' || github.event.inputs.item_numbers != '') }}
2976+ if : ${{ steps.mode.outputs.queue_feed != 'true' && (github.event_name != 'workflow_dispatch' || github.event.inputs.apply_existing != 'true') && (steps.mode.outputs.hot_intake != 'true' || github.event.inputs.item_number != '' || github.event.inputs.item_numbers != '') }}
29132977 continue-on-error : true
29142978 working-directory : clawsweeper
29152979 env :
@@ -2940,6 +3004,7 @@ jobs:
29403004 review :
29413005 name : Review shard ${{ matrix.shard }} · ${{ needs.plan.outputs.target_repo }}#${{ matrix.item_numbers }}
29423006 needs : plan
3007+ if : ${{ needs.plan.outputs.queue_feed != 'true' }}
29433008 runs-on : ${{ vars.CLAWSWEEPER_REVIEW_RUNNER || 'ubuntu-latest' }}
29443009 timeout-minutes : 75
29453010 continue-on-error : true
@@ -3288,7 +3353,7 @@ jobs:
32883353 publish :
32893354 name : Publish review artifacts
32903355 needs : [plan, review]
3291- if : ${{ always() && needs.plan.result == 'success' && needs.review.result != 'cancelled' && needs.plan.outputs.target_repo != '' && (github.event_name != 'repository_dispatch' || github.event.action == 'clawsweeper_target_sweep') && !((github.event_name == 'workflow_dispatch' && (github.event.inputs.apply_existing == 'true' || github.event.inputs.audit_dashboard == 'true')) || (github.event_name == 'schedule' && ((github.event.schedule == '3 * * * *' || github.event.schedule == '18 * * * *' || github.event.schedule == '33 * * * *' || github.event.schedule == '48 * * * *' || github.event.schedule == '8,23,38,53 * * * *' || github.event.schedule == '6,21,36,51 * * * *') || (github.event.schedule == '7 */6 * * *' || github.event.schedule == '12 */6 * * *' || github.event.schedule == '17 */6 * * *')))) }}
3356+ if : ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.queue_feed != 'true' && needs. review.result != 'cancelled' && needs.plan.outputs.target_repo != '' && (github.event_name != 'repository_dispatch' || github.event.action == 'clawsweeper_target_sweep') && !((github.event_name == 'workflow_dispatch' && (github.event.inputs.apply_existing == 'true' || github.event.inputs.audit_dashboard == 'true')) || (github.event_name == 'schedule' && ((github.event.schedule == '3 * * * *' || github.event.schedule == '18 * * * *' || github.event.schedule == '33 * * * *' || github.event.schedule == '48 * * * *' || github.event.schedule == '8,23,38,53 * * * *' || github.event.schedule == '6,21,36,51 * * * *') || (github.event.schedule == '7 */6 * * *' || github.event.schedule == '12 */6 * * *' || github.event.schedule == '17 */6 * * *')))) }}
32923357 runs-on : ubuntu-latest
32933358 timeout-minutes : 60
32943359 concurrency :
@@ -3860,7 +3925,7 @@ jobs:
38603925 recover-review-failures :
38613926 name : Recover failed review shards
38623927 needs : [plan, review, publish]
3863- if : ${{ always() && needs.plan.result == 'success' && needs.review.result != 'skipped' && !contains(github.event.inputs.additional_prompt || '', '[clawsweeper-recovery-attempt=1]') && needs.plan.outputs.planned_item_numbers != '' && github.event_name != 'repository_dispatch' }}
3928+ if : ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.queue_feed != 'true' && needs. review.result != 'skipped' && !contains(github.event.inputs.additional_prompt || '', '[clawsweeper-recovery-attempt=1]') && needs.plan.outputs.planned_item_numbers != '' && github.event_name != 'repository_dispatch' }}
38643929 runs-on : ubuntu-latest
38653930 timeout-minutes : 10
38663931 permissions :
0 commit comments