Repository navigation
ci(audits): one proactive audit a night, with quota gate and carry-over - #5404
Conversation
|
Verdict: Approve with suggestions The three proactive Claude audits now take turns, one per night, instead of all running every night and exhausting the weekly Claude quota mid-week. Each run checks the account before starting work and resumes from its last successful run, so a lost night's commits and guides are picked up on the next turn rather than skipped. The design holds up, and nothing blocks the merge. One gap: the security audit's final step wasn't given the "stop if Claude is out of quota" guard that the other two audits got. On a night with no quota it still fails, but with the misleading "the audit did not run" error the PR is meant to replace. It's a one-line fix. Real-world evidenceN/A: this PR only changes CI workflows, scripts and tests, and no evidence bundle was produced. The changes only run on GitHub Actions after merge, so the verdict rests on static review. pytest wasn't available on this review runner and no CI test results were visible, so the new unit tests weren't run here either. The PR's post-merge dry-run checklist is the right way to confirm it on GitHub Actions. 🔍 Technical details🟢 The security audit's synthesis job isn't gated on preflight success ( 🟢 A hand dispatch with Strengths
|
The code and security audits failed 5 of the last 10 nights and the doc walkthrough 4 of its last 5 runs, mostly because three audits spent both Claude accounts' weekly cap mid-week. Every lens was then refused in under a second and the runs blamed a missing artifact, and each failed night's work was silently skipped. - claude-audit-rotation.yml is now the only scheduler: one audit a night at 10:13 UTC (2-3am Pacific all year), picked by epoch-day mod 3, so each audit runs every third night. Adding an audit is one line in scripts/audit/audit_rotation.py. - Each audit probes Claude once before any lens or self-hosted job and stops with the account and reset time in its summary (require_claude.py). - Each audit scopes itself from its own last successful rotation run: the code audit reviews everything since then (deep sweep when the last one is over 8 days old), the walkthrough walks the 10 guides that waited longest or that a recent merge changed (audit_history.py). - Each audit writes recent-changes.md (merged PRs since its last run's commit, capped at 30 KB) and reads missed_bug_classes.md, checklists for the bug classes fix PRs show audits missing; miss_analysis.py refreshes its evidence. - Dedup: closed duplicates hand their keys to the open canonical, and backlog matching reads an audit issue's own keys, not just its title. Both syntheses share one filing concurrency group. - Walkthrough: provisions a pinned PortableGit where a runner has no Git Bash, fixes the literal \n that broke dry runs, and caps a guide at 50 min. start-lemonade.ps1 no longer appends UTF-16 to GITHUB_OUTPUT, which corrupted the executor step's output. - Security audit: semgrep and the worklist now cover TypeScript, Go, the installer scripts and the workflows.
356279c to
e41a01a
Compare
…unded queries One doc guide that failed every turn stopped all ten from being recorded, so the walkthrough rotation was stuck on the same guides. A partial night is now filed and each guide is judged by its own matrix job. A guide that fails 3 turns running while others finish is backed off to one retry every 9 days and flagged loudly. A night where every guide failed is not held against any of them. - "Changed since its last walk" uses each guide's own last-walked commit, and changed guides take at most half the slots. - Security synthesis now requires preflight to have passed, as the code audit already did, so a refused quota probe no longer reads as "the audit did not run". - An explicit mode=normal dispatch never escalates to a deep sweep. With no usable history it reviews the last 7 days and the summary says what that leaves out. - Run history reads jobs lazily: newest successful runs only, stopping at the first deep sweep or once every guide is resolved. - Closed duplicates are read from GitHub's MarkedAsDuplicateEvent as well as "Duplicate of #N" text, via small paged GraphQL queries that fail at a hard cap. - recent_changes looks up exactly the PRs the window's commits name (capped at 150, stated in the file) instead of a 1000-PR search. - A refused quota probe now dispatches claude-account-switch.yml. The rotation starts audits with GITHUB_TOKEN, and GitHub does not document workflow_run firing for such a run's completion.
|
Verdict: Approve with suggestions This replaces three nightly Claude audits with one audit a night, rotating between them. Each run checks first that Claude has quota, and when a night is lost to the usage limit, the next turn of that audit picks up its work. I traced the main failure paths and they all hold: a refused probe stops the run before any lens or Strix Point runner starts, and it asks the account switch to run. A failed night doesn't move the window forward, and the walkthrough no longer throws away a whole night because one guide failed. Nothing blocks merge. The two notes below are small robustness gaps in the new "recent changes" summary. Real-world evidenceN/A: CI and workflow change only. No evidence bundle was produced, and the new workflows can only run after merge (the PR's test plan lists dispatch dry-runs to do then). The verdict rests on static review. The PR's unit tests could not be run here because pytest isn't installed on this runner. 🔍 Technical detailsIssues 🟢 The recent-changes summary drops file paths for true merge commits ( 🟢 A malformed PR-lookup response passes silently ( 🟢 Older backlog snapshots crash ( Checked and fine
Strengths
|
…pshot A PR lookup that exited 0 with non-JSON output quietly dropped every PR description from the recent-changes file; it now stops the run. A --backlog-file snapshot missing a list is refused by name instead of raising a bare KeyError. git log also passes --diff-merges=first-parent explicitly so a merge commit lists its paths on any git version.
|
Verdict: Approve The three proactive Claude audits now take turns, one a night, instead of all three running every night and using up the weekly quota by mid-week. Each run checks Claude is available before it starts anything, and picks up everything since its last successful run, so a night lost to the limit is covered on the next turn instead of being skipped. All the notes from the two earlier reviews are fixed in the latest commits. I found nothing new that blocks the merge, only one stale comment. Real-world evidenceN/A: this PR changes only CI workflows, audit scripts and tests, and no evidence bundle was produced. The new workflows can only run on GitHub Actions after merge, so the verdict rests on static review. pytest isn't installed on this review runner, so the 277 unit tests weren't run here either. The PR's post-merge dry-run checklist is how to confirm the change on GitHub Actions. 🔍 Technical detailsEarlier findings, now fixed
🟢 The cost-ceiling comment still describes the old cadence ( Checked and fine
Strengths
|
|
Verdict: Approve The three proactive Claude audits now take turns, one per night, instead of all running every night and draining the weekly Claude quota by mid-week. Each audit checks that Claude can answer before it spends anything, and it scopes its work from its own last successful run, so a night lost to the quota is picked up on the audit's next turn. The scheduling, carry-over and gating hold up on a read-through: a quota refusal stops the run before any lens or synthesis job starts, then requests an account switch. I found nothing blocking. Real-world evidenceN/A: this PR changes CI workflows, audit scripts and docs only, and no 🔍 Technical detailsIssues found 🟢 The test plan says "the next six nights" but the summary prints tonight plus five ( What I checked and found sound
Strengths
|
After merging main, the three new quota-probe steps were still pinned to claude-code-action v1.0.240 while every lens, synthesis and account-switch step moved to v1.0.262. The probe would then test a different bundled CLI than the one that resolves the audit model, so it could pass while the lenses fail, or stop a night the lenses could have run. - Bump the probe pins to v1.0.262. - Contract test: every claude-code-action step across the audits and the account switch shares one pin. - Skill: move the label-history paragraph back inside the Naming note; the new sections had split it off under "Missed bug classes".
|
Merged main and fixed one thing the merge exposed: the new quota probes were still on the old claude-code-action version while everything else moved to the newer one, so the probe could have tested a different CLI than the audits actually run. All steps now share one version, and a contract test keeps it that way. 🔍 Technical details
|
…ure text The CI path-coverage check from main read two doc paths in test_audit_synthesis_prep.py as files the unit lane depends on. They are strings inside a synthetic audit backlog, so editing those guides cannot change the test's result.
The proactive Claude reviews were failing about half the time, and each failure was lost. The code and security audits failed 5 of the last 10 nights, and the doc walkthrough failed 4 of its last 5 runs. Running three audits every night used up both Claude accounts' weekly limit by mid-week, so most of those runs stopped before reviewing anything and blamed a missing file. The next run never went back for the missed work. Now one audit runs each night between 2 and 4am Pacific, so each audit runs every third night. Each run checks Claude is available before starting, and says plainly when it isn't. It picks up everything since its last successful run, starts from what merged since then, and checks against the bug types past audits missed. The dedup pass no longer re-files duplicates that were already closed: 34 of them were closed alongside this change.
Test plan
python -m pytest tests/unit/test_audit_synthesis_prep.py tests/unit/test_audit_history.py tests/unit/test_audit_rotation.py tests/unit/test_require_claude.py tests/unit/test_recent_changes.py tests/unit/test_miss_analysis.py tests/unit/test_claude_audit_workflow_contract.py tests/unit/test_closed_duplicates.py -qpasses (277 tests)gh workflow run claude-audit-rotation.yml -R amd/gaia -f dry_run=true. The summary names tonight's audit and the next five nights, and nothing is dispatched.gh workflow run claude-nightly-audit.yml -R amd/gaia -f dry_run=true. Check the preflight summary: the mode, a window reading "since this audit's last successful run", the Claude probe passing, and "Recent changes read first". At the end, "Dry run confirmed: no issue created".gh workflow run claude-weekly-doc-walkthrough.yml -R amd/gaia -f doc_filter=docs/quickstart.mdx -f dry_run=true. The guide is walked, "Using bash.exe from …" appears, and the dry-run watermark step passes (it crashed before this change).gh workflow run claude-security-audit.yml -R amd/gaia. Semgrep scanstui,installerand.github/workflows, and the SARIF uploads.audit-cluster/audit-keymarkers.🔍 Technical details
Root causes (last ~2 weeks)
is_errorin under a second with "You've hit your weekly limit". The primary account ran out on Oct 10, the secondary on Oct 12–14, both on Oct 17. The account switch fired correctly; both accounts were spent.xsj-aimlab-stxpimages have no Git for Windows (only WSL'sbash.exe). Also on Oct 5, the executor step'sGITHUB_OUTPUTgot UTF-16 appended bystart-lemonade.ps1under PowerShell 5.1>>. Sep 21–28: Application Control blockedLemonadeServer.exeand the job landed on Strix Halo machines; both were fixed by the move to thexsj-dispatchpool on Oct 1.\nmid-command, sodry_run=truealways failed.Schedule. One cron,
13 10 * * *= 03:13 PDT / 02:13 PST. Only 10:00–11:00 UTC is inside 2–4am Pacific in both seasons. Slot = days since epoch mod 3 → code audit, security audit, doc walkthrough. The audits lost their own crons;workflow_dispatchstill runs any of them on demand. Deep code sweep: whenever the last successful one is over 8 days old (every third turn, retried on the next turn if it fails).Dedup bug. The 2026-09-07 burst (78 issues) predates the dedup pass: the run checked out main 7 hours before #3310 merged. Three duplicate pairs still got through after #3310 (#3832/#3471, #3825/#3414, #5199/#4875). Backlog matching compared findings against issue titles only, so a same-section duplicate worded differently scored 0.05–0.15, below the 0.18 threshold. Now matching includes each audit issue's own markers (all 13 known pairs rank 1st–2nd). Closed duplicates hand their keys to the open canonical, so consolidating into #1077/#4331 does not trigger re-filing. Both syntheses share the
claude-audit-issue-filingconcurrency group. The security audit files to private code scanning, not issues, so it cannot duplicate the other two.Closed as duplicates (34): into #4331: #3204 #3413 #3422 #3439 #3466 #3476. Into #1077: #3173 #3412 #3418 #3426 #3429 #3430 #3433 #3437 #3442 #3449 #3454 #3455 #3464 #3468 #3475 #3477 #3482. Into #3198: #3436 #3462. Others: #3425→#3169, #3457→#3195, #3440→#3180, #3486→#3064, #3471→#3832, #3414→#3825, #3434 #3485→#3219, #5199→#4875.
Miss-analysis (merged
fixPRs, Jun 21–Oct 19). 29 of 1005 (3%) closed an issue an audit filed first. Missed, by title: no deadline 90 (#5346 #5384 #5380), release/CI ordering 71 (#5127 #5147), Windows behaviour 38 (#5018 #5377), dishonest status 36 (#5112 #5317), shared state across processes 34 (#5337 #5282 #5378), model output handling 27 (#4973 #5103), doc drift 27, cold start / non-default setup 26 (#4951 #5130). About 380 more were Agent UI/TUI or agent-behaviour fixes, which a static read rarely catches. Noise: of the audit issues closed as duplicate or not planned, 31 were duplicates of #1077, 12 of the test-coverage umbrella #2988, and 6 each of #4331, #3149, #3308 and #2922. What changed:scripts/audit/missed_bug_classes.mdhas a checklist per class and a "Don't report" list, and all three prompts read it at run time. The code audit gets a deterministic list of calls with no deadline. The security audit's semgrep run and worklist now cover TypeScript, Go, the installer and the workflows.scripts/audit/miss_analysis.pyrefreshes the evidence monthly.Recent changes. Each audit's first job writes
recent-changes.md: first-parent commits since the commit its last successful run checked out, read from the run history, with PR title, a short body excerpt and the paths each touched, capped at 30 KB. If that commit is unknown it covers 3 days and says so.