fix: update_cache_memory must not run if agent job failed#23876
Merged
fix: update_cache_memory must not run if agent job failed#23876
Conversation
Change the job condition from `needs.agent.result != 'skipped'` to `needs.agent.result == 'success'` so the cache is only persisted when the agent job succeeds, not when it fails. Recompile all lock files to apply the updated condition. Add TestUpdateCacheMemoryJobConditionRequiresAgentSuccess to enforce the new requirement. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0fe32ea4-836a-4652-bec3-137e8b7549ff Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
April 1, 2026 12:08
View session
Closed
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the update_cache_memory GitHub Actions job gating so cache-memory is only persisted when the agent job succeeds, preventing cache updates after agent failures.
Changes:
- Update
update_cache_memoryjob condition from “agent not skipped” to “agent success”. - Add a unit test to enforce the new condition requirement.
- Recompile affected workflow
.lock.ymlfiles to reflect the corrected condition.
Reviewed changes
Copilot reviewed 77 out of 77 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/cache.go | Changes update_cache_memory job condition to require needs.agent.result == 'success'. |
| pkg/workflow/compiler_jobs_test.go | Adds a regression test asserting the compiled condition requires agent success. |
| .github/workflows/agent-persona-explorer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/audit-workflows.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/ci-coach.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/ci-doctor.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/claude-code-user-docs-review.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/cli-version-checker.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/cloclo.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/code-scanning-fixer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/constraint-solving-potd.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/copilot-agent-analysis.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/copilot-pr-merged-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/copilot-pr-nlp-analysis.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/copilot-pr-prompt-analysis.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/copilot-session-insights.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-architecture-diagram.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-code-metrics.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-compiler-quality.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-copilot-token-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-doc-healer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-doc-updater.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-firewall-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-function-namer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-integrity-analysis.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-issues-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-mcp-concurrency-analysis.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-news.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-performance-summary.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-rendering-scripts-verifier.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-repo-chronicle.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/daily-safe-output-optimizer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/dead-code-remover.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/deep-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/developer-docs-consolidator.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/firewall-escape.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/github-mcp-structural-analysis.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/github-mcp-tools-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/glossary-maintainer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/go-fan.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/go-logger.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/gpclean.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/grumpy-reviewer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/instructions-janitor.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/jsweep.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/lockfile-stats.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/mcp-inspector.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/org-health-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/pdf-summary.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/poem-bot.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/portfolio-analyst.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/pr-nitpick-reviewer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/prompt-clustering-analysis.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/python-data-charts.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/q.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/repo-audit-analyzer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/repository-quality-improver.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/safe-output-health.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/schema-consistency-checker.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/scout.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/security-review.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/sergo.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/slide-deck-maintainer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/smoke-claude.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/smoke-codex.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/smoke-copilot-arm.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/smoke-copilot.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/smoke-gemini.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/smoke-update-cross-repo-pr.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/stale-repo-identifier.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/static-analysis-report.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/step-name-alignment.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/super-linter.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/technical-doc-writer.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/test-create-pr-error-handling.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/unbloat-docs.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
| .github/workflows/weekly-issue-summary.lock.yml | Regenerated lockfile with updated update_cache_memory condition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1566
to
+1569
| // The job condition must require the agent to have succeeded. | ||
| // It must NOT use != 'skipped' (which allows the job to run when agent fails). | ||
| if !strings.Contains(updateCacheMemoryJob.If, "needs.agent.result == 'success'") { | ||
| t.Errorf("update_cache_memory job condition should require agent == 'success' to prevent running when agent fails, got: %q", updateCacheMemoryJob.If) |
There was a problem hiding this comment.
The test hard-codes the job ID as "needs.agent.result == 'success'". To keep this resilient to future renames (and consistent with the rest of the file), build the expected substring using constants.AgentJobName (e.g., "needs."+string(constants.AgentJobName)+".result == 'success'").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
update_cache_memorywas running even when the agent job failed because the job condition usedneeds.agent.result != 'skipped'— which only gates on the activation-filtered-out case, not on agent failure.Changes
pkg/workflow/cache.go: Changeupdate_cache_memoryjob condition fromneeds.agent.result != 'skipped'→needs.agent.result == 'success'pkg/workflow/compiler_jobs_test.go: AddTestUpdateCacheMemoryJobConditionRequiresAgentSuccessto enforce the requirement.lock.ymlfiles: Recompiled with the corrected condition