Skip to content

Move cache-memory and repo-memory restore steps before user steps: in agent job - #43984

Merged
pelikhan merged 4 commits into
mainfrom
copilot/planmove-cache-repo-memory-restore
Jul 7, 2026
Merged

Move cache-memory and repo-memory restore steps before user steps: in agent job#43984
pelikhan merged 4 commits into
mainfrom
copilot/planmove-cache-repo-memory-restore

Conversation

CopilotAI commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

cache-memory and repo-memory restore steps were emitted after the user's frontmatter steps: block, so custom steps always saw empty /tmp/gh-aw/cache-memory/ and /tmp/gh-aw/repo-memory/ directories — forcing authors to manually duplicate state via raw actions/cache.

Changes

  • compiler_yaml_main_job.go — in generateRuntimeAndWorkspaceSetupSteps, move generateCacheMemorySteps and generateRepoMemorySteps calls to before emitCustomSteps. New order:

    1. Runtime setup prelude (checkout, tool cache redirect, runtime installs)
    2. create_gh_aw_tmp_dir + GHE config + DIFC proxy
    3. generateCacheStepsgenerateCacheMemoryStepsgenerateRepoMemoryStepsmoved here
    4. emitCustomSteps (user steps:)
  • compiler_yaml_main_job_test.go — adds TestMemoryRestoreStepsOrderBeforeCustomSteps asserting by string position that both memory restore sections appear before user custom steps in the generated YAML.

  • 54 .lock.yml files — regenerated; affected workflows now have memory populated before any user step runs.


Generated by 👨‍🍳 PR Sous Chef · 11.9 AIC · ⌖ 7.75 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · 3.94 AIC · ⌖ 7.46 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
CopilotAI changed the title [WIP] Reorder cache-memory and repo-memory restore steps in agent jobMove cache-memory and repo-memory restore steps before user steps: in agent jobJul 7, 2026
CopilotAI requested a review from pelikhanJuly 7, 2026 09:42
@pelikhan
pelikhan marked this pull request as ready for review July 7, 2026 09:59
CopilotAI review requested due to automatic review settings July 7, 2026 09:59

CopilotAI 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 gh-aw workflow compiler so cache-memory and repo-memory restore/setup steps are emitted before a workflow author’s frontmatter steps: block, ensuring user-defined deterministic steps can read from /tmp/gh-aw/cache-memory/ and /tmp/gh-aw/repo-memory/ without re-implementing restore logic.

Changes:

  • Reordered main-job step emission so cache-memory and repo-memory setup run before user custom steps.
  • Added a unit test asserting the generated YAML places both memory restore sections before custom steps.
  • Regenerated many compiled .lock.yml workflows to reflect the new step ordering.
Show a summary per file
FileDescription
pkg/workflow/compiler_yaml_main_job.goReorders step emission so memory restore/setup occurs before user steps:.
pkg/workflow/compiler_yaml_main_job_test.goAdds a test asserting cache-memory/repo-memory steps are emitted before custom steps.
.github/workflows/workflow-health-manager.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/weekly-issue-summary.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/weekly-blog-post-writer.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/unbloat-docs.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/technical-doc-writer.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/super-linter.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/step-name-alignment.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/static-analysis-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/stale-repo-identifier.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/slide-deck-maintainer.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/safe-output-health.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/repository-quality-improver.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/python-data-charts.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/prompt-clustering-analysis.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/portfolio-analyst.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/org-health-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/jsweep.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/hippo-embed.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/gpclean.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/go-logger.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/glossary-maintainer.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/github-mcp-structural-analysis.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/detection-analysis-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/dependabot-burner.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/deep-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/dead-code-remover.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/dataflow-pr-discussion-dataset.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-spdd-spec-planner.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-sentrux-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-security-observability.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-safe-output-optimizer.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-repo-chronicle.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-performance-summary.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-news.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-issues-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-hippo-learn.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-fact.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-experiment-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-community-attribution.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/daily-code-metrics.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/copilot-session-insights.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/copilot-pr-prompt-analysis.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/copilot-pr-nlp-analysis.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/copilot-pr-merged-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/copilot-opt.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/copilot-centralization-optimizer.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/copilot-agent-analysis.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/ci-doctor.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/ci-coach.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/aw-failure-investigator.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/audit-workflows.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/api-consumption-report.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/agentic-token-optimizer.lock.ymlRegenerated to reflect new memory/custom-step ordering.
.github/workflows/agentic-token-audit.lock.ymlRegenerated to reflect new memory/custom-step ordering.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 56/56 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment on lines +229 to +233
// Add cache steps if cache configuration is present
compilerYamlLog.Printf("Generating cache steps for workflow")
generateCacheSteps(yaml, data, c.verbose)

// Add cache-memory steps if cache-memory configuration is present
// Add cache-memory steps before custom steps so that user steps: code can read
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — great catch on the memory restore ordering bug! Fixing the step emission order so that cache-memory and repo-memory directories are populated before any user steps: run is exactly the right approach, and the regenerated .lock.yml files confirm the fix propagates correctly across all affected workflows.

The PR is well-scoped, includes a dedicated test (TestMemoryRestoreStepsOrderBeforeCustomSteps) that asserts ordering by string position, and has a clear description of both the root cause and the new step order. This looks ready for review. ✅

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • patchdiff.githubusercontent.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
allowed:
- defaults
- "patchdiff.githubusercontent.com"

See Network Configuration for more information.

Generated by ✅ Contribution Check · 352.6 AIC · ⌖ 26.7 AIC · ⊞ 6.2K ·

@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage · Run §28868091227

FieldValue
Categorybug
RiskHigh
Score78 / 100
Actionbatch_review
Batchpr-batch:memory-ordering

Score breakdown: Impact 40 · Urgency 25 · Quality 13

Rationale: Fixes critical ordering bug — cache-memory + repo-memory steps emitted AFTER user steps:, causing empty memory dirs. Large diff (+704/-648, 56 files) is generated workflow YAML. CI passing. Bot COMMENTED. Batch with #44015 (same theme: memory hydration before user steps).

Labels: pr-type:bugpr-risk:highpr-priority:highpr-action:batch_reviewpr-batch:memory-ordering

Generated by 🔧 PR Triage Agent · 119.4 AIC · ⌖ 6.65 AIC · ⊞ 5.4K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile. Fix conflicts with comment memory

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

CopilotAI commented Jul 7, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot merge main and recompile. Fix conflicts with comment memory

Addressed in 3a5dea2. Merged origin/main, preserved the upstream comment-memory presteps behavior during conflict resolution, recompiled workflows, refreshed the affected WASM golden files, and reran the repo validation gate.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

Generated by 👨‍🍳 PR Sous Chef · 11.9 AIC · ⌖ 7.75 AIC · ⊞ 7.1K ·
Comment /souschef to run again

CopilotAI commented Jul 7, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

...

Branch is already up to date with main at 1c429fa. I ran the pr-finisher pass locally (make fmt, make lint, make test-unit, make test, make recompile) and the targeted TestMemoryRestoreStepsOrderBeforeCustomSteps check also passed. The remaining Copilot review thread is obsolete on the current HEAD: generateCacheSteps now stays after custom steps, while cache-memory/repo-memory restore steps remain before them. I can’t re-trigger GitHub Actions from the cloud agent, so a maintainer will need to rerun CI on this HEAD.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

Generated by 👨‍🍳 PR Sous Chef · 3.94 AIC · ⌖ 7.46 AIC · ⊞ 7.1K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit 1b2021c into mainJul 7, 2026
30 checks passed
@pelikhan
pelikhan deleted the copilot/planmove-cache-repo-memory-restore branch July 7, 2026 16:45
Copilot stopped work on behalf of gh-aw-bot due to an error July 7, 2026 17:25
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.4

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Move cache-memory and repo-memory restore before user steps: in agent job

4 participants

@pelikhan@gh-aw-bot