Skip to content

Commit a71d082

Browse files
sm0kyclaude
andcommitted
fix: wire stale-PR cadence env through scheduled planner + dashboard
Addresses ClawSweeper's review of #370. The new CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS was read in reviewCadenceMs, but the scheduled planner in .github/workflows/sweep.yml passes an explicit env allowlist to `pnpm run plan`, so setting the documented repository variable would not reach production scheduled runs -- stale PRs would keep the daily cadence after opt-in. Per AGENTS.md, scheduler tuning must update both src/clawsweeper.ts and .github/workflows/sweep.yml. - sweep.yml: pass vars.CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS into the planner `select` step (the only cadence-selection path -- review shards run exact --item-numbers from the plan matrix) and into the dashboard `audit --update-dashboard` step. - clawsweeper.ts: cadenceBucketForReview reuses stalePullRequestReviewCadenceMs so the dashboard "current within cadence" math matches what the planner schedules. - docs/scheduler.md: document the repository-variable wiring. Unset/non-numeric/<= daily keeps the daily default everywhere, so behavior is unchanged unless an operator opts in. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent 5188f97 commit a71d082

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎.github/workflows/sweep.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,7 @@ jobs:
10921092
MAX_PAGES: ${{ steps.mode.outputs.max_pages }}
10931093
MIN_ACTIVE_SHARDS: ${{ steps.mode.outputs.min_active_shards }}
10941094
MIN_BACKFILL_REVIEW_AGE_MINUTES: ${{ steps.mode.outputs.min_backfill_review_age_minutes }}
1095+
CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS: ${{ vars.CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS || '' }}
10951096
TARGET_REPO: ${{ steps.target.outputs.target_repo }}
10961097
GH_TOKEN: ${{ steps.target-read-token.outputs.token || github.token }}
10971098
run: |
@@ -2035,6 +2036,7 @@ jobs:
20352036
env:
20362037
GH_TOKEN: ${{ steps.target-token.outputs.token }}
20372038
TARGET_REPO: ${{ steps.target.outputs.target_repo }}
2039+
CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS: ${{ vars.CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS || '' }}
20382040
run: |
20392041
set -euo pipefail
20402042
git pull --rebase --autostash

‎docs/scheduler.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,12 @@ non-numeric, or at or below the daily cadence keep the default daily behavior,
328328
and the hourly activity and daily hot-window buckets are never affected, so
329329
changed and brand-new pull requests are still reviewed promptly.
330330

331+
Set it as a repository variable (`vars.CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS`);
332+
`.github/workflows/sweep.yml` passes it into both the scheduled planner step and
333+
the dashboard `audit --update-dashboard` step, so scheduled GitHub runs honor it
334+
and the dashboard's "current within cadence" counts stay consistent with what the
335+
planner schedules. Self-hosted/CLI runs read it from the process environment.
336+
331337
The activity check ignores ClawSweeper-owned GitHub mutations that are already
332338
recorded in durable report frontmatter. `review_comment_synced_at` covers public
333339
review comment writes, and `labels_synced_at` covers ClawSweeper label-only

‎src/clawsweeper.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19025,7 +19025,10 @@ function cadenceBucketForReview(
1902519025
return { bucket: "hourlyHotItems", cadenceMs: DAILY_REVIEW_DAYS * DAY_MS };
1902619026
}
1902719027
if (kind === "pull_request") {
19028-
return { bucket: "dailyPullRequests", cadenceMs: DAILY_REVIEW_DAYS * DAY_MS };
19028+
// Mirror reviewCadenceMs: a stale (non-hot) pull request honors the optional
19029+
// CLAWSWEEPER_STALE_PULL_REQUEST_REVIEW_DAYS extension, so the dashboard's
19030+
// "current within cadence" math matches what the planner actually schedules.
19031+
return { bucket: "dailyPullRequests", cadenceMs: stalePullRequestReviewCadenceMs() };
1902919032
}
1903019033

1903119034
if (Number.isFinite(createdAt) && now - createdAt < RECENT_ISSUE_DAYS * DAY_MS) {

0 commit comments

Comments
 (0)