Skip to content

fix: eliminate cache-memory dependency in update-instructions workflow#8739

Open
vhvb1989 wants to merge 1 commit into
mainfrom
aw-UpdateInstructions
Open

fix: eliminate cache-memory dependency in update-instructions workflow#8739
vhvb1989 wants to merge 1 commit into
mainfrom
aw-UpdateInstructions

Conversation

@vhvb1989

Copy link
Copy Markdown
Member

Summary

Fixes #8702

Replace the cache-memory tool with a GitHub API query for the last successful workflow run in the update-instructions-from-pr-reviews agentic workflow.

Problem

On first run, last-run.txt didn't exist in cache. The agent correctly called missing_data with cache_memory_miss (as instructed by the cache-memory system), but gh-aw's detection layer interpreted this as a prompt misconfiguration rather than a legitimate first-run condition.

Fix

Eliminate the cache entirely. Instead of reading/writing last-run.txt in cache-memory, the agent now queries the GitHub API for the most recent successful run of this workflow to determine the PR range starting point.

Changes

  • Removed cache-memory: tool from the workflow frontmatter
  • Rewrote Step 1 fallback to query the last successful workflow run via GitHub API
  • Removed Step 8 ("Record the run") — no cache to write to; the workflow run history IS the state
  • Added actions: read permission so the agent can list workflow runs

Why not just fix the prompt?

The cache-memory approach is inherently fragile for a weekly workflow:

  • GitHub Actions cache has a 7-day unused-entry eviction policy
  • A weekly Monday schedule sits right at the eviction edge — a skipped week means cache loss and redundant 6-month mining every time
  • The GitHub API workflow run history is always available and is the natural source of truth

Per richardpark-msft's comment: "If you can get it to just query that detail directly you can eliminate a dependency on that cache altogether."

Replace the cache-memory tool (used to store last-run.txt) with a GitHub
API query for the last successful workflow run. This fixes the false-positive
cache-miss failure on first run, where the agent correctly reported
missing_data/cache_memory_miss but gh-aw's detection layer interpreted it
as a prompt misconfiguration.

The workflow run history is the natural, always-available source of truth
for "when did this last succeed" — no external state to seed, evict, or
misread. This also avoids the 7-day cache eviction risk that could cause
repeated first-run behavior on a weekly schedule.

Fixes #8702

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 20, 2026 00:37
@vhvb1989 vhvb1989 added bug Something isn't working area/pipeline CI/CD pipeline config (GH Actions, AzDO) labels Jun 20, 2026
@vhvb1989 vhvb1989 requested a review from danieljurek as a code owner June 20, 2026 00:37

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

This PR updates the Update Instructions From PR Reviews agentic workflow definition to remove reliance on cache-memory and instead derive the “since last run” starting point from GitHub Actions workflow run history.

Changes:

  • Removes the cache-memory tool dependency and the “record the run” step (state now lives in workflow run history).
  • Adds actions: read permission and updates the range-determination logic to use the last successful run timestamp.

Comment on lines +155 to +159
2. Otherwise, use the GitHub tools to list recent workflow runs for **this
workflow** (`update-instructions-from-pr-reviews`) in the repository this
workflow runs in. Find the most recent **successful** (completed with
`conclusion: success`) run and use its `created_at` timestamp as the
starting point — mine PRs merged after that date.
Comment on lines +1 to +5
---
name: Update Instructions From PR Reviews
on:
schedule:
# NOTE: Using the fuzzy form for scheduling lets gh-aw jitter the exact minute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflows area/pipeline CI/CD pipeline config (GH Actions, AzDO) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[aw] Update Instructions From PR Reviews has cache-memory miss misconfiguration

2 participants