Require explicit Copilot engine for init artifacts - #50427
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot always write the dispatcher skill. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
PR Triage
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (81 additions across 5 files, all in .github/skills/ which are not business logic directories). |
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ PR Code Quality Reviewer completed the code quality review. |
|
✅ Test Quality Sentinel completed test quality analysis. |
There was a problem hiding this comment.
Pull request overview
Updates gh aw init so most Copilot artifacts require explicit Copilot engine selection, but the dispatcher skill remains incorrectly engine-independent.
Changes:
- Gates custom agent, MCP config, and setup workflow on
--engine copilot. - Updates help text and regression tests.
- Retains deprecated MCP flag support.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/init.go |
Adds explicit Copilot artifact gating. |
pkg/cli/init_command.go |
Updates initialization help and examples. |
pkg/cli/init_command_test.go |
Revises command and artifact tests. |
pkg/cli/init_integration_test.go |
Updates default initialization expectations. |
pkg/cli/init_mcp_test.go |
Explicitly selects Copilot in MCP tests. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Suppressed comments (1)
pkg/cli/init_command_test.go:592
- The non-Copilot regression now expects the dispatcher skill to exist, contrary to the requirement that non-Copilot initialization remain free of Copilot-specific artifacts. Assert non-existence instead.
if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflows", "SKILL.md")); err != nil {
t.Errorf("Expected dispatcher skill file to be created for non-Copilot engine: %v", err)
- Files reviewed: 5/5 changed files
- Comments generated: 6
- Review effort level: Balanced
| } else { | ||
| initLog.Print("Skipping agentic workflows dispatcher skill") | ||
| // Write dispatcher skill | ||
| if opts.Skill { |
|
|
||
| This command: | ||
| - Configures .gitattributes to mark .lock.yml files as generated | ||
| - Creates the dispatcher skill at .github/skills/agentic-workflows/SKILL.md |
| // The dispatcher skill is created for every engine. | ||
| skillPath := filepath.Join(setup.tempDir, ".github", "skills", "agentic-workflows", "SKILL.md") | ||
| _, err = os.Stat(skillPath) | ||
| require.NoError(t, err, "dispatcher skill file should be created at %s", skillPath) |
|
|
||
| // Test init with deprecated --mcp flag for backward compatibility (mcp=true) | ||
| err = InitRepository(InitOptions{Verbose: false, Skill: true, Agent: true, MCP: true, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil}) | ||
| err = InitRepository(InitOptions{Verbose: false, Engine: "copilot", Skill: true, Agent: true, MCP: true, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil}) |
|
|
||
| // Run init twice with MCP enabled by default | ||
| err = InitRepository(InitOptions{Verbose: false, Skill: true, Agent: true, MCP: true, CodespaceRepos: []string{}, CodespaceEnabled: false, Completions: false, CreatePR: false, RootCmd: nil}) | ||
| // Run init twice with default options. |
| if _, err := os.Stat(filepath.Join(".github", "skills", "agentic-workflows", "SKILL.md")); err != nil { | ||
| t.Errorf("Expected dispatcher skill file to be created by default: %v", err) | ||
| } |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd and /codebase-design — no blocking issues, but three observations worth addressing.
📋 Key Themes & Highlights
Key Themes
- Shared test directory causes temporal coupling: The new two-phase test runs both default and
--engine copilotinit in the sametmpDir. The second phase can't falsify the first phase's absence assertions because those files may already be present. - Stale
MCP: true/Agent: truein non-Copilot test calls: A dozen existing tests still pass those options withoutEngine: "copilot", but don't assert that the corresponding artifacts are absent — silent regression risk. - Dropped log line: The old
"Skipping Copilot dispatcher skill"observability is now gone.
Positive Highlights
- ✅ Core logic change is a clean one-liner:
opts.Engine == "copilot" - ✅ Help text updated accurately — the Copilot-specific flags are now clearly documented under
--engine copilot - ✅ Good coverage added for the new default-engine behaviour
- ✅ Deprecated
--mcpflag message updated to guide users to--engine copilot
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 41.6 AIC · ⌖ 10.1 AIC · ⊞ 7.1K
Comment /matt to run again
Comments that could not be inline-anchored
pkg/cli/init_command_test.go:310
[/tdd] Several tests (TestInitRepositoryErrorHandling, TestInitRepositoryWithExistingFiles, TestInitRepositoryWithCodespace, etc.) still call InitRepository without Engine: "copilot" but include MCP: true and Agent: true. Under the new semantics those Copilot artifacts won't be created, yet no assertion confirms they're absent — a future regression could re-enable them silently.
<details>
<summary>💡 Suggestion</summary>
Add a negative assertion in each non-Copilot call site…
pkg/cli/init_command_test.go:295
[/tdd] The new two-phase test (default run, then --engine copilot run) shares a single tmpDir directory. This means the second run inherits all files written by the first. It cannot detect whether the Copilot artifacts were absent before --engine copilot was passed, because the first run's output is already on disk.
<details>
<summary>💡 Suggestion</summary>
Split into two independent subtests, each with its own TempDir:
t.Run("default engine", func(t *testing.T) {
//…
</details>
<details><summary>pkg/cli/init.go:10</summary>
**[/codebase-design]** The dispatcher skill is now unconditionally created regardless of engine (moved outside the `copilotArtifactsEnabled` block), but the log message on line 31 still says "Writing agentic workflows dispatcher skill" without mentioning why it runs for all engines. The previous else-branch logged `"Skipping Copilot dispatcher skill for engine: %s"` — that message has been dropped entirely.
<details>
<summary>💡 Suggestion</summary>
Add a brief log message for the non-Copilot…
</details>|
@copilot run pr-finisher skill |
There was a problem hiding this comment.
Review: Require explicit Copilot engine for init artifacts
The changes are correct and well-structured. The core logic change is minimal and intentional:
// Before
copilotArtifactsEnabled := opts.Engine == "" || opts.Engine == "copilot"
// After
copilotArtifactsEnabled := opts.Engine == "copilot"This properly gates Copilot-specific artifacts (custom agent, MCP config, setup workflow) behind an explicit --engine copilot flag while keeping the dispatcher skill universally available.
Test coverage is thorough — the renamed test TestInitCommandRequiresCopilotEngineForCopilotArtifacts now validates both the default (no Copilot artifacts) and --engine copilot (Copilot artifacts present) paths in sequence.
Documentation updates in init_command.go accurately reflect the new behavior, including the updated --mcp deprecation notice.
No issues found. ✅
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 39.2 AIC · ⌖ 7.57 AIC · ⊞ 5.4K
🧪 Test Quality Sentinel Report
📊 Metrics (14 tests)
Verdict
References: PR #50427
|
There was a problem hiding this comment.
Request changes: backward-compatibility regression in --mcp flag
The deprecated --mcp flag is documented as being "kept for backward compatibility" but its effect is now gated on --engine copilot. Existing scripts/CI running gh aw init --mcp (or --mcp without --engine copilot) will silently stop generating MCP config, with no warning or error.
💡 Details
In pkg/cli/init.go line 132:
if opts.MCP && copilotArtifactsEnabled {copilotArtifactsEnabled is opts.Engine == "copilot" (line 45). Previously (opts.Engine == "" || opts.Engine == "copilot") the default/no-engine case still allowed MCP artifacts. Now, gh aw init --mcp alone produces no .github/mcp.json or copilot-setup-steps.yml, silently diverging from the flag's documented "backward compatibility" purpose. There's no validation error or warning when --mcp is set without --engine copilot, so users relying on scripted/CI usage of the deprecated flag get silently different behavior after upgrading.
Suggested fix: either emit an explicit error/warning when --mcp/true is set without --engine copilot, or treat explicit --mcp as also implying Copilot artifact generation for true backward compatibility.
🔎 Code quality review by PR Code Quality Reviewer · auto · 157.7 AIC · ⌖ 4.68 AIC · ⊞ 7.9K
Comment /review to run again
Comments that could not be inline-anchored
pkg/cli/init.go:132
Deprecated --mcp flag now silently no-ops for the default engine, breaking backward compatibility.
|
@copilot run pr-finisher skill |
|
🎉 Great work on this feature! This PR looks solid — you're correctly restricting Copilot-specific artifacts ( The PR is ready for review. The changes align well with the project's initialization architecture and contribute to better separation of concerns for different engine configurations.
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Ran the pr-finisher pass and pushed f1e8cd6. Local fmt/lint/test-unit/recompile and targeted init tests pass; full |
|
🎉 This pull request is included in a new release. Release: |
gh aw initcurrently creates Copilot-specific files by default. These artifacts should only be generated when the Copilot engine is explicitly selected.Changes
--engine copilot.