Skip to content

Require explicit Copilot engine for init artifacts - #50427

Merged
pelikhan merged 4 commits into
mainfrom
copilot/update-init-command-files-again
Aug 5, 2026
Merged

Require explicit Copilot engine for init artifacts#50427
pelikhan merged 4 commits into
mainfrom
copilot/update-init-command-files-again

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

gh aw init currently creates Copilot-specific files by default. These artifacts should only be generated when the Copilot engine is explicitly selected.

Changes

  • Generate the dispatcher skill, custom agent, MCP configuration, and Copilot setup workflow only with --engine copilot.
  • Keep default and non-Copilot initialization free of Copilot-specific files.
  • Update command help and regression coverage to reflect the new behavior.
gh aw init                   # Skips Copilot artifacts
gh aw init --engine copilot  # Creates Copilot artifacts

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

pelikhan commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot always write the dispatcher skill.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot always write the dispatcher skill.

Updated in a406f48: gh aw init now always writes the dispatcher skill unless --no-skill is set; the other Copilot artifacts still require --engine copilot.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: feature (init command behavior change)
  • Risk: medium (touches gh aw init default artifact generation logic, 5 files, +81/-53)
  • Priority score: 62/100 (impact 30, urgency 15, quality 17)
  • Recommended action: fast_track — clear scope, tests updated, maintainer feedback already addressed (dispatcher skill always written per @pelikhan comment)
  • CI: pending/unknown at triage time — verify before merge
  • Notes: Draft PR with active maintainer back-and-forth; ready for focused human review once CI is confirmed green.

Generated by 🔧 PR Triage Agent · auto · 30.3 AIC · ⌖ 4.29 AIC · ⊞ 8K ·

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

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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).

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

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

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

Comment thread pkg/cli/init.go
} else {
initLog.Print("Skipping agentic workflows dispatcher skill")
// Write dispatcher skill
if opts.Skill {
Comment thread pkg/cli/init_command.go

This command:
- Configures .gitattributes to mark .lock.yml files as generated
- Creates the dispatcher skill at .github/skills/agentic-workflows/SKILL.md
Comment on lines +89 to 92
// 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)
Comment thread pkg/cli/init_command_test.go Outdated

// 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})
Comment thread pkg/cli/init_command_test.go Outdated

// 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.
Comment on lines +280 to +282
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)
}

@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 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 copilot init in the same tmpDir. The second phase can't falsify the first phase's absence assertions because those files may already be present.
  • Stale MCP: true / Agent: true in non-Copilot test calls: A dozen existing tests still pass those options without Engine: "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 --mcp flag 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: &quot;copilot&quot; 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(&quot;default engine&quot;, 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 &quot;Writing agentic workflows dispatcher skill&quot; without mentioning why it runs for all engines. The previous else-branch logged `&quot;Skipping Copilot dispatcher skill for engine: %s&quot;`that message has been dropped entirely.

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

Add a brief log message for the non-Copilot</details>

@pelikhan

pelikhan commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@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: 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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 61/100 — Acceptable

Analyzed 14 test(s): 14 design, 0 implementation, 0 violation(s).

📊 Metrics (14 tests)
Metric Value
Analyzed 14 (Go: 14, JS: 0)
✅ Design 14 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 5 (36%)
Duplicate clusters 2
Inflation ⚠️ Yes (2.26:1)
🚨 Violations 0

Verdict

⚠️ Passed. 0% implementation tests (threshold: 30%). Minor inflation and duplicate clusters noted.

References: PR #50427

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 66.9 AIC · ⌖ 8.01 AIC · ⊞ 7.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.

✅ Test Quality Sentinel: 61/100. 0% implementation tests (threshold: 30%). No violations. Minor test inflation (2.26:1) and duplicate MCP test clusters noted but do not block merge.

@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: 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.

@pelikhan

pelikhan commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🎉 Great work on this feature! This PR looks solid — you're correctly restricting Copilot-specific artifacts (dispatcher.skill, custom agent, MCP config, and setup workflow) to cases where --engine copilot is explicitly set. The logic is clean, all five modified files stay focused on the init command, and the test suite has been updated thoughtfully with 58 new or modified test lines.

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.

Generated by ✅ Contribution Check · ⌖ 6.35 AIC ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Ran the pr-finisher pass and pushed f1e8cd6. Local fmt/lint/test-unit/recompile and targeted init tests pass; full make test still hits unrelated update-check tests in this Copilot/CI-style environment. CI on the new agent-pushed head has not run and needs a maintainer re-trigger before merge.

@pelikhan
pelikhan merged commit 002b2a7 into main Aug 5, 2026
@pelikhan
pelikhan deleted the copilot/update-init-command-files-again branch August 5, 2026 01:41
Copilot stopped work on behalf of pelikhan due to an error August 5, 2026 01:41
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.85.1

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.

3 participants