fix: eliminate cache-memory dependency in update-instructions workflow#8739
fix: eliminate cache-memory dependency in update-instructions workflow#8739vhvb1989 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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-memorytool dependency and the “record the run” step (state now lives in workflow run history). - Adds
actions: readpermission and updates the range-determination logic to use the last successful run timestamp.
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>
29dfe2b to
479d5b6
Compare
📋 Prioritization NoteThanks for the contribution! The linked issue isn't in the current milestone yet. |
jongio
left a comment
There was a problem hiding this comment.
Clean fix. Replacing the cache-memory tool with a workflow-run-history query is the right call: you eliminate a 7-day eviction hazard and gain a source of truth that's always available. The fallback chain (explicit date > last successful run timestamp > 6-month cap) handles the edge cases well.
Two quick notes:
-
Lock file: the
.lock.ymlwasn't regenerated in this branch (same SHA asmain). You'll need agh aw compilepass before merge so the runtime picks up the new logic. -
Bot comment on workflow name is a false positive: the instruction says "list recent workflow runs for this workflow (
Update Instructions From PR Reviews)" and the lock.yml'sname:field is exactly that string, so the agent will resolve it correctly.
Good to go once the lock file is refreshed.
RickWinter
left a comment
There was a problem hiding this comment.
This replaces the cache-memory high-water mark with a query against the workflow's own successful-run history, which is the right direction and drops a fragile weekly-eviction dependency. The one thing blocking it is that the new step 2 relies on listing workflow runs, and the github tool only enables the pull_requests, issues, and repos toolsets. Listing workflow runs lives in the actions toolset, so the added actions: read permission has no tool to drive it, and step 2 will silently fall through to the 6 month scan (step 3) on every run, which is the exact redundant mining this PR is trying to remove. Enabling the actions toolset on the github: tool should close that gap. The updated_at of the last successful run is a reasonable starting point; there is a small window where PRs merged while the previous run was executing could be reprocessed, but for a weekly instruction-mining job that is harmless. Please address the toolset before merge.
| last run"). | ||
| 3. Otherwise (first ever run, no marker), mine PRs merged within the last 6 | ||
| months, capped at the **Max PRs** run parameter. | ||
| 2. Otherwise, use the GitHub tools to list recent workflow runs for **this |
There was a problem hiding this comment.
This step now depends on listing workflow runs, but the github tool above only enables toolsets: [pull_requests, issues, repos]. The workflow-run listing lives in the github MCP actions toolset, which is not turned on here, so granting actions: read at the permissions level is not enough on its own. As written the agent has no tool to satisfy step 2 and will fall through to the 6 month scan in step 3 on every run, which is the redundant mining this PR is trying to avoid. Can we add actions to the toolsets list on the github: tool so the run-history query actually has a tool backing it?
jongio
left a comment
There was a problem hiding this comment.
Two things need fixing:
-
Missing actions toolset: toolsets: [pull_requests, issues, repos] doesn't include actions. The workflow-run listing API lives in that toolset, so step 2 will silently fail and the agent will always fall through to the 6-month scan. Add actions to the array.
-
Lock file stale: The .lock.yml still reflects old cache-memory logic. Run gh aw compile to regenerate.
Summary
Fixes #8702
Replace the
cache-memorytool with a GitHub API query for the last successful workflow run in theupdate-instructions-from-pr-reviewsagentic workflow.Problem
On first run,
last-run.txtdidn't exist in cache. The agent correctly calledmissing_datawithcache_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.txtin 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
cache-memory:tool from the workflow frontmatteractions: readpermission so the agent can list workflow runsWhy not just fix the prompt?
The cache-memory approach is inherently fragile for a weekly workflow:
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."