Repository navigation
Merge imported job outputs with main workflow precedence - #72407
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Commit pushed:
|
|
✅ 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 Code Quality Reviewer completed the code quality review.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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.
|
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.
Review: comment
One correctness edge case needs attention: a null/empty outputs: declaration silently prevents imported outputs from being merged, contrary to the documented union behavior. I left an inline comment with the suggested fix and regression test.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (239 new lines under 📄 Draft ADR committed:
Decision captured in the draft: when an import and the main workflow define the same job, 📋 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
|
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd — found one reproducible field-loss bug in the new job-merge path; everything else (naming, docs, existing tests) looks solid.
📋 Key Themes & Highlights
Key Themes
- Silent field loss: In
accumulateImportedJobs(and the mirroredmergeJobImportFields), when two job definitions both need merging (outputs + a plain scalar/map field likeruns-onorenv) but only one side triggers a step-merge, the branch clones whichever job "won" the step-merge decision rather than the later import. Any field unique to the "losing" side that isn'toutputs/setup-steps/pre-steps/continue-on-erroris silently dropped. Reproduced directly against the new code (see inline comment) — this is a real data-loss bug, not a style nit. - Test coverage gap: The new
TestMergeJobsFromYAMLImports_Outputs*suite is thorough for the outputs dimension, but no case combines outputs with a conflicting non-step scalar field (e.g.runs-on,env), which is exactly the combination that triggers the bug.
Positive Highlights
- ✅ Clear separation of concerns:
mergeJobOutputFieldis a small, well-named pure function with sensible precedence (main wins, including explicit empty string; later import wins among imports). - ✅ Mutation-safety is explicitly tested (
TestMergeJobImportFields_OutputsDoNotMutateInputs), exactly the regression-prevention/tddencourages. - ✅ Docs (
imports.md) were updated in the same PR to describe the new merge semantics — good/grill-with-docshygiene. - ✅ End-to-end compilation test (
TestImportedJobOutputsCompile) validates the lock-file output, not just the in-memory merge.
Recommend fixing the field-loss path (always base the merge on a full clone of one side with the other's fields layered in, regardless of which sub-merge fired) and adding a regression test with a non-step/non-output field present only on the "losing" side.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~83 AIC · ⌖ ~16 AIC · ⊞ 10.2K
Comment /matt to run again
There was a problem hiding this comment.
🟡 Changes recommended
Conflicting imports can produce jobs whose retained definitions and output mappings no longer match.
2 open issues
What changed in this PR
This PR extends gh-aw’s workflow import compiler so shared workflows can contribute job outputs alongside those defined in the main workflow.
Changes:
- Merge output mappings by name, with main-workflow values taking precedence.
- Add unit and compilation regressions for precedence, step ordering, and input immutability.
- Document job import support and output-merging rules.
| File | Description |
|---|---|
pkg/workflow/workflow_import_merge.go |
Adds output merging to job import accumulation. |
pkg/workflow/workflow_import_merge_test.go |
Tests output merging and compiled workflow behavior. |
docs/src/content/docs/reference/imports.md |
Documents supported job imports and merge precedence. |
Review effort: Max
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
In response to #72407 (comment): Reviewed and completed the generated ADR, including output precedence, alternatives, consequences, and validation boundaries. The PR body now links it; the record remains Proposed pending PR acceptance rather than claiming reviewer approval. |
|
In response to #72407 (comment): No change is required by this status report because it contains no actionable finding. The null-output fix has separate regression coverage; the reported_no_action outcome is not being treated as proof of validation or publication. |
|
In response to #72407 (comment): Accepted the associated correctness finding and fixed null output collections to merge as empty mappings. Focused regression tests cover null and empty declarations without weakening non-map handling. |
|
In response to #72407 (comment): No change is required by this review-in-progress notification because it contains no implementation feedback. It is not being treated as an approval or completed review. |
|
In response to #72407 (comment): No change is required by this reported_no_action status because it contains no actionable finding. Validation and publication are checked independently rather than inferred from the reviewer run completing. |
|
In response to #72407 (comment): Accepted and addressed the recorded null-output finding with a merge fix and regression tests. The managed comment-memory block and metadata were left unchanged. |
|
In response to #72407 (comment): Completed the ADR, removed verification TODOs, documented the actual Markdown and YAML validation boundaries, and linked the record in the PR body. It records the user-directed main-workflow precedence and remains Proposed until the PR is accepted. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
In response to #72407 (comment): The skills-based review is now complete, and its field-selection feedback was evaluated with the related inline findings. Output-only body preservation is fixed and covered by regressions; the documented non-output precedence is retained rather than changing all imports to later-body-wins. |
|
In response to #72407 (comment): The ADR remains complete and linked. It now also documents output-only body preservation and compile-time rejection of references to discarded regular steps. |
|
In response to #72407 (comment): The earlier disposition remains valid: the status report requests no code change. The new merge-correctness findings are handled separately with focused regressions. |
|
In response to #72407 (comment): The null-output fix remains in place. The follow-up merge changes retain its regression coverage and non-map handling. |
|
In response to #72407 (comment): This earlier response described the status at that time; the skills-based review has since completed. Its actionable field-selection feedback is addressed in the inline thread and follow-up regressions. |
|
In response to #72407 (comment): No additional change is requested by this earlier response. The no-action reviewer status is still not being used as evidence that validation or publication succeeded. |
|
In response to #72407 (comment): The recorded null-output issue remains fixed, and the managed comment-memory metadata remains unchanged. This response introduces no additional implementation requirement. |
|
In response to #72407 (comment): The ADR still records main-workflow output precedence and remains Proposed pending acceptance. It has been updated to capture the follow-up body-preservation fix and discarded-step validation. |
|
🎉 This pull request is included in a new release. Release: |

Imported workflows can contribute job output mappings, but same-named job definitions previously dropped outputs instead of combining them. This lets shared agentic workflows expose outputs alongside those defined in the main workflow.
Changes
jobs.<job-id>.outputsby name across imports and the main workflow. Main workflow values always win, including explicit empty strings; later-discovered imports win conflicts between imported output names.ADR: ADR-72407: Merge Imported Job Outputs by Name with Main Workflow Precedence
Validation