Repository navigation
Merge imported cache configuration into compiled workflows - #78857
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
What this change does: Imported cache entries are combined with the main workflow cache. The compiled workflow then uses the combined configuration for cache steps and policy.
Should fix
- Reuse the existing JSON decoder, as noted inline.
Verdict: Ship.
Lean: -16 lines possible.
Generated by ✂️ Ponytail Reviewer for #78857 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again
| return nil | ||
| } | ||
|
|
||
| func decodeCacheConfig(source string) (any, error) { |
There was a problem hiding this comment.
Should fix 1: This repeats the single-value JSON decoding already in pkg/jsonutil/json.go; call jsonutil.UnmarshalString directly here and delete this helper so both callers share the same checks and there is less code to maintain.
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (>100 new lines in 📄 Draft ADR committed:
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. ❓ Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
|
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found one blocking regression: imported workflows with an empty cache: declaration now fail compilation because JSON null is rejected instead of being ignored. Please handle null/empty imported cache configurations and add coverage.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
|
|
||
| func decodeCacheConfig(source string) (any, error) { | ||
| decoder := json.NewDecoder(strings.NewReader(source)) | ||
| var config, trailing any |
There was a problem hiding this comment.
An imported workflow with an empty cache: key is serialized by appendCacheField as JSON null (it only filters {}). decodeCacheConfig returns a nil value and appendCacheConfig then errors, so adding this merge path turns previously ignored empty cache declarations into compilation failures. Treat nil/null as an empty configuration (and add a regression test) before appending.
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd (triage: bug_fix). Requesting changes for one correctness bug and one test gap.
📋 Key Themes & Highlights
Key Themes
- Numeric cache values are corrupted on the imported path.
decodeCacheConfigloses number precision, soupload-chunk-size: 8388608compiles to8.388608e+06. The main-workflow path renders it correctly. Usedecoder.UseNumber(). I verified this locally. - Merge order is untested. The docs promise discovery order, then main entries, but the test only checks that the entries exist.
- Nit:
decodeCacheConfigduplicatesjsonutil.UnmarshalString, which this package already uses for the same single-value check. Reusing it would keep the trailing-data handling in one place.
Positive Highlights
- ✅ Merge is append-only and the main
cache:replacesworkflowData.Cacherather than duplicating it. - ✅ Empty and absent cache inputs are short-circuited.
- ✅ Regression test covers the real bug (
cache-mode: readno longer forced) and passes. - ✅ Docs updated in both the field list and the merge table.
Investigation was bounded to the diff and the cache/import call paths. I did not evaluate the buildInitialWorkflowData path beyond confirming it does not handle caches.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| } | ||
|
|
||
| func decodeCacheConfig(source string) (any, error) { | ||
| decoder := json.NewDecoder(strings.NewReader(source)) |
There was a problem hiding this comment.
[/diagnosing-bugs] Numeric imported cache values are corrupted. decodeCacheConfig uses default encoding/json decoding, which turns numbers into float64. So upload-chunk-size: 8388608 compiles to upload-chunk-size: 8.388608e+06, while the main-workflow path renders 8388608 correctly. Calling decoder.UseNumber() keeps the original literal. I confirmed this fix locally.
💡 Suggested change
decoder := json.NewDecoder(strings.NewReader(source))
decoder.UseNumber()Also add upload-chunk-size: 8388608 to the test fixture and assert the rendered value.
@copilot please address this.
| if !strings.Contains(lock, "key: probe-${{ runner.os }}-v1") { | ||
| t.Error("compiled workflow is missing the imported cache key") | ||
| } | ||
| if !strings.Contains(lock, "key: local-${{ runner.os }}-v1") { |
There was a problem hiding this comment.
[/tdd] The test does not check the merge order the docs now promise: imported entries in discovery order, then main workflow entries. The current order is correct, but nothing guards it, so a future change could silently reorder the steps.
💡 Suggested test
Assert that strings.Index(lock, "key: probe-") and strings.Index(lock, "key: local-") are both non-negative and that the probe index is smaller. Extend the fixture with a second imported file to cover discovery order between imports.
@copilot please address this.
There was a problem hiding this comment.
🟡 Changes recommended
Imported chunk sizes are serialized in scientific notation and misparsed as 3 bytes, potentially making uploads impractical, while tests miss import-only behavior and cache ordering.
2 open issues
What changed in this PR
This PR wires imported cache: configuration into gh-aw compilation so shared dependency caches generate GitHub Actions steps and inform the agent job’s cache-write policy.
Changes:
- Merge imported cache entries in discovery order, followed by local entries.
- Add a compilation test covering imported and local caches together.
- Document cache import support and merge ordering.
| File | Description |
|---|---|
pkg/workflow/compiler_orchestrator_workflow.go |
Applies collected cache imports during workflow configuration merging. |
pkg/workflow/cache_import_test.go |
Checks generated cache steps, keys, and cache-write policy. |
pkg/workflow/cache_import_merge.go |
Decodes, combines, and renders imported and local cache configurations. |
docs/src/content/docs/reference/imports.md |
Documents supported cache imports and their merge order. |
Review effort: Max (adaptive)
| decoder := json.NewDecoder(strings.NewReader(source)) | ||
| var config, trailing any |
| if strings.Contains(lock, "cache-mode: read") { | ||
| t.Error("agent job should not remain read-only when a dependency cache is configured") | ||
| } |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "09f28ebb1cd236a052300010b1393062a1e955e2",
"kind": "requested",
"schema_version": "1",
"state": "ede1c50dc3c4fb53525d88f80cdc995541905823bd87dcf1cb4bc1418b12e778",
"work": [
"43d0897f9798d614a50cf53d69aaf3fa630f7de08101eece74ecf1be1543920e",
"573b04aa7fc2a05d2eb706ce891333db2d231886fed3b3bc328f16c84b0f7360",
"84e3d913e817c1ef66a878f2e751820f4bb5471e3729b2df7ba0ce0125693ed0",
"85ac6b4dad1970279df7438373e6b8aa9ac94999a1ce8800b8335e39434adaa5",
"a0c1b49f6134424d9ed514bb2ca32f690697fb21202f5b463b752b6b0f32aa49",
"a8df0ed8c5c77c7e25ce136e98d44404598a32556a781bc23f6050bb48ecd733"
],
"workflow": "pr-sous-chef"
}
|
|
🎉 This pull request is included in a new release. Release: |


Imported
cache:frontmatter was collected but never applied, so workflows silently omitted cache steps and could retain a read-only cache policy. This change wires imported cache entries into workflow compilation.cache:to the supported import fields and describe its merge order.The imported cache configuration now generates cache steps and informs the cache-write policy.
cache:frontmatter is silently dropped; agent job keepscache-mode: read#78854