Cache lightweight agentic workflow logs - #49082
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Triage Summary
Adds shared cache for agentic workflow log/audit downloads. Draft, PR is in blocked (merge-conflict) state; useful but not urgent.
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot use a single cache id since there is a single producer and many consumers |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a shared lightweight log cache for scheduled workflows and artifact-aware cache markers.
Changes:
- Adds daily cache refresh and automatic cache restoration.
- Tracks downloaded artifact sets and avoids heavyweight logs.
- Updates consumers to use
.github/aw/logs.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/compiler_yaml_runtime_setup.go |
Inserts cache restore steps. |
pkg/workflow/compiler_logs_cache.go |
Detects eligible scheduled workflows. |
pkg/workflow/compiler_logs_cache_test.go |
Tests cache restore generation. |
pkg/cli/logs_run_processor.go |
Validates artifact markers on cache hits. |
pkg/cli/logs_run_processor_test.go |
Tests marker-aware cache behavior. |
pkg/cli/logs_flatten_test.go |
Tests marker preservation during flattening. |
pkg/cli/logs_download.go |
Writes markers and reduces log downloads. |
pkg/cli/logs_artifact_set.go |
Implements artifact marker storage. |
pkg/cli/logs_artifact_set_test.go |
Tests marker matching and validation. |
.github/workflows/safe-output-health.lock.yml |
Restores the shared cache. |
.github/workflows/prompt-clustering-analysis.md |
Uses the shared log directory. |
.github/workflows/prompt-clustering-analysis.lock.yml |
Compiles clustering cache changes. |
.github/workflows/portfolio-analyst.lock.yml |
Restores the shared cache. |
.github/workflows/daily-security-observability.md |
Routes downloads through shared storage. |
.github/workflows/daily-security-observability.lock.yml |
Compiles observability cache changes. |
.github/workflows/daily-safe-output-optimizer.lock.yml |
Restores the shared cache. |
.github/workflows/daily-evals-report.lock.yml |
Restores the shared cache. |
.github/workflows/daily-cli-tools-tester.lock.yml |
Restores the shared cache. |
.github/workflows/daily-ambient-context-optimizer.lock.yml |
Restores the shared cache. |
.github/workflows/agentic-token-optimizer.lock.yml |
Restores the shared cache. |
.github/workflows/agentic-token-audit.lock.yml |
Restores the shared cache. |
.github/workflows/agentic-logs-cache.yml |
Defines daily cache refresh and publication. |
.github/workflows/ab-testing-advisor.lock.yml |
Restores the shared cache. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 23/23 changed files
- Comments generated: 3
- Review effort level: Medium
| func (c *Compiler) generateRuntimeAndWorkspaceSetupSteps(yaml *strings.Builder, data *WorkflowData, needsCheckout bool) bool { | ||
| runtimeSetupSteps, customStepsContainCheckout := c.prepareRuntimeSetupAndCheckoutInfo(data) | ||
| if customStepsContainCheckout { | ||
| runtimeSetupSteps = append(runtimeSetupSteps, sharedLogsCacheRestoreSteps(data)...) |
| if markers, markerErr := os.ReadDir(filepath.Join(outputDir, downloadedArtifactsMarkerDir)); markerErr == nil { | ||
| for _, marker := range markers { | ||
| if !marker.IsDir() { | ||
| dirs = append(dirs, marker.Name()) | ||
| } |
| path: .github/aw/logs | ||
| key: agentic-logs |
|
Warning threat detection engine error DetailsThe threat detection engine failed to produce results. Review the workflow run logs for details. @copilot please run the Unresolved feedback to address (newest first):
Blocking review status:
Failed checks:
|
PR-finisher pass complete (0b4022a).
Actions taken: Moved Hand-off: CI must be re-triggered by a maintainer before merge. Pre-existing |
|
/matt |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /tdd, and /codebase-design — requesting changes on two correctness issues.
📋 Key Themes & Highlights
Key Themes
- Delete-before-save race (
agentic-logs-cache.yml): the old cache is deleted before the new save is confirmed, leaving consumers with no cache if the save step fails. - Inconsistent marker-write error handling (
logs_download.go): the primary download path returns a fatal error on marker write failure, while the retry path treats the same condition as non-fatal. Pick one (non-fatal is the right call here). - Text-scan fragility (
compiler_logs_cache.go):usesSharedLogsCachereplicates an ad-hoc text-scanner pattern rather than reusing the structured step-detection already in the compiler. - Test intent gap (
logs_artifact_set_test.go): the prefix-match behaviour exercised inTestFindMissingFilterEntriesUsesDownloadedMarkersis implicit, not documented.
Positive Highlights
- ✅ Excellent use of a marker-file system to replace the fragile non-empty-directory heuristic — the path-traversal guard in
markArtifactDownloadedis a nice safety touch. - ✅
shouldDownloadWorkflowRunLogsis a meaningful generalisation ofisUsageOnlyArtifactFilterthat's easier to reason about. - ✅ Strong test coverage across the new
ArtifactSetmarker logic, including the boundary case where individual markers are present but theallmarker is not. - ✅ ADR included — good practice for a cross-cutting infrastructure change.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 61 AIC · ⌖ 5.28 AIC · ⊞ 7K
Comment /matt to run again
… and add build tag Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
PR-finisher pass complete (d13fe96). Blocking issues fixed:
Unresolved review threads addressed:
Checks:
|
|
Copilot should ensure logs download properly, minimize the number of artifacts that need to be re-downloaded and unzipped, and accurately detect when the required workflow data has already been downloaded. The goal is to reuse any pre-downloaded data and avoid unnecessary API calls. @copilot |
…imize API calls Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Three concrete improvements committed in the latest push:
Two new unit tests cover: the incremental scenario where per-artifact markers (with full API names like |
|
Warning threat detection engine error DetailsThe threat detection engine failed to produce results. Review the workflow run logs for details. Great work on implementing the agentic workflow log caching feature! 🎯 This PR looks solid: ✅ Well-described — The PR body clearly explains the problem (repeated artifact downloads), the solution (two-day cache), and implementation approach across cache refresh, consumption, and artifact-aware downloads. ✅ Focused — Single feature with coherent scope: caching 30 days of activation and usage data with daily refresh. ✅ Comprehensive tests — New test files and extended coverage for artifact sets, run processing, and cache logic (136 lines in ✅ Follows core team process — Created by the Copilot SWE agent as documented in CONTRIBUTING.md. The implementation spans workflow automation (
|
|
Warning threat detection engine error DetailsThe threat detection engine failed to produce results. Review the workflow run logs for details. @copilot please run the skill, address unresolved review feedback if any, and rerun checks once the branch is up to date.
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |
Scheduled log and audit workflows repeatedly download the same artifacts, causing unnecessary transfers and timeouts. Add a two-day shared cache containing 30 days of activation and usage data.
Cache refresh
gh-aw, prune runs older than 30 days, and download onlyactivationandusage.Cache consumers
gh aw logsorgh aw audit.Artifact-aware downloads
Warning
threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.
Details
The threat detection engine failed to produce results.
Review the workflow run logs for details.
Run: https://github.com/github/gh-aw/actions/runs/30531795286