Skip to content

perf(pr-pipeline): sweep only recently updated issues hourly, every open issue once a day - #13494

Merged
kyle-sexton merged 2 commits into
mainfrom
perf/13491-incremental-status-sweep
Nov 5, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
perf/13491-incremental-status-sweep

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

No related issue: a hub efficiency follow-up to #13491, the Work status catch-all mirror, which is already done, asked for event-driven work and frugal GitHub calls.

Summary

The hourly sync-status sweep in work-unblock.yml read every open issue each run. The first run spent 430 lanes App calls, about 10k a day, for a backstop: label events already mirror each status change as it lands. The sweep now reads only issues updated in the last two hours, and reads every open issue once a day.

Fix

  • sweep() takes an optional since (ISO time) and passes it to the REST issues listing (since filters on updated_at, and a label change updates an issue).
  • sweepSince(now) returns now minus two hours, a window that covers a late scheduled run. In the FULL_SWEEP_HOUR (04 UTC) run it returns undefined, for a full sweep that catches any other drift.

Verification

Related

#13491 (closed; evidence comments), #7577 (parent).

🤖 Generated with Claude Code

…pen issue once a day

Label events already mirror each status change, so the hourly sync-status
sweep only needs what they missed. It now lists open issues updated in the
last two hours (REST issues `since`), and reads every open issue once a
day in the 04:00 UTC run. The first full sweep spent 430 calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 5, 2026 11:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T11:17:59.325935Z 2dba68a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 2dba68a3a8ea1895af35e5976e910e8cf7c0c85e; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed d7620e39bcb329694355dc4e2ba1f4ae1591702e: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, blocking only): sync-status full sweep chosen by cron entry

This was an incremental review covering 2dba68a..d7620e3. I read every hunk of all 3 files in scope: sync-status.mjs, sync-status.test.mjs and work-unblock.yml. An earlier head was already reviewed, so this pass reports blocking findings only.

Result: no blocking findings.

Both earlier findings are addressed:

  • Full sweep tied to the clock (settled thread, line 147). The daily full sweep now depends on which cron entry fired, not on the hour the run starts. The workflow has two entries, 47 0-3,5-23 * * * and 47 4 * * *. It passes github.event.schedule to the script as SCHEDULE, and sweepSince returns undefined when that equals FULL_SWEEP_CRON. A late start of the 04:47 run therefore still sweeps every open issue. A dropped run still loses that day's full sweep, but no trigger-based design can avoid that.
  • Doc drift (summary finding). The module header and both work-unblock.yml comments now describe the two-hour window for the hourly run and the daily full sweep.

Checked, no problem found:

  • The two entries together still fire once an hour, as 47 * * * * did. No other job in work-unblock.yml checks github.event.schedule: the other scheduled jobs test only github.event_name == 'schedule', so their behaviour is unchanged.
  • On issues and workflow_run events SCHEDULE is empty, and that code path never calls sweepSince.
  • The new test reads the workflow file. It checks that the daily entry matches FULL_SWEEP_CRON and that SCHEDULE is passed, so the two can't drift apart without the test failing.
  • No other test or script in .github/scripts reads work-unblock.yml's cron entries, so none is broken by the split.

Notes:

  • I ran nothing. The author's test counts (sync-status 11/11, etc.) are their claim, not verified here.
  • The PR description still names FULL_SWEEP_HOUR and sweepSince(now), which this push replaced. That is PR-body text, not code, so it is not counted as a finding.
  • There is no closing issue, so there are no acceptance criteria to check. No embedded instructions were found in the PR context, settled threads or prior findings.
  • No plugin manifest changes.
  • Spend: none added. The schedule still fires once an hour, and the change only lowers lanes App REST calls.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed d7620e39bcb329694355dc4e2ba1f4ae1591702e: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #13494 (incremental, 2dba68a → d7620e3)

I found no security issues in this push. I read every hunk of the 3 files in scope: .github/scripts/work-unblock/sync-status.mjs, .github/scripts/work-unblock/sync-status.test.mjs and .github/workflows/work-unblock.yml. The workflow matches a trusted-path glob, so I read its whole change and what it gates. This lane had already reviewed an earlier head, so this review covered blocking findings only (CRITICAL and IMPORTANT).

What changed: the single 47 * * * * cron is now two entries, 47 0-3,5-23 * * * and 47 4 * * *. The sync-status step passes github.event.schedule as SCHEDULE. sweepSince now sweeps every open issue when SCHEDULE equals FULL_SWEEP_CRON ("47 4 * * *"), and only issues updated in the last two hours otherwise. This is the fix for the earlier advisory thread about late runs, which is now settled.

What I checked:

  • Expression injection: github.event.schedule reaches the step through env: (work-unblock.yml#L475), not inline in run:. Its value is one of this workflow's own cron strings on the default branch, so no attacker controls it. The script only compares it for equality (sync-status.mjs#L148-L149). Any other value falls back to the windowed sweep, which is the narrower behaviour.
  • Gates on other jobs: no job in work-unblock.yml matches on the exact cron string. The schedule gates are github.event_name == 'schedule' && github.ref == 'refs/heads/main' (L124, L176, L353) and the EVENT_NAME = schedule check (L414). Both new entries still fire every gated job once an hour, as before, so no job is dropped or newly opened.
  • Trust controls: unchanged.
    • The kill-switch input (KILL_SWITCH) is untouched.
    • Trusted actors still come from .base/.github/standards/trusted-actors/trusted-actors.json.
    • The token request, its scope and CALL_BUDGET are unchanged.
    • The test file only reads the workflow file to pin the cron and env line, and has no runtime effect.
  • Embedded text: neither the PR context nor the settled threads contain instructions aimed at the review.
  • Spend: the workflow still runs 24 times a day, and the full sweep still runs once a day. This uses no new lanes App API calls and adds no charge.

critical-findings: 0

The full sweep ran only when a scheduled run started inside the 04 UTC
hour, so a late or dropped 04:47 run skipped it for the day. The schedule
now has its own daily entry (47 4 * * *), the job passes the firing entry
as SCHEDULE, and the script sweeps in full when that entry fired. Comments
describing the hourly run now say it covers recently updated issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 83f9bf9 Nov 5, 2026
48 checks passed
@kyle-sexton
kyle-sexton deleted the perf/13491-incremental-status-sweep branch November 5, 2026 11:37
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/work-unblock/sync-status.mjs 5 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/work-unblock/sync-status.mjs:152 other productive input-gap
.github/scripts/work-unblock/sync-status.mjs:177 SBR productive input-gap

The run's summary has the full report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant