Skip to content

fix: update_cache_memory must not run if agent job failed#23876

Merged
pelikhan merged 1 commit intomainfrom
copilot/update-cache-memory-conditionally
Apr 1, 2026
Merged

fix: update_cache_memory must not run if agent job failed#23876
pelikhan merged 1 commit intomainfrom
copilot/update-cache-memory-conditionally

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

update_cache_memory was running even when the agent job failed because the job condition used needs.agent.result != 'skipped' — which only gates on the activation-filtered-out case, not on agent failure.

Changes

  • pkg/workflow/cache.go: Change update_cache_memory job condition from needs.agent.result != 'skipped'needs.agent.result == 'success'
- if: always() && (needs.detection.result == 'success' || needs.detection.result == 'skipped') &&
-     needs.agent.result != 'skipped'
+ if: always() && (needs.detection.result == 'success' || needs.detection.result == 'skipped') &&
+     needs.agent.result == 'success'
  • pkg/workflow/compiler_jobs_test.go: Add TestUpdateCacheMemoryJobConditionRequiresAgentSuccess to enforce the requirement
  • 75 .lock.yml files: Recompiled with the corrected condition

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>
@pelikhan pelikhan marked this pull request as ready for review April 1, 2026 12:12
Copilot AI review requested due to automatic review settings April 1, 2026 12:12
@github-actions github-actions bot mentioned this pull request Apr 1, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_memory job condition from “agent not skipped” to “agent success”.
  • Add a unit test to enforce the new condition requirement.
  • Recompile affected workflow .lock.yml files 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)
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'").

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit cc3a17f into main Apr 1, 2026
11 checks passed
@pelikhan pelikhan deleted the copilot/update-cache-memory-conditionally branch April 1, 2026 12:29
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.

3 participants