Fix activity_report cache persistence when report step fails#27947
Fix activity_report cache persistence when report step fails#27947
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/5c25bf67-7510-4d71-9db8-0bad7a7c39f4 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Ensures the activity_report maintenance job persists its activity-report logs cache even when the report-generation step fails by splitting caching into explicit restore/save steps.
Changes:
- Replaced
actions/cachewithactions/cache/restore+actions/cache/saveforactivity_reportlogs caching. - Added an
always()-gated cache save step using the restore step’s primary key output. - Updated workflow-generation tests (and the side-repo integration test) to assert the new restore/save behavior.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/side_repo_maintenance_integration_test.go | Updates integration assertions to require restore/save cache steps and always-run save behavior. |
| pkg/workflow/side_repo_maintenance.go | Generates restore/save cache steps for side-repo activity_report job. |
| pkg/workflow/maintenance_workflow_yaml.go | Generates restore/save cache steps for main maintenance activity_report job. |
| pkg/workflow/maintenance_workflow_test.go | Updates unit tests to assert restore/save steps and always-run save semantics. |
| .github/workflows/agentics-maintenance.yml | Applies the same restore/save caching pattern to the checked-in workflow. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 5/5 changed files
- Comments generated: 3
| - name: Save activity report logs cache | ||
| if: ${{ always() }} | ||
| uses: ` + getActionPin("actions/cache/save") + ` | ||
| with: | ||
| path: ./.cache/gh-aw/activity-report-logs | ||
| key: ${{ steps.activity_report_logs_cache.outputs.cache-primary-key }} |
There was a problem hiding this comment.
The cache save step runs with always(), so it will execute even if earlier steps failed and the restore step was skipped. In that case steps.activity_report_logs_cache.outputs.cache-primary-key will be empty/undefined, and actions/cache/save will fail due to a missing key, potentially masking the original failure. Consider gating the save step on the restore step having run and having a non-empty primary key output (or otherwise ensure a fallback key is provided).
| - name: Save activity report logs cache | ||
| if: ${{ always() }} | ||
| uses: ` + getActionPin("actions/cache/save") + ` | ||
| with: | ||
| path: ./.cache/gh-aw/activity-report-logs | ||
| key: ${{ steps.activity_report_logs_cache.outputs.cache-primary-key }} |
There was a problem hiding this comment.
Because this cache save step uses if: ${{ always() }}, it will run even when earlier steps fail and the restore step was skipped. If activity_report_logs_cache didn’t run, steps.activity_report_logs_cache.outputs.cache-primary-key will be empty and actions/cache/save will error due to a missing key, which can obscure the real failure. Add a condition to only run the save when the restore step produced a primary key (or provide a safe fallback key).
| - name: Save activity report logs cache | ||
| if: ${{ always() }} | ||
| uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | ||
| with: | ||
| path: ./.cache/gh-aw/activity-report-logs | ||
| key: ${{ steps.activity_report_logs_cache.outputs.cache-primary-key }} |
There was a problem hiding this comment.
With if: ${{ always() }}, this save step will run even if the build or cache restore step failed/was skipped. In that scenario the referenced output steps.activity_report_logs_cache.outputs.cache-primary-key will be empty, and actions/cache/save will fail because key is required—potentially replacing the original error. Gate this step on the restore step having run and emitting a non-empty primary key output (or provide a fallback key).
🧪 Test Quality Sentinel ReportTest Quality Score: 90/100✅ Excellent test quality
Test Classification Details
Flagged Tests — Requires Review
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 90/100. Test quality is acceptable — 0% of new tests are implementation tests (threshold: 30%). Both modified tests are behavioral contract tests with proper build tags. See the comment above for a suggestion to explicitly verify the fault-tolerance invariant (cache saves even on failure) using the new actions/cache combined action.
Summary
Ensure the
activity_reportmaintenance job always persists cache data, even if report generation fails.Changes
activity_reportcache handling fromactions/cacheto explicitactions/cache/restore+actions/cache/save.id: activity_report_logs_cacheto the restore step.if: ${{ always() }}so cache is saved even on failure paths.steps.activity_report_logs_cache.outputs.cache-primary-keyfor key consistency.Validation
go test -v -run "TestGenerateMaintenanceWorkflow_RunOperationCLICodegen|TestGenerateSideRepoMaintenanceWorkflow" ./pkg/workflow/make agent-finish(fails due to pre-existing unrelated tests:TestCopilotDetectionDefaultModel,TestWasmGolden_CompileFixtures)