Skip to content

Allow gh aw edit on source-managed workflows - #55875

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-edit-source-managed-workflow
Aug 26, 2026
Merged

Allow gh aw edit on source-managed workflows#55875
pelikhan merged 3 commits into
mainfrom
copilot/fix-edit-source-managed-workflow

Conversation

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

gh aw edit rejected workflows with source: frontmatter, even though local edits should be allowed and later reconciled by gh aw update.

  • Edit behavior

    • Removes the source-managed workflow guard from gh aw edit.
    • Preserves existing source: metadata while applying local frontmatter edits.
  • CLI help

    • Updates command text to state that source-managed workflows can be edited locally and merged with future updates.
  • Coverage

    • Updates unit and integration coverage from “rejects source-managed workflows” to “edits source-managed workflows while retaining source:”.

Example:

---
source: owner/repo/.github/workflows/repo-assist.md@v1
on: workflow_dispatch
max-turns: 20
---

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix 'gh aw edit' to allow editing source managed workflows Allow gh aw edit on source-managed workflows Aug 25, 2026
Copilot AI requested a review from dsyme August 25, 2026 21:27
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: medium | Score: 47/100 (impact 22/50, urgency 12/30, quality 13/20) | Action: batch_review | Batch: workflow-runtime

Generated by 🔧 PR Triage Agent · copilot · mai10 · 12.3 AIC · ⌖ 2.45 AIC · ⊞ 15.6K ·

@github-actions

Copy link
Copy Markdown
Contributor

Triage update: Category: bug | Risk: medium | Score: 42/100 (impact 20 + urgency 12 + quality 10) | Action: batch_review | Batch: workflow-runtime

Generated by 🔧 PR Triage Agent · copilot · mai10 · 17.1 AIC · ⌖ 2.78 AIC · ⊞ 15.6K ·

@github-actions

Copy link
Copy Markdown
Contributor

Triage update: Category: bug | Risk: medium | Score: 42/100 (impact 20 + urgency 12 + quality 10) | Action: batch_review | Batch: workflow-runtime

Generated by 🔧 PR Triage Agent · copilot · mai10 · 17.1 AIC · ⌖ 2.78 AIC · ⊞ 15.6K ·

@pelikhan
pelikhan marked this pull request as ready for review August 26, 2026 13:59
Copilot AI balanced review requested due to automatic review settings August 26, 2026 13:59
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #55875

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed: PR #55875 does not have the implementation label and has only 21 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-26T14:05:00Z
review_event: REQUEST_CHANGES
top_themes:
  - missing update/merge regression coverage for newly-editable source-managed workflows
files_reviewed:
  - pkg/cli/edit_command.go
  - pkg/cli/edit_command_integration_test.go
  - pkg/cli/edit_command_test.go
comment_count: 1

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · pi · gpt54 · 19.8 AIC · ⌖ 6.95 AIC · ⊞ 7K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES

The behavioral change here is bigger than the diff suggests: once gh aw edit starts mutating source: workflows, the update/merge path becomes part of the contract, and this PR does not test that those local frontmatter edits survive a later gh aw update.

Blocking theme

The new tests only prove that edit can write a source: workflow and preserve the source field immediately afterward. They do not cover the follow-on update behavior that the CLI help now explicitly promises (“future updates will merge in those local changes”). Without an integration test through the merge/update path, this is one refactor away from silently dropping user overrides.

🔎 Code quality review by PR Code Quality Reviewer · pi · gpt54 · 19.8 AIC · ⌖ 6.95 AIC · ⊞ 7K
Comment /review to run again

Comment thread pkg/cli/edit_command.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Allows local edits to source-managed workflows while retaining source metadata and recompiling outputs.

Changes:

  • Removes the source-managed edit restriction.
  • Updates CLI help and test coverage.
Show a summary per file
File Description
pkg/cli/edit_command.go Enables and documents managed workflow edits.
pkg/cli/edit_command_test.go Tests dry-run source retention.
pkg/cli/edit_command_integration_test.go Tests persisted edits and compilation.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread pkg/cli/edit_command.go Outdated
The workflow-id may be a workflow name, a Markdown filename, or a path. Changes are
validated before writing. Workflows managed by a source: declaration cannot be edited.
validated before writing. Workflows managed by a source: declaration can be edited
locally; future updates will merge in those local changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated docs/adr/55475-schema-validated-workflow-frontmatter-edit-command.md so the ADR matches the new source-managed edit behavior and documents the managed source: limitation. Commit: ae3aa46.

Comment thread pkg/cli/edit_command.go Outdated
Comment on lines +28 to +29
validated before writing. Workflows managed by a source: declaration can be edited
locally; future updates will merge in those local changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a guard that rejects top-level source edits on already source-managed workflows, plus unit coverage for --set source, nested source.*, and --unset source. Commit: ae3aa46.

@github-actions github-actions Bot mentioned this pull request Aug 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /tdd, /diagnosing-bugs, and /grill-with-docs — one minor comment, otherwise clean.

📋 Key Themes & Highlights

Key Themes

  • Root cause properly addressed: the overly-restrictive guard is removed at the right layer; the fix is minimal and surgical.
  • Help text accuracy: the updated Long description is mostly correct but omits the --no-merge caveat (see inline comment).

Positive Highlights

  • ✅ Both unit and integration tests updated to cover the new behaviour — source: preservation verified explicitly in the integration test.
  • ✅ The unit test correctly uses --dry-run to verify the file is not mutated, and separately checks the output contains the expected frontmatter keys — clean Arrange/Act/Assert structure.
  • ✅ The integration test asserts frontmatter["source"] is preserved after the edit, which is the critical invariant for this change.
  • ✅ PR description clearly explains the motivation and reconciliation model (gh aw update merges local changes).

The single inline comment asks for a small docs clarification around --no-merge. No blocking issues.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet46 · 27.4 AIC · ⌖ 9.91 AIC · ⊞ 7.6K
Comment /matt to run again

Comment thread pkg/cli/edit_command.go

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Allow gh aw edit on source-managed workflows

Impeccable modes applied: harden, audit

The change is small, well-scoped, and correctly tested. Removing the hard block in favour of the update command's existing 3-way merge is a reasonable UX improvement.

Non-blocking suggestion

There is no runtime hint to the user when they edit a source-managed workflow. Someone who runs gh aw edit on a managed workflow and later runs gh aw update --no-merge will silently lose their edits. A one-line warning when parsed.Frontmatter["source"] is set (e.g. cmd.PrintErrln(...)) would surface the risk at the right moment without blocking the operation.

Otherwise the implementation looks correct. ✅

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet46 · 19.1 AIC · ⌖ 9.06 AIC · ⊞ 6.2K

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.

Please do one focused follow-up pass:

  • address the blocking review asking for regression coverage that proves source-managed local edits survive a later gh aw update merge path
  • reply in the existing review thread(s) with the concrete test/commit reference once added
  • refresh the branch if needed and use the pr-finisher skill before handing back for review

Run: https://github.com/github/gh-aw/actions/runs/32979958387

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 23.4 AIC · ⌖ 8.18 AIC · ⊞ 8.7K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

gh-aw-pr-sous-chef
@copilot PR Sous Chef triage: this PR still needs a forward-progress pass before maintainer investigation is likely to be productive.
...

Completed the follow-up pass in ae3aa46: added source-managed edit/update-merge regression coverage, protected managed source: from gh aw edit, updated the ADR/help wording, and ran local validation (make agent-report-progress).

Copilot AI requested a review from gh-aw-bot August 26, 2026 14:50
@pelikhan
pelikhan merged commit 1ea1db1 into main Aug 26, 2026
32 checks passed
@pelikhan
pelikhan deleted the copilot/fix-edit-source-managed-workflow branch August 26, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"gh aw edit" should be able to edit a "source managed" workflow

5 participants