Skip to content

Commit 4ed05a7

Browse files
committed
perf(scheduler): refill 128-worker review capacity
1 parent f7e8b13 commit 4ed05a7

17 files changed

Lines changed: 162 additions & 108 deletions

‎.github/workflows/sweep.yml‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ on:
7474
shard_count:
7575
description: "Parallel shards (capped by config/automation-limits.json)"
7676
required: false
77-
default: "22"
77+
default: "89"
7878
item_number:
7979
description: "Optional single issue/PR number to review"
8080
required: false
@@ -139,7 +139,7 @@ env:
139139
CLAWSWEEPER_MODEL: internal
140140

141141
concurrency:
142-
group: ${{ (github.event_name == 'schedule' && (github.event.schedule == '4/15 * * * *' || github.event.schedule == '41 * * * *' || github.event.schedule == '37 */6 * * *')) && format('clawsweeper-target-fanout-{0}', github.event.schedule || github.run_id) || github.event_name == 'repository_dispatch' && format('clawsweeper-event-{0}-{1}', github.event.client_payload.target_repo || 'openclaw/openclaw', github.event.client_payload.item_number || github.run_id) || format('{0}-{1}', (github.event_name == 'schedule' && github.event.schedule == '13 * * * *') && 'clawsweeper-failed-review-retry' || ((github.event_name == 'workflow_dispatch' && github.event.inputs.apply_existing == 'true' && github.event.inputs.apply_sync_comments_only == 'true') || (github.event_name == 'schedule' && github.event.schedule == '6,21,36,51 * * * *')) && 'clawsweeper-comment-sync' || ((github.event_name == 'workflow_dispatch' && github.event.inputs.apply_existing == '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 * * * *'))) && 'clawsweeper-apply' || (github.event_name == 'workflow_dispatch' && (github.event.inputs.item_number != '' || github.event.inputs.item_numbers != '')) && format('clawsweeper-intake-exact-{0}', github.event.inputs.item_number || github.event.inputs.item_numbers) || ((github.event_name == 'workflow_dispatch' && github.event.inputs.hot_intake == 'true') || (github.event_name == 'schedule' && (github.event.schedule == '*/5 * * * *' || github.event.schedule == '2/5 * * * *'))) && 'clawsweeper-intake-v2' || ((github.event_name == 'workflow_dispatch' && github.event.inputs.audit_dashboard == 'true') || (github.event_name == 'schedule' && (github.event.schedule == '7 */6 * * *' || github.event.schedule == '12 */6 * * *' || github.event.schedule == '17 */6 * * *'))) && 'clawsweeper-audit' || 'clawsweeper-review', github.event.inputs.target_repo || github.event.client_payload.target_repo || ((github.event.schedule == '17 */6 * * *') && 'openclaw/clawsweeper' || ((github.event.schedule == '2/5 * * * *' || github.event.schedule == '22 * * * *' || github.event.schedule == '8,23,38,53 * * * *' || github.event.schedule == '12 */6 * * *') && 'openclaw/clawhub' || 'openclaw/openclaw'))) }}
142+
group: ${{ (github.event_name == 'schedule' && (github.event.schedule == '4/15 * * * *' || github.event.schedule == '41 * * * *' || github.event.schedule == '37 */6 * * *')) && format('clawsweeper-target-fanout-{0}', github.event.schedule || github.run_id) || github.event_name == 'repository_dispatch' && format('clawsweeper-event-{0}-{1}', github.event.client_payload.target_repo || 'openclaw/openclaw', github.event.client_payload.item_number || github.run_id) || format('{0}-{1}', (github.event_name == 'schedule' && github.event.schedule == '13 * * * *') && 'clawsweeper-failed-review-retry' || ((github.event_name == 'workflow_dispatch' && github.event.inputs.apply_existing == 'true' && github.event.inputs.apply_sync_comments_only == 'true') || (github.event_name == 'schedule' && github.event.schedule == '6,21,36,51 * * * *')) && 'clawsweeper-comment-sync' || ((github.event_name == 'workflow_dispatch' && github.event.inputs.apply_existing == '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 * * * *'))) && 'clawsweeper-apply' || (github.event_name == 'workflow_dispatch' && (github.event.inputs.item_number != '' || github.event.inputs.item_numbers != '')) && format('clawsweeper-intake-exact-{0}', github.event.inputs.item_number || github.event.inputs.item_numbers) || ((github.event_name == 'workflow_dispatch' && github.event.inputs.hot_intake == 'true') || (github.event_name == 'schedule' && (github.event.schedule == '*/5 * * * *' || github.event.schedule == '2/5 * * * *'))) && format('clawsweeper-intake-v2-{0}', github.run_id) || ((github.event_name == 'workflow_dispatch' && github.event.inputs.audit_dashboard == 'true') || (github.event_name == 'schedule' && (github.event.schedule == '7 */6 * * *' || github.event.schedule == '12 */6 * * *' || github.event.schedule == '17 */6 * * *'))) && 'clawsweeper-audit' || format('clawsweeper-review-{0}', github.run_id), github.event.inputs.target_repo || github.event.client_payload.target_repo || ((github.event.schedule == '17 */6 * * *') && 'openclaw/clawsweeper' || ((github.event.schedule == '2/5 * * * *' || github.event.schedule == '22 * * * *' || github.event.schedule == '8,23,38,53 * * * *' || github.event.schedule == '12 */6 * * *') && 'openclaw/clawhub' || 'openclaw/openclaw'))) }}
143143
cancel-in-progress: ${{ github.event_name == 'repository_dispatch' && github.event.action == 'clawsweeper_target_sweep' }}
144144

145145
jobs:
@@ -826,6 +826,9 @@ jobs:
826826
if: ${{ (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 * * *') || (github.event.schedule == '4/15 * * * *' || github.event.schedule == '41 * * * *' || github.event.schedule == '37 */6 * * *') || github.event.schedule == '13 * * * *'))) && !(github.event_name == 'schedule' && (github.event.schedule == '2/5 * * * *' || github.event.schedule == '22 * * * *') && vars.CLAWSWEEPER_ENABLE_CLAWHUB != '1') && !(github.event_name == 'repository_dispatch' && github.event.client_payload.target_repo == 'openclaw/clawhub' && vars.CLAWSWEEPER_ENABLE_CLAWHUB != '1') }}
827827
runs-on: ubuntu-latest
828828
timeout-minutes: 30
829+
concurrency:
830+
group: ${{ format('clawsweeper-planner-{0}', (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.item_number == '' && github.event.inputs.item_numbers == '')) && (github.event.inputs.target_repo || ((github.event.schedule == '2/5 * * * *' || github.event.schedule == '22 * * * *') && 'openclaw/clawhub' || 'openclaw/openclaw')) || github.run_id) }}
831+
cancel-in-progress: false
829832
outputs:
830833
batch_size: ${{ steps.mode.outputs.batch_size }}
831834
codex_timeout_ms: ${{ steps.mode.outputs.codex_timeout_ms }}
@@ -976,7 +979,7 @@ jobs:
976979
|| printf '0'
977980
}
978981
active_sweep_background_workers() {
979-
local runs total id title status active_shards
982+
local runs total id title status jobs_json active_shards total_shards
980983
total=0
981984
runs="$(printf '%s' "$ACTIVE_RUNS_JSON" \
982985
| 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,17 +988,26 @@ jobs:
985988
continue
986989
fi
987990
active_shards=0
991+
total_shards=0
988992
if [ "$status" = "in_progress" ]; then
989-
active_shards="$(gh run view "$id" --repo "${{ github.repository }}" --json jobs 2>/dev/null \
993+
jobs_json="$(gh run view "$id" --repo "${{ github.repository }}" --json jobs 2>/dev/null || printf '{"jobs":[]}')"
994+
active_shards="$(printf '%s' "$jobs_json" \
990995
| jq '[.jobs[]? | select(.name | startswith("Review shard ")) | select(.status == "in_progress" or .status == "pending" or .status == "queued" or .status == "waiting" or .status == "requested")] | length' 2>/dev/null \
991996
|| printf '0')"
997+
total_shards="$(printf '%s' "$jobs_json" \
998+
| jq '[.jobs[]? | select(.name | startswith("Review shard "))] | length' 2>/dev/null \
999+
|| printf '0')"
9921000
fi
9931001
if ! [[ "$active_shards" =~ ^[0-9]+$ ]]; then
9941002
active_shards=0
9951003
fi
996-
# Planning, publish, queued, and not-yet-expanded matrix runs have not
997-
# created shard jobs yet. Reserve their quiet lane size while they expand.
998-
if [ "$active_shards" -lt 1 ]; then
1004+
if ! [[ "$total_shards" =~ ^[0-9]+$ ]]; then
1005+
total_shards=0
1006+
fi
1007+
# Planning, queued, and not-yet-expanded matrix runs reserve their quiet
1008+
# lane size. Runs with completed shard jobs are publishing and consume no
1009+
# Codex slots, so the next serialized planner may refill that capacity.
1010+
if [ "$active_shards" -lt 1 ] && [ "$total_shards" -lt 1 ]; then
9991011
if [ "$title" = "Review hot ClawSweeper items" ] || [[ "$title" == Review\ hot\ target\ repo\ * ]]; then
10001012
active_shards="$(limit review_shards.hot_intake_default)"
10011013
else

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ checkpoint, and status-only commits are intentionally omitted.
1414

1515
### Changed
1616

17+
- Restored the global Codex worker budget to 128, reserved 24 slots for interactive work and matrix expansion, and let serialized background planners refill capacity while older review waves finish publishing.
1718
- Made ClawSweeper review reports and `proof: sufficient` or `proof: override` the proof-nudge authority, retiring `proof: supplied` and PR-context hygiene labels from proof state. Thanks @hannesrudolph.
1819

1920
### Fixed

‎README.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ source ~/.profile
557557
corepack enable
558558
pnpm install
559559
pnpm run build
560-
pnpm run plan -- --target-repo openclaw/openclaw --batch-size 5 --shard-count 22 --max-pages 250 --codex-model internal --codex-reasoning-effort high
560+
pnpm run plan -- --target-repo openclaw/openclaw --batch-size 5 --shard-count 89 --max-pages 250 --codex-model internal --codex-reasoning-effort high
561561
pnpm run review -- --target-repo openclaw/openclaw --target-dir ../openclaw --batch-size 5 --max-pages 250 --artifact-dir artifacts/reviews --codex-model internal --codex-reasoning-effort high --codex-timeout-ms 600000
562562
pnpm run apply-artifacts -- --target-repo openclaw/openclaw --artifact-dir artifacts/reviews --skip-dashboard
563563
pnpm run audit -- --target-repo openclaw/openclaw --max-pages 250 --sample-limit 25 --update-dashboard
@@ -670,13 +670,13 @@ default, subject to the selected repository profile; pass `target_repo`,
670670
`apply_kind=issue`, or `apply_kind=pull_request` to narrow a manual run.
671671

672672
Scheduled runs cover the configured product profiles. `openclaw/openclaw` runs
673-
normal backfill every 5 minutes with up to 12 review shards when the system is
673+
normal backfill every 5 minutes with up to 89 review shards when the system is
674674
quiet; `openclaw/clawhub` runs on offset review/apply/audit crons so its reports
675675
live under `records/openclaw-clawhub/` without colliding with default repo
676676
records. `openclaw/clawsweeper` has a scheduled read-only audit row and is
677677
available for manual and event self-review smoke tests. Broad hot-intake sweeps
678-
cap scheduled fan-out at 11 one-item shards per run when quiet; manual normal
679-
backfill can use up to 22 shards, while exact event reviews still use one shard.
678+
cap scheduled fan-out at 44 one-item shards per run when quiet; manual normal
679+
backfill can use up to 89 shards, while exact event reviews still use one shard.
680680
Normal review, hot intake, and commit review are
681681
background lanes, so they shrink automatically while repair or exact-item work
682682
is active. Throughput defaults live in
@@ -685,18 +685,18 @@ is active. Throughput defaults live in
685685
### Worker Budget
686686

687687
ClawSweeper has one main capacity knob:
688-
`config/automation-limits.json` -> `workers.max`. The current value is `32`.
689-
Lane limits are derived from that number: normal review defaults to 22 shards
690-
for manual/backstop runs, scheduled normal review gets up to 12 after reserves,
691-
hot intake up to 11 shards, commit review 1 commit per page, and existing
692-
repair/issue implementation lanes use 40% of `workers.max`, currently 12 live
688+
`config/automation-limits.json` -> `workers.max`. The current value is `128`.
689+
Lane limits are derived from that number: normal review defaults to 89 shards
690+
for manual/backstop and scheduled runs, hot intake up to 44 shards, commit
691+
review 6 commits per page, and existing repair/issue implementation lanes use
692+
40% of `workers.max`, currently 51 live
693693
workers. Imported gitcrawl cluster repair allows 2 live workers by default.
694694
Exact-item review, repair, and issue implementation are priority work; normal
695695
review, hot intake, and commit review are background work and automatically
696696
yield when priority work is active. Exact-item runs use a durable Worker queue
697697
that coalesces item deliveries, leases at most 20 concurrent reviews, and admits
698698
up to 16 active exact reviews per target repository. Other lanes retain the
699-
checked-in 32-worker scheduling model.
699+
checked-in 128-worker scheduling model.
700700
Use `workers.max` first when turning total Codex usage up or down; use
701701
`lanes.repair.cluster_max_live_runs` to tune the imported legacy cluster-repair
702702
lane separately, and individual environment overrides only for temporary

‎config/automation-limits.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"workers": {
3-
"max": 32,
4-
"reserve_for_interactive": 8,
5-
"expansion_reserve": 12,
6-
"minimum_background": 4
3+
"max": 128,
4+
"reserve_for_interactive": 16,
5+
"expansion_reserve": 8,
6+
"minimum_background": 16
77
},
88
"lanes": {
99
"exact_review": {

‎dashboard/worker.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ async function statusSnapshot(env) {
17331733
.split(",")
17341734
.map((value) => value.trim())
17351735
.filter(Boolean);
1736-
const budget = numberFrom(env.WORKER_BUDGET, 32);
1736+
const budget = numberFrom(env.WORKER_BUDGET, 128);
17371737
const [runs, completedRuns, filteredActiveRuns] = await Promise.all([
17381738
githubJson(env, `/repos/${repo}/actions/runs?per_page=100`).catch((error) => {
17391739
errors.push(`workflow runs: ${error.message}`);

‎dashboard/wrangler.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CLAWSWEEPER_REPO = "openclaw/clawsweeper"
2929
CLAWSWEEPER_APP_CLIENT_ID = "Iv23liOECG0slfuhz093"
3030
CLAWSWEEPER_CRABFLEET_URL = "https://crabfleet.openclaw.ai"
3131
TARGET_REPOS = "openclaw/openclaw,openclaw/clawhub,openclaw/clawsweeper,openclaw/fs-safe"
32-
WORKER_BUDGET = "32"
32+
WORKER_BUDGET = "128"
3333
WORKER_DETAIL_RUN_LIMIT = "128"
3434
WORKER_JOB_FETCH_CONCURRENCY = "12"
3535
WORKER_JOB_CACHE_TTL_SECONDS = "60"

‎docs/commit-dispatcher.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ CLAWSWEEPER_COMMIT_REVIEW_SETTLE_SECONDS=60
107107
Use `0` for settled manual backfills or a larger value during GitHub event
108108
lag incidents.
109109

110-
Commit review is a background lane. It defaults to 1 commit per workflow page
110+
Commit review is a background lane. It defaults to 6 commits per workflow page
111111
when the system is quiet, but the receiver asks the central worker scheduler for
112112
capacity before each page. Active repair, exact-item review, and sweep work can
113113
lower the page size so commit review does not consume capacity needed by
@@ -116,10 +116,10 @@ maintainer-visible work. The checked-in default comes from
116116
`openclaw/clawsweeper` only when the org has enough rate-limit headroom:
117117

118118
```text
119-
CLAWSWEEPER_COMMIT_REVIEW_PAGE_SIZE=1
119+
CLAWSWEEPER_COMMIT_REVIEW_PAGE_SIZE=6
120120
```
121121

122-
The receiver clamps this between 1 and 32. Setting the variable bypasses the
122+
The receiver clamps this between 1 and 128. Setting the variable bypasses the
123123
dynamic default for that run; leave it unset when the central scheduler should
124124
decide. Large push ranges continue in later workflow pages.
125125

‎docs/commit-sweeper.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ by SHA/range rather than detaching the whole target repository at the commit.
8989

9090
## Scaling
9191

92-
Commit Sweeper is background work. It defaults to 1 commit per workflow page
92+
Commit Sweeper is background work. It defaults to 6 commits per workflow page
9393
when the system is quiet, but the receiver asks the central worker scheduler for
9494
the effective page size before dispatching the matrix. Active repair,
9595
exact-item review, and sweep work can lower commit review to keep capacity
9696
available for maintainer-visible work. The checked-in default lives in
9797
`config/automation-limits.json`. The receiver clamps
98-
`CLAWSWEEPER_COMMIT_REVIEW_PAGE_SIZE` between 1 and 32, then pages large ranges:
98+
`CLAWSWEEPER_COMMIT_REVIEW_PAGE_SIZE` between 1 and 128, then pages large ranges:
9999

100100
- select up to the configured page size
101101
- classify them cheaply

0 commit comments

Comments
 (0)