Skip to content

Add prefetch_strategy A/B experiment to weekly-blog-post-writer#38622

Merged
pelikhan merged 2 commits into
mainfrom
copilot/ab-advisor-experiment-prefetch-strategy
Jun 11, 2026
Merged

Add prefetch_strategy A/B experiment to weekly-blog-post-writer#38622
pelikhan merged 2 commits into
mainfrom
copilot/ab-advisor-experiment-prefetch-strategy

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This updates weekly-blog-post-writer to 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)

    • Added experiments.prefetch_strategy in rich object form with:
      • variants: [lazy, eager]
      • primary metric agent_turn_count
      • secondary metrics run_duration_ms, pr_creation_rate
      • guardrail pr_creation_success_rate threshold 0.80
      • min_samples: 10, weight: [50, 50], start_date, and tracking issue metadata.
  • Eager variant prefetch step

    • Added a conditional steps entry gated by selected experiment variant.
    • In eager, the workflow pre-fetches and stores:
      • /tmp/gh-aw/agent/releases.json
      • /tmp/gh-aw/agent/merged-prs.json
  • Prompt behavior split (Step 2/3)

    • Step 2 and Step 3 now branch on experiments.prefetch_strategy:
      • eager: read pre-fetched JSON files (no runtime list_releases / list_pull_requests call).
      • lazy: preserve current tool-driven behavior.
  • Compiled workflow output

    • Regenerated weekly-blog-post-writer.lock.yml to reflect experiment activation outputs and conditional prefetch wiring.
experiments:
  prefetch_strategy:
    variants: [lazy, eager]
    metric: agent_turn_count
    secondary_metrics: [run_duration_ms, pr_creation_rate]
    guardrail_metrics:
      - name: pr_creation_success_rate
        direction: min
        threshold: 0.80

steps:
  - name: Pre-fetch release and merged PR data
    if: ${{ needs.activation.outputs.prefetch_strategy == 'eager' }}
    run: |
      # writes /tmp/gh-aw/agent/releases.json and merged-prs.json

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — thanks for kicking off the A/B prefetch-strategy experiment for the weekly blog post writer! The direction looks solid. A couple of things to address before this is ready for review:

  • Add a PR description — the body right now is the agentic task checklist (the how), but reviewers need a short summary of what is changing and why — e.g. what problem the experiments.prefetch_strategy block solves, what the eager vs lazy strategies do differently, and what outcome is expected.
  • No files changed yet — the PR is still at the "Initial plan" commit with 0 lines changed. The checklist items have not been executed yet. Once the implementation lands, make sure test coverage for the new prefetch-strategy path is included.

Once the implementation is complete, here is a prompt you can use to finish this off cleanly:

This is PR #38622 "[WIP] Add A/B test for prefetch strategy in weekly blog post writer".

1. Replace the current PR body (which is just the agentic task checklist) with a proper PR description that explains:
   - What change is being made (adding an `experiments.prefetch_strategy` frontmatter block to `.github/workflows/weekly-blog-post-writer.md` with eager vs lazy prefetch steps)
   - Why it is needed (the motivation / problem being solved)
   - What the expected outcome or observable difference is
2. Ensure the implementation includes tests or validation steps that exercise the new prefetch-strategy code path.
3. Remove the `[WIP]` prefix from the title and mark the PR as ready for review.

Generated by ✅ Contribution Check · 560.3 AIC · ⌖ 13.4 AIC · ⊞ 24.7K ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add A/B test for prefetch strategy in weekly blog post writer Add prefetch_strategy A/B experiment to weekly-blog-post-writer Jun 11, 2026
Copilot AI requested a review from pelikhan June 11, 2026 14:30
@pelikhan pelikhan marked this pull request as ready for review June 11, 2026 14:33
Copilot AI review requested due to automatic review settings June 11, 2026 14:33
@pelikhan pelikhan merged commit a332ba8 into main Jun 11, 2026
@pelikhan pelikhan deleted the copilot/ab-advisor-experiment-prefetch-strategy branch June 11, 2026 14:34

Copilot AI 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.

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" \
Comment on lines +68 to +74
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
Comment on lines +56 to +57
- name: Pre-fetch release and merged PR data
if: ${{ needs.activation.outputs.prefetch_strategy == 'eager' }}
Comment on lines +61 to +62
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" \
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.

[ab-advisor] Experiment campaign for weekly-blog-post-writer: A/B test prefetch_strategy

3 participants