Skip to content

Fix gh aw update dropping object-form (uses/with) imports - #53704

Merged
mnkiefer merged 5 commits into
mainfrom
copilot/update-workflows-cmd-behavior
Aug 18, 2026
Merged

Fix gh aw update dropping object-form (uses/with) imports#53704
mnkiefer merged 5 commits into
mainfrom
copilot/update-workflows-cmd-behavior

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

gh aw update could silently replace a valid imports: collection with imports: [] when the only entries were object-form (e.g. - uses: shared/control.md with a with: map). This broke nested import chains and caused their generated steps (e.g. Precompute control facts) to disappear from the recompiled lock file, even though the upstream import was unchanged.

Root cause

  • processImportsWithWorkflowSpec (pkg/cli/imports.go) rewrites imports: entries to workflowspec format (owner/repo/path@sha) during updates and merges.
  • It relied on collectStringImports, which only extracted plain-string entries from the imports array and silently dropped object-form entries (uses/with, path/inputs).
  • When a workflow's only import was object-form, the rewritten list ended up empty.

Fix

  • Replaced collectStringImports + processImportPaths with processImportItems, which handles every entry type:
    • string entries are rewritten to workflowspec format as before
    • object entries keep their shape — only the path/uses value is rewritten, inputs/with and any other keys are preserved
    • unrecognized entry types pass through unchanged instead of being dropped
  • Applies uniformly to both the plain-array and object (aw: subfield) forms of imports, and guarantees the output list is never shorter than the input — preventing a non-empty imports collection from silently collapsing to [].
imports:
  - uses: shared/control.md
    with:
      role: orchestrator
      rollout_mode: ${{ vars.CENTRAL_AGENTIC_OPS_DEPENDABOT_MODE || 'preview' }}

This entry now survives an update/merge intact instead of vanishing.

Tests

  • TestProcessImportsWithWorkflowSpec_ObjectFormPreserved — object-form import with with fields survives rewriting.
  • TestMergeWorkflowContent_PreservesUnchangedObjectFormImports — three-way merge scenario where only the upstream prompt body changes and nested frontmatter imports remain unchanged.

Copilot AI linked an issue Aug 18, 2026 that may be closed by this pull request
@mnkiefer
mnkiefer marked this pull request as ready for review August 18, 2026 13:42
Copilot AI balanced review requested due to automatic review settings August 18, 2026 13:42

This comment was marked as outdated.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix update workflows cmd to retain valid imports Fix gh aw update dropping object-form (uses/with) imports Aug 18, 2026
Copilot AI requested a review from mnkiefer August 18, 2026 13:52
@mnkiefer

Copy link
Copy Markdown
Collaborator

@copilot Please address the remaining merge blockers on this PR, then run the pr-finisher skill and report back with validation results and any remaining blockers.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please address the remaining merge blockers on this PR, then run the pr-finisher skill and report back with validation results and any remaining blockers.

Fixed the merge blocker: CI's lint-go job was failing on a modernize: mapsloop finding in pkg/cli/imports.go (manual map-copy loop instead of maps.Copy), introduced by the object-form imports fix. Addressed in 1900438.

pr-finisher validation:

  • ✅ Reviews — no unresolved review threads; PR already approved by @mnkiefer.
  • ✅ Checks (local) — make golint-incremental BASE_REF=origin/main now reports 0 issues; targeted tests (TestProcessImportsWithWorkflowSpec_*, TestMergeWorkflowContent_*) and full TEST_UNIT_RUN_FULL=1 make test-unit all pass.
  • ❓ Checks (CI) — stale after this push (new HEAD 1900438 has no status checks yet); needs a maintainer to re-trigger (close/reopen, workflow_dispatch, or a new push). The prior lint-go failure is fixed and locally reproduced/verified.
  • ✅ Mergeable — PR is open, not draft, approved, no conflicts; mergeable_state: blocked reflects pending/stale required checks on the new commit, not a real conflict.

Nothing else is actionable from this agent; ready for a maintainer to re-trigger CI and merge.

Copilot AI requested a review from mnkiefer August 18, 2026 17:34
@mnkiefer
mnkiefer merged commit e8c8e22 into main Aug 18, 2026
48 of 49 checks passed
@mnkiefer
mnkiefer deleted the copilot/update-workflows-cmd-behavior branch August 18, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update workflows cmd replaces valid workflow imports

3 participants