Skip to content

Refactor agentic-workflows dispatcher from legacy agent file to skill#35580

Merged
pelikhan merged 12 commits into
mainfrom
copilot/refactor-agentic-workflows-skill
May 29, 2026
Merged

Refactor agentic-workflows dispatcher from legacy agent file to skill#35580
pelikhan merged 12 commits into
mainfrom
copilot/refactor-agentic-workflows-skill

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

This PR migrates the agentic-workflows dispatcher from the legacy custom agent file to the skill format and aligns init/upgrade flows with that model. It also adds migration cleanup so repositories are moved forward without keeping stale agent artifacts.

  • Dispatcher source moved to skill path

    • init, fix, and upgrade now manage .github/skills/agentic-workflows/SKILL.md instead of .github/agents/agentic-workflows.agent.md.
    • Download/update logic now fetches the skill template from the upstream skill path.
  • Codemod + upgrade migration behavior

    • Added cleanup of legacy .github/agents/agentic-workflows.agent.md in old-file deletion codemods.
    • Upgrade PR staging allowlist now includes the new skill file and still stages the legacy agent path to capture deletions.
  • Repository/docs alignment

    • Removed .github/agents/agentic-workflows.agent.md from this repository.
    • Updated CLI/help/workflow/docs references to point to .github/skills/agentic-workflows/SKILL.md.
    • Updated wording from “dispatcher agent” to “dispatcher skill” where relevant.
  • Targeted test updates

    • Adjusted init/upgrade and cleanup expectations for the new skill path and legacy deletion behavior.
// before
targetPath := filepath.Join(gitRoot, ".github", "agents", "agentic-workflows.agent.md")

// after
targetPath := filepath.Join(gitRoot, ".github", "skills", "agentic-workflows", "SKILL.md")

Generated by 👨‍🍳 PR Sous Chef · gpt54 16M ·

Copilot AI and others added 2 commits May 28, 2026 21:50
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Refactor agentic-workflows dispatcher into skill Refactor agentic-workflows dispatcher from legacy agent file to skill May 28, 2026
Copilot AI requested a review from pelikhan May 28, 2026 21:56
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot find occurrences of /agent and replace it with skill calling

Copilot AI and others added 5 commits May 28, 2026 22:17
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>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2026

@copilot find occurrences of /agent and replace it with skill calling

Addressed in d4e966c (plus follow-up doc consistency fixes in ddc5af1, fb22b74, and 41e308a). I replaced /agent usage with skill-calling phrasing/usages across the remaining setup/debug/reference docs and related templates.

@pelikhan pelikhan marked this pull request as ready for review May 28, 2026 22:28
Copilot AI review requested due to automatic review settings May 28, 2026 22:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

PR Code Quality Reviewer completed the code quality review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Design Decision Gate 🏗️ completed the design decision gate check.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

🧪 Test Quality Sentinel completed test quality analysis.

@github-actions github-actions Bot mentioned this pull request May 28, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the agentic-workflows dispatcher from the legacy custom agent file (.github/agents/agentic-workflows.agent.md) to the skill format (.github/skills/agentic-workflows/SKILL.md) and updates CLI flows, upgrade/cleanup behavior, and documentation to match.

Changes:

  • Update init/fix/upgrade CLI flows to manage the dispatcher as a skill (and download the template from the upstream skill path).
  • Extend migration cleanup to remove the legacy dispatcher agent file during old-agent cleanup, while allowing upgrade PR staging to capture deletions.
  • Update repository docs/workflows/action guidance to reference skills instead of agents.
Show a summary per file
File Description
pkg/cli/upgrade_command.go Updates upgrade messaging around updating the dispatcher (now a skill).
pkg/cli/init.go Updates init flow logs/messages and PR body wording to refer to “skill”.
pkg/cli/init_command.go Updates gh aw init help text to reference the new skill path and skill invocation wording.
pkg/cli/init_command_test.go Updates init tests to assert the skill file is not created for non-Copilot engines.
pkg/cli/fix_command.go Updates fix flow logs/messages to refer to “skill”.
pkg/cli/copilot_agents.go Writes dispatcher to .github/skills/agentic-workflows/SKILL.md and expands legacy .github/agents cleanup to delete the old dispatcher agent file.
pkg/cli/copilot_agents_test.go Updates deletion tests to include the legacy dispatcher agent file.
pkg/cli/agent_download.go Switches download source URL to the skill template path and updates related logging/messages.
install.md Updates installation/setup instructions to reference the dispatcher skill file and skill invocation.
docs/src/content/docs/troubleshooting/debugging.md Updates troubleshooting instructions to invoke the skill instead of /agent.
docs/src/content/docs/troubleshooting/debug-ghe.md Updates GHE debugging steps to reference the skill.
docs/src/content/docs/troubleshooting/common-issues.md Updates sample debugging invocations to use the skill.
docs/src/content/docs/setup/creating-workflows.mdx Updates setup guidance to refer to the dispatcher skill and skill invocation.
docs/src/content/docs/setup/cli.md Updates CLI docs for init to reference the dispatcher skill file.
docs/src/content/docs/reference/glossary.md Renames “Agent Files” glossary entry to “Skill Files” and updates description.
docs/src/content/docs/reference/faq.md Updates FAQ examples to use skill invocation wording.
docs/src/content/docs/reference/custom-agent-for-aw.mdx Renames and updates the guide to “Skills” terminology and examples.
docs/src/content/docs/guides/upgrading.md Updates upgrade guide to reference .github/skills/... and staging paths.
docs/src/content/docs/guides/agentic-authoring.mdx Updates Copilot invocation examples to use the skill.
docs/src/content/docs/examples/maintaining-repos.md Updates examples to use skill invocation.
debug.md Updates debugging prompt docs to refer to the skill.
create.md Updates creation docs to reference the skill file path.
CONTRIBUTING.md Updates contributor prompt guidance to link to the skill template.
AGENTS.md Updates repo overview guidance to refer to the agentic-workflows skill.
actions/setup/md/missing_tool_issue.md Updates setup issue template to invoke the skill.
actions/setup/md/missing_data_issue.md Updates setup issue template to invoke the skill.
actions/setup/md/agent_failure_issue.md Updates failure template to load the skill from the new path/URL.
actions/setup/js/run_operation_update_upgrade.test.cjs Updates upgrade PR staging expectations to include the skill file and legacy agent deletion staging.
actions/setup/js/run_operation_update_upgrade.cjs Adds the skill file to the upgrade allowlist while keeping legacy agent path for deletion staging.
.github/workflows/workflow-generator.md Updates generator workflow instructions to reference the skill file.
.github/workflows/workflow-generator.lock.yml Regenerates lock metadata after prompt changes.
.github/workflows/cgo.yml Updates CI check wording/path to validate skill file URL refs.
.github/skills/agentic-workflows/SKILL.md Updates dispatcher content to the skill model and removes legacy self-references.
.github/aw/cli-commands.md Updates CLI reference to point to the dispatcher skill path.
.github/agents/agentic-workflows.agent.md Removes the legacy dispatcher agent file from the repo.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 35/35 changed files
  • Comments generated: 5

Comment thread pkg/cli/agent_download.go Outdated
Comment on lines +20 to +22
// downloadAgentFileFromGitHub downloads the agentic-workflows SKILL.md file from GitHub.
func downloadAgentFileFromGitHub(verbose bool) (string, error) {
agentDownloadLog.Print("Downloading agentic-workflows.agent.md from GitHub")
agentDownloadLog.Print("Downloading agentic-workflows SKILL.md from GitHub")
Comment thread install.md Outdated
@@ -98,7 +98,7 @@ After successful initialization, the user can:

- **Add workflows from repos**: `gh aw add githubnext/agentics`
- **Create new workflows**: `gh aw new <workflow-name>` os using the agent
Comment thread CONTRIBUTING.md Outdated
https://github.com/owner/repo/actions/runs/RUN_ID

Load [https://github.com/github/gh-aw/.github/agents/agentic-workflows.agent.md and](https://github.com/github/gh-aw/blob/main/.github/agents/agentic-workflows.agent.md) investigate:
Load [https://github.com/github/gh-aw/.github/skills/agentic-workflows/SKILL.md and](https://github.com/github/gh-aw/blob/main/.github/skills/agentic-workflows/SKILL.md) investigate:
## Installing the Copilot Agent Files for Agentic Workflows
## Installing the Copilot Skill Files for Agentic Workflows

Follow these steps to set up your repository for agentic workflows using the custom `agentic-workflows` agent.
Comment on lines 52 to 59
## Debugging Workflows

Use the agentic workflows agent to diagnose and fix failing workflow runs.

### Through Copilot

If your repository is [configured for agentic authoring](#configuring-your-repository), use the `agentic-workflows` agent in Copilot Chat:
If your repository is [configured for agentic authoring](#configuring-your-repository), use the `agentic-workflows` skill in Copilot Chat:

@github-actions
Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 70/100 — Acceptable

Analyzed 3 modified test(s): 3 design tests, 0 implementation tests, 0 guideline violations. Minor test-inflation flag on the JavaScript test file (3:1 added-lines ratio vs. production).

📊 Metrics & Test Classification (3 tests analyzed)
Metric Value
New/modified tests analyzed 3
✅ Design tests (behavioral contracts) 3 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 2 (67%)
Duplicate test clusters 0
Test inflation detected Yes — run_operation_update_upgrade.test.cjs (3 lines added vs 1 in production)
🚨 Coding-guideline violations 0

Test Classification Details

Test File Classification Issues Detected
should stage skill and legacy agent files on upgrade actions/setup/js/run_operation_update_upgrade.test.cjs:296 ✅ Design No error/rejection path; mocks are all external I/O (exec, getExecOutput)
TestDeleteOldAgentFiles (table rows: dispatcher file cases) pkg/cli/copilot_agents_test.go:19 ✅ Design Table-driven with mixed-files edge case row
TestInitRepositoryWithNonCopilotEngineSkipsCopilotArtifacts pkg/cli/init_command_test.go:335 ✅ Design Negative assertion (file should NOT exist) counts as edge case

Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 2 tests — unit (//go:build !integration)
  • 🟨 JavaScript (*.test.cjs): 1 test (vitest)
⚠️ Flagged Tests — Minor Notes (1 issue)

⚠️ run_operation_update_upgrade.test.cjs — Test Inflation (minor)

Classification: Design test (minor flag)
Issue: 3 lines added in the test file vs. 1 line added in the production .cjs file — ratio 3:1, exceeding the 2:1 threshold. This is very minor since the changes are path-update adjustments. The test correctly adds a new exec assertion for the new skill file path alongside the existing legacy assertion.
Suggested improvement: No action required — the extra lines represent a meaningful additional behavioral assertion (git add for the new skill file). The inflation flag is a mechanical artefact of a small production change.

Verdict

Check passed. 0% of new tests are implementation tests (threshold: 30%). All three modified tests verify observable behavioral contracts (file deletion, file staging, and file non-creation). Build tags are present on all Go test files and no mock libraries were used.

📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References: §26606002682

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 1.4M ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 70/100. Test quality is acceptable — 0% of new tests are implementation tests (threshold: 30%).

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /improve-codebase-architecture and /tdd — commenting with non-blocking suggestions.

📋 Key Themes & Highlights

Key Themes

  • Stale function names: downloadAgentFileFromGitHub, downloadAgentFileViaGHCLI, updateAgentFiles, and deleteOldAgentFiles still use "agent" vocabulary after the migration to "skill". The path strings are correct; the function names are the remaining inconsistency.
  • Wrong file permission: SKILL.md is written with FilePermSensitive (0600) inherited from the old agent-file logic. The comment was updated to say "Skill files may contain sensitive configuration" but that's not accurate — this is a public instruction file. FilePermPublic (0644) is the right constant and already exists in pkg/constants.
  • Missing positive test: The updated test in init_command_test.go only asserts the negative case (SKILL.md must not be created for non-Copilot engines). A positive assertion that init does create the file at the new path is absent.

Positive Highlights

  • ✅ Clean, mechanical migration — path strings and URL constructions are all correctly updated
  • ✅ Migration cleanup logic (deleteOldAgentFiles now includes agentic-workflows.agent.md) is well-placed and tested
  • ✅ Upgrade staging allowlist in run_operation_update_upgrade.cjs correctly covers both the new skill path and the legacy agent path for atomic deletion
  • ✅ Broad docs/help-text sweep is thorough and consistent
  • ✅ Net -231 lines — good deletion-to-addition ratio for a refactor of this scope

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 1.9M

Comment thread pkg/cli/copilot_agents.go Outdated
// Write the file with restrictive permissions (0600) to follow security best practices
// Agent files may contain sensitive configuration
// Skill files may contain sensitive configuration
if err := os.WriteFile(targetPath, []byte(agentContent), constants.FilePermSensitive); err != nil {
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.

[/improve-codebase-architecture] SKILL.md is written with FilePermSensitive (0600), but the accompanying comment now reads "Skill files may contain sensitive configuration" — which is not true for a public instruction file committed to the repo.

💡 Suggestion

Switch to FilePermPublic (0o644) which already exists in pkg/constants:

// Skill files are public instruction files; use standard readable permissions.
if err := os.WriteFile(targetPath, []byte(agentContent), constants.FilePermPublic); err != nil {

Using FilePermSensitive on a file that users and CI jobs need to read (and that lives in .github/) can cause subtle permission issues and is inconsistent with the file's nature.

Comment thread pkg/cli/agent_download.go Outdated

// downloadAgentFileFromGitHub downloads the agentic-workflows.agent.md file from GitHub
// downloadAgentFileFromGitHub downloads the agentic-workflows SKILL.md file from GitHub.
func downloadAgentFileFromGitHub(verbose bool) (string, error) {
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.

[/improve-codebase-architecture] Function name downloadAgentFileFromGitHub (and its fallback downloadAgentFileViaGHCLI) still use the old "agent" vocabulary even though the function now fetches a skill file.

💡 Suggestion

Rename to downloadSkillFileFromGitHub / downloadSkillFileViaGHCLI to stay consistent with the migration. The same applies to updateAgentFiles in upgrade_command.go and deleteOldAgentFiles in copilot_agents.go — these function names are now misleading when the dominant concept is "skill".

Leaving the rename as follow-up work is fine, but a //nolint:revive // TODO: rename comment keeps the intent visible.


if _, err := os.Stat(filepath.Join(".github", "agents", "agentic-workflows.agent.md")); err == nil {
t.Error("Expected dispatcher agent file to NOT be created for non-Copilot engine")
if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflows", "SKILL.md")); err == nil {
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.

[/tdd] This test only covers the negative case (SKILL.md must NOT be created for non-Copilot engines). There is no test asserting that gh aw init with a Copilot engine creates .github/skills/agentic-workflows/SKILL.md at the correct path — meaning a path regression in copilot_agents.go would go undetected.

💡 Suggested test addition

Add an assertion in TestInitRepositoryBasic (or a dedicated test) that confirms the skill file is created:

skillPath := filepath.Join(".github", "skills", "agentic-workflows", "SKILL.md")
if _, err := os.Stat(skillPath); err != nil {
    t.Errorf("Expected dispatcher skill file to be created at %s: %v", skillPath, err)
}

The test can mock downloadAgentFileFromGitHub or use a local fixture — the key is that a path change in the production code immediately turns this test red.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

REQUEST_CHANGES — migration cleanup is wired correctly in fix but missing from both upgrade and init, so the old dispatcher agent file survives those paths and two dispatcher definitions coexist.

### Blocking issues (2 high/medium)
  • upgrade_command.go / updateAgentFiles — never calls deleteOldAgentFiles. After gh aw upgrade the new SKILL.md is written but .github/agents/agentic-workflows.agent.md is left on disk. Copilot will load both files with undefined resolution order.
  • init.go — same omission. A repo that already has the legacy agent file installed retains it after gh aw init.

fix_command.go already demonstrates the correct two-step pattern; replicate it in both callers.

The JS staging allowlist comment (// Old agent files that may be deleted by deleteOldAgentFiles) is also incorrect as a follow-on consequence — the file is never deleted by upgrade, so staging it changes nothing.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 2.7M

Comments that could not be inline-anchored

pkg/cli/upgrade_command.go:366

updateAgentFiles leaves the old dispatcher agent file on disk — after gh aw upgrade, .github/agents/agentic-workflows.agent.md is never deleted, so both the legacy agent and the new SKILL.md coexist.

<details>
<summary>💡 Fix</summary>

fix_command.go correctly calls both ensureAgenticWorkflowsDispatcher and deleteOldAgentFiles. The same pattern must be applied here:

func updateAgentFiles(ctx context.Context, verbose bool) error {
    if err := ensureAgenticWorkflowsDisp</details>

<details><summary>pkg/cli/init.go:97</summary>

**`init` also skips `deleteOldAgentFiles`**a repo that already has `.github/agents/agentic-workflows.agent.md` (e.g. cloned from a pre-migration template) will silently retain the old file after `gh aw init`.

&lt;details&gt;
&lt;summary&gt;💡 Fix&lt;/summary&gt;

Add the same call that `fix_command.go` makes, right after `ensureAgenticWorkflowsDispatcher` succeeds:

```go
if err := deleteOldAgentFiles(opts.Verbose); err != nil {
    initLog.Printf(&quot;Failed to delete old agent files: %v&quot;, err)
    // non-fatal…

</details>

<details><summary>actions/setup/js/run_operation_update_upgrade.cjs:21</summary>

**Misleading comment**: `gh aw upgrade` does not call `deleteOldAgentFiles`.

&lt;details&gt;
&lt;summary&gt;💡 Details&lt;/summary&gt;

The comment on the next line (`// Old agent files that may be deleted by deleteOldAgentFiles:`) implies the upgrade pipeline deletes the legacy agent file. It does not — `deleteOldAgentFiles` is only called from `fix_command.go`. As a result, `git add -- .github/agents/agentic-workflows.agent.md` stages an **unchanged existing file**, not a deletion. The old file stays on disk …

</details>

@github-actions
Copy link
Copy Markdown
Contributor

@copilot review all comments and address unresolved review feedback. Also summarize the remaining blockers and rerun checks on the current branch.

Generated by 👨‍🍳 PR Sous Chef · gpt54 16M ·

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot no. Review all comments and reviews from copilot and github-actions actor.

Copilot AI and others added 3 commits May 29, 2026 00:05
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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 29, 2026

@copilot no. Review all comments and reviews from copilot and github-actions actor.

Addressed in e6aabbe and c445db3.

I reviewed the remaining Copilot and github-actions[bot] feedback and fixed the actionable items in this PR: renamed stale skill-download helpers, switched the dispatcher skill file to public permissions, added legacy dispatcher cleanup to init and upgrade, fixed the remaining skill/agent doc wording and malformed link text, added init coverage for skill creation and legacy cleanup, and removed the last legacy dispatcher path reference from SKILL.md.

go test ./pkg/cli -count=1 passes.

The only review note still outstanding is an unrelated lockfile comment on smoke-update-cross-repo-pr.lock.yml from merged branch history, which I did not change here.

@github-actions
Copy link
Copy Markdown
Contributor

@copilot review all comments and address unresolved review feedback.
Please address the requested changes and push a refreshed branch.

Generated by 👨‍🍳 PR Sous Chef · gpt54 6.3M ·

@pelikhan pelikhan merged commit 9f71ca7 into main May 29, 2026
31 of 32 checks passed
@pelikhan pelikhan deleted the copilot/refactor-agentic-workflows-skill branch May 29, 2026 00:25
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.

3 participants