Add prefetch_strategy A/B experiment to weekly-blog-post-writer#38622
Conversation
|
Hey
Once the implementation is complete, here is a prompt you can use to finish this off cleanly:
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
prefetch_strategy A/B experiment to weekly-blog-post-writer
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an A/B experiment to the “Weekly Blog Post Writer” agent workflow to evaluate whether eagerly prefetching GitHub releases and merged PRs reduces agent tool calls and overall runtime.
Changes:
- Introduces an
experiments.prefetch_strategy(lazy vs eager) spec with metrics/guardrails. - Adds an eager-only prefetch step to write releases + merged PRs JSON to
/tmp/gh-aw/agent/. - Updates the prompt instructions to consume the prefetched JSON when the eager variant is selected.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/weekly-blog-post-writer.md | Adds experiment config, eager prefetch step, and prompt branching to read prefetched data. |
| .github/workflows/weekly-blog-post-writer.lock.yml | Propagates experiment selection through the locked workflow and implements prefetch/proxy + experiment state persistence. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 5
| | jq --arg since "$SINCE" '[.[] | select(.published_at != null and .published_at >= $since)]' \ | ||
| > /tmp/gh-aw/agent/releases.json | ||
|
|
||
| gh api "search/issues?q=repo:${GITHUB_REPOSITORY}+is:pr+is:merged+merged:>=$SINCE&sort=updated&order=desc&per_page=100" \ |
| gh api "repos/${GITHUB_REPOSITORY}/releases?per_page=100" \ | ||
| | jq --arg since "$SINCE" '[.[] | select(.published_at != null and .published_at >= $since)]' \ | ||
| > /tmp/gh-aw/agent/releases.json | ||
|
|
||
| gh api "search/issues?q=repo:${GITHUB_REPOSITORY}+is:pr+is:merged+merged:>=$SINCE&sort=updated&order=desc&per_page=100" \ | ||
| | jq '.items' \ | ||
| > /tmp/gh-aw/agent/merged-prs.json |
| - name: Pre-fetch release and merged PR data | ||
| if: ${{ needs.activation.outputs.prefetch_strategy == 'eager' }} |
| run: | | ||
| set -euo pipefail |
| | jq --arg since "$SINCE" '[.[] | select(.published_at != null and .published_at >= $since)]' \ | ||
| > /tmp/gh-aw/agent/releases.json | ||
|
|
||
| gh api "search/issues?q=repo:${GITHUB_REPOSITORY}+is:pr+is:merged+merged:>=$SINCE&sort=updated&order=desc&per_page=100" \ |
This updates
weekly-blog-post-writerto run a controlled lazy-vs-eager prefetch experiment for release/PR data collection. The goal is to measure whether moving initial GitHub fetches into setup steps reduces agent turns and run duration without hurting PR creation outcomes.Experiment config (frontmatter)
experiments.prefetch_strategyin rich object form with:variants: [lazy, eager]agent_turn_countrun_duration_ms,pr_creation_ratepr_creation_success_ratethreshold0.80min_samples: 10,weight: [50, 50],start_date, and tracking issue metadata.Eager variant prefetch step
stepsentry gated by selected experiment variant.eager, the workflow pre-fetches and stores:/tmp/gh-aw/agent/releases.json/tmp/gh-aw/agent/merged-prs.jsonPrompt behavior split (Step 2/3)
experiments.prefetch_strategy:eager: read pre-fetched JSON files (no runtimelist_releases/list_pull_requestscall).lazy: preserve current tool-driven behavior.Compiled workflow output
weekly-blog-post-writer.lock.ymlto reflect experiment activation outputs and conditional prefetch wiring.