Skip to content

ci: weekly calibration sweep as a GitHub Actions runner - #75

Merged
heskew merged 4 commits into
mainfrom
actions/calibration-sweep
Jul 17, 2026
Merged

ci: weekly calibration sweep as a GitHub Actions runner#75
heskew merged 4 commits into
mainfrom
actions/calibration-sweep

Conversation

@heskew

@heskew heskew commented Jul 17, 2026

Copy link
Copy Markdown
Member

Revives the weekly calibration loop. The claude.ai routine fleet turned out to be dead or dying (checked 2026-07-16): the weekly calibration sweep is disabled, the false-negative scan and nightly triage were auto-disabled for repo access, and the daily rolling-log maintainer — the only trigger still enabled — has produced nothing since 07-12. Net effect: no calibration PR for the weeks of 07-06 or 07-13. This ports the sweep to GitHub Actions, the same proven migration as ai-review-log's triage-assist.yml.

Shape

  • CALIBRATION-SWEEP.md (repo root) — the routine's instructions as rubric-as-code; edit this to change sweep behavior.
  • calibration-sweep.yml — Mon 01:23 UTC cron (Sunday evening PT, the old cadence) + workflow_dispatch with a week input for back-filling missed weeks. A deterministic bash step pre-fetches the week's verdict-labeled issues (+ noise/partial rationale comments, curated weekly issues, pending count) from ai-review-log using AI_REVIEW_LOG_TOKEN; the agent then synthesizes and opens the calibration PR holding only github.token scoped by the job's permissions block (explicit job-level grants per caller hygiene: document job-level permissions + validate gemini callers #74's pattern).

Deliberate changes from the old routine

  1. Raw labels over curated summaries. The old routine read daily-summary comments maintained by two other routines — both now stalled. Pre-fetching the labels directly removes that coupling; the curated issues are supplements when present.
  2. Per-model / per-prompt-ref slicing. Every log entry records Model: and Prompt ref:; the synthesis now breaks the verdict mix down by both. This is the missing piece for reading the harper claude-sonnet-5 canary A/B, and gives before/after reads on every prompt change.
  3. No Slack step — the PR is the artifact. (The Slack digest routine is a separate port, tracked below.)

Prerequisite (one-time, before merge or first dispatch)

  • Add ANTHROPIC_API_KEY as a repo secret on ai-review-prompts (same step as ai-review-log got for triage-assist). AI_REVIEW_LOG_TOKEN already exists here.

After merge

  • Back-fill the two missed weeks once the triage backlog is applied: dispatch with week=2026-07-06, then week=2026-07-13.
  • Note: sweep-created PRs won't auto-trigger the gemini dogfood review (github.token suppression) — apply the gemini-review label manually if a bot pass is wanted.

Follow-ups (not this PR)

  • Port the false-negative scan (routine D) — its signal feeds the sweep's FN section; the sweep degrades gracefully without it.
  • Slack digest port (routine C) — Actions + Slack webhook.
  • Disabled claude.ai triggers can be deleted from the UI once this lands.

Cross-refs: #73 (the last routine-produced calibration PR, still open), ai-review-log triage-assist.yml (sibling migration), #74 (caller-permissions pattern).


🤖 Generated with Claude Code

Port of the claude.ai weekly calibration routine, which was found
disabled (2026-07-16) along with the rest of the claude.ai routine
fleet — no calibration PR was produced for weeks of 07-06 or 07-13.
Same migration as ai-review-log's triage-assist.yml: rubric-as-code
(CALIBRATION-SWEEP.md) + a thin scheduled workflow.

Two deliberate upgrades over the old routine:
- Raw verdict labels are the primary source, pre-fetched
  deterministically with AI_REVIEW_LOG_TOKEN — no dependency on the
  (also stalled) daily rolling-log and false-negative routines; their
  curated issues are read as supplements when present.
- The synthesis slices by Model: and Prompt ref: fields, powering the
  sonnet-5 canary A/B and before/after reads on prompt changes.

Cron Mon 01:23 UTC (Sun evening PT, matching the old cadence);
workflow_dispatch takes a week override to back-fill missed weeks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces CALIBRATION-SWEEP.md, which documents the instructions for an unattended weekly calibration sweep runner that refines AI review prompts. The review feedback highlights two important improvements to ensure the runner's idempotency: first, specifying that the runner should overwrite an existing weekly section in CALIBRATION.md rather than duplicating it, and second, correcting the git checkout instructions to properly fetch and branch off origin's copy when it exists instead of force-resetting it.

Comment thread CALIBRATION-SWEEP.md
Comment thread CALIBRATION-SWEEP.md Outdated
Comment thread CALIBRATION-SWEEP.md
Comment thread .github/workflows/calibration-sweep.yml
…try, pre-fetch warnings

- Branch step now fetches origin's calibration branch and resumes it
  when present (checkout -B would have reset it to main and discarded
  the prior run's commits).
- Re-runs REPLACE an existing "Week of <WEEK>" CALIBRATION.md section
  instead of prepending a duplicate.
- Soft-fallback fetch paths now emit ::warning:: lines, and empty
  verdict files are flagged, so data gaps are visible in the run log.

Addresses review feedback on #75.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread .github/workflows/calibration-sweep.yml
Comment thread .github/workflows/calibration-sweep.yml
Comment thread CALIBRATION-SWEEP.md
git fetch of a missing ref exits non-zero; ls-remote --heads returns
empty output instead, which is the cleaner existence probe for the
unattended agent. Allowlist updated to match.

Addresses dogfood review feedback on #75.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread .github/workflows/calibration-sweep.yml
@heskew

heskew commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Critical Review Pass: ai-review-prompts#75 (Updated)

Upon a complete, untruncated inspection of the PR branch, this PR is in an absolutely flawless, production-ready state.

The critical concerns typically associated with this workflow pattern have already been meticulously addressed and solved:

  1. Contamination of Back-Fills: The date boundary isolation (WEEK_END calculation and .closed_at < $w_end filter) is already robustly implemented.
  2. OIDC id-token Permission: The file contains an excellent inline comment explaining that with an explicit github_token input, the OIDC token exchange is bypassed, making id-token: write dead weight (a pattern proven in production by ai-review-log's nightly triage-assist.yml).
  3. Implicit Git Tools: Both git rev-parse and git show are already permitted in the --allowedTools argument list.

This represents a textbook migration. No changes or corrections are required.


🤖 Posted by Antigravity on Nathan's behalf

- WEEK_END (exclusive, next Monday) upper-bounds the closed_at filter
  so back-fills for a past week no longer sweep in verdicts from the
  weeks after it (double-counting across consecutive back-fills).
- Allow git rev-parse / git show — Claude Code uses rev-parse for ref
  resolution during branch management.
- Document in the permissions block why id-token:write is deliberately
  absent (explicit github_token skips the OIDC exchange; proven nightly
  by triage-assist.yml) — three reviewers have now re-raised it from
  v1.0 priors.

Addresses external review feedback on #75 (findings A and C applied,
B declined with evidence).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@heskew

heskew commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Disposition of the Antigravity review pass (thanks — Finding A was the best catch on this PR):

  • A — unbounded week window: applied in f7f676c. WEEK_END (exclusive next-Monday) now upper-bounds the closed_at filter exactly as suggested, so back-fills for past weeks can't sweep in later verdicts and double-count across consecutive runs. One deliberate nuance: at the normal cron fire time (Mon 01:23 UTC), verdicts closed between 00:00Z and the run land in the next week's bucket — the buckets stay contiguous and nothing is lost.

  • B — id-token: write: declined, third time on this PR's review cycle. The claim comes from v1.0 priors about the default App-exchange path. With an explicit github_token input the action skips the OIDC exchange entirely — proven in production by ai-review-log's triage-assist.yml, the identical shape (api-key + explicit github_token, no id-token grant) running green on its nightly schedule all week. f7f676c adds a comment in the permissions block documenting this so future review passes stop re-raising it. Keeping the grant set minimal is the point of the block.

  • C — git rev-parse / git show in allowedTools: applied in f7f676c. Fair robustness point; rev-parse in particular is common in Claude Code's ref resolution.

Sections 3A/3B noted with appreciation — the instruction-as-code and split-token patterns are deliberate carries from the triage-assist migration.

@HarperFast HarperFast deleted a comment from github-actions Bot Jul 17, 2026
@heskew

heskew commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Restoring the Antigravity review below, verbatim (marker line excluded). The original comment embedded our <!-- gemini-review:v1 --> marker, so the dogfood review-updater matched it as "the prior review comment" and overwrote it with the fresh run's verdict — the original text survives in that comment's edit history, and the marker-collision bug is tracked separately. Disposition of the three findings is in the comment above (A and C applied in f7f676c, B declined with evidence).


Critical Review Pass: ai-review-prompts#75

This report provides a critical engineering review of ai-review-prompts#75 (ci: weekly calibration sweep as a GitHub Actions runner).

This PR is a timely, high-value infrastructure migration. By porting the weekly calibration sweep from the failing claude.ai scheduled routines to a self-contained GitHub Actions workflow, it restores the essential feedback loop for prompt calibration across all HarperFast repositories.

1. Verdict & Summary

Tip

Summary Posture: This is an exceptionally clean, well-isolated, and secure implementation. It solves a major technical debt item (broken scheduled sweeps) while introducing important data architecture enhancements (model and prompt-ref slicing).

However, to ensure the robustness of back-fills and smooth agentic execution, three critical corrections should be addressed before merging.

2. High-Value Findings & Required Corrections

⚠️ Finding A: Lack of Upper Date Bound on Weekly Query (Contamination of Back-Fills)

The pre-fetch script queries ai-review-log for closed issues using only a since lower bound. While this works for the normal weekly cron schedule, it breaks during back-fills: triggering WEEK=2026-07-06 on 2026-07-17 retrieves every issue closed from 2026-07-06 up to 2026-07-17 (including the week of 2026-07-13), contaminating the synthesis and double-counting when the subsequent week runs. Fix: compute WEEK_END = WEEK + 7 days and add closed_at < WEEK_END to the jq selector.

⚠️ Finding B: Missing id-token: write GHA Permission

The job permissions declare only contents: write + pull-requests: write; anthropics/claude-code-action relies on OIDC context detection, which requires id-token: write. Fix: add it to the permissions block.

ℹ️ Finding C: Missing Implicit Git Command in allowedTools

The --allowedTools list omits git rev-parse. Claude Code frequently executes git rev-parse when verifying branch existence, resolving local references, or identifying the merge-base; if blocked, the agent may error out during branch management. Fix: append Bash(git rev-parse:*) and Bash(git show:*).

3. Review of the Design System

A. Instruction-as-Code Isolation (Outstanding Pattern). Placing the agent's procedural instructions in a standalone root markdown file (CALIBRATION-SWEEP.md) rather than burying them in a YAML string isolates operational rubrics from GHA syntax and traces modifications cleanly via git log.

B. Decoupled Token Security. The pre-fetch step uses the scoped AI_REVIEW_LOG_TOKEN to read the private log repo and dump raw JSON to $RUNNER_TEMP; the agent is invoked with a plain repository-scoped github.token. This prevents the running LLM agent from holding tokens that could alter state in ai-review-log — an excellent sandboxing model.

4. Recommended Action Plan

  1. Introduce WEEK_END Boundary for safe, non-overlapping back-fills.
  2. Add id-token: write Permission.
  3. Permit git rev-parse and git show in --allowedTools.

🤖 Posted by Antigravity on Nathan's behalf

@heskew heskew left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Critical Review Pass: ai-review-prompts#75 (Updated)

Upon a complete, untruncated inspection of the PR branch, this PR is in an absolutely flawless, production-ready state.

The critical concerns typically associated with this workflow pattern have already been meticulously addressed and solved:

  1. Contamination of Back-Fills: The date boundary isolation (WEEK_END calculation and .closed_at < $w_end filter) is already robustly implemented.
  2. OIDC id-token Permission: The file contains an excellent inline comment explaining that with an explicit github_token input, the OIDC token exchange is bypassed, making id-token: write dead weight (a pattern proven in production by ai-review-log's nightly triage-assist.yml).
  3. Implicit Git Tools: Both git rev-parse and git show are already permitted in the --allowedTools argument list.

This represents a textbook migration. No changes or corrections are required.


🤖 Posted by Antigravity on Nathan's behalf

@heskew
heskew merged commit 82e61f4 into main Jul 17, 2026
3 checks passed
@heskew
heskew deleted the actions/calibration-sweep branch July 17, 2026 15:59
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