Skip to content

feat: tip for known external engines (opencode, crush) missing their import - #51088

Merged
pelikhan merged 14 commits into
mainfrom
copilot/update-compiler-agent-imports
Aug 7, 2026
Merged

feat: tip for known external engines (opencode, crush) missing their import#51088
pelikhan merged 14 commits into
mainfrom
copilot/update-compiler-agent-imports

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

When engine: opencode or engine: crush is used without importing the engine definition file, the compiler currently emits a generic "invalid engine" error with no guidance. These engines exist in shared/opencode.md / shared/crush.md but are not built into the binary.

Changes

  • pkg/workflow/engine_definition.go — adds knownEngineImports map (engine ID → import path) for opencode and crush; EngineCatalog.Resolve appends an import tip to the error message when the unknown engine ID is in the map
  • pkg/workflow/engine_definition_test.go — adds TestEngineCatalog_Resolve_KnownImportTip (opencode, crush) and TestEngineCatalog_Resolve_UnknownNoTip

Error message before / after

# before
invalid engine: opencode. Valid engines are: claude, codex, copilot, gemini, pi.

# after
invalid engine: opencode. Valid engines are: claude, codex, copilot, gemini, pi.

Tip: "opencode" is a known engine with a shared definition file. Import it before using this engine:

imports:
  - shared/opencode.md

New engines can be added by appending to knownEngineImports — no other code changes required.


Run context: https://github.com/github/gh-aw/actions/runs/31190216100> Generated by 👨‍🍳 PR Sous Chef · gpt54 · 21.1 AIC · ⊞ 8.3K ·

Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8 AIC · ⊞ 8.4K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 10.2 AIC · ⊞ 8.4K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title feat: add known engine imports tip for opencode and crush feat: tip for known external engines (opencode, crush) missing their import Aug 7, 2026
Copilot AI requested a review from pelikhan August 7, 2026 14:02
Comment thread pkg/workflow/engine_definition.go Outdated
Comment thread pkg/workflow/engine_definition.go Outdated
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan August 7, 2026 14:13
@pelikhan
pelikhan marked this pull request as ready for review August 7, 2026 14:13
Copilot AI balanced review requested due to automatic review settings August 7, 2026 14:14
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Design Decision Gate 🏗️. Review the logs for details.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (87 additions detected).

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for PR Code Quality Reviewer. Review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Test Quality Sentinel. Review the logs for details.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Security scanning failed for Matt Pocock Skills Reviewer. Review the logs for details.

@pelikhan

pelikhan commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot ensure all engines in this repository are in the list.
move the list into a JSON file in this repository (.github/aw/engines.json) and download it on the fly. Silent failure.

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

Adds actionable import guidance when resolving known external engines that lack their shared definitions.

Changes:

  • Maps external engine IDs to shared definition imports.
  • Appends import instructions to invalid-engine errors.
  • Tests known and unknown engine error behavior.
Show a summary per file
File Description
pkg/workflow/engine_definition.go Adds known-engine import tips.
pkg/workflow/engine_definition_test.go Tests tip generation and omission.

Review details

Tip

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

Suppressed comments (2)

pkg/workflow/engine_definition.go:446

  • Lowercasing only the tip lookup makes the guidance ineffective for inputs such as OpenCode: catalog registration and prefix resolution above remain case-sensitive, so importing the suggested lower-case definition still leaves OpenCode invalid and repeats this same tip. Match the known ID exactly here, or explicitly instruct the user to change the engine ID to its lower-case form.
	if importPath, ok := knownEngineImports[strings.ToLower(id)]; ok {

pkg/workflow/engine_definition.go:350

  • Kiro is also a non-built-in engine with a shared definition (.github/workflows/shared/kiro.md, documented alongside these samples in docs/src/content/docs/reference/engines.md:27-35), but it is omitted here. As a result, engine: kiro still receives the generic error while the other shared engines receive the new guidance. Add it to this catalog and to the table-driven tip test.
	"goose":    "github/gh-aw/.github/workflows/shared/goose.md@main",
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread pkg/workflow/engine_definition.go Outdated
// To add a new well-known engine, append an entry here with the engine ID as the
// key and the fully-qualified path to its shared engine definition file as the value.
var knownEngineImports = map[string]string{
"opencode": "github/gh-aw/.github/workflows/shared/opencode.md@main",

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

The implementation is clean and correct. knownEngineImports map is well-documented, the strings.ToLower lookup handles case-insensitive engine IDs properly, the tip is appended only after the existing error (not replacing it), and all 5 engines have corresponding tests. No blocking issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 17.2 AIC · ⊞ 5.3K

@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 /diagnosing-bugs and /tdd — two minor observations, no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • @main hardcoding — all five import paths pin to @main. If users are on a tagged release, the tip could direct them to a mismatched file. A shared constant for the ref would future-proof this.
  • Missing case-insensitive test — the production code normalises the engine ID with strings.ToLower, but no test exercises mixed-case input (e.g. "OpenCode").

Positive Highlights

  • ✅ Clean, additive design: new engines need only one line in knownEngineImports
  • ✅ Solid test coverage: five known-engine cases + a negative case for truly unknown engines
  • ✅ Error message is actionable — shows the exact imports: block the user needs to add
  • ✅ Good comment on the exported map documenting the expected key/value format

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 21.8 AIC · ⊞ 7.1K
Comment /matt to run again

Comment thread pkg/workflow/engine_definition.go Outdated
// To add a new well-known engine, append an entry here with the engine ID as the
// key and the fully-qualified path to its shared engine definition file as the value.
var knownEngineImports = map[string]string{
"opencode": "github/gh-aw/.github/workflows/shared/opencode.md@main",

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.

[/diagnosing-bugs] Import paths are hardcoded to @main, so users on a pinned release may follow a tip that points at a schema mismatched to their binary version.

💡 Suggestion

Consider exposing the ref as a constant (e.g. derived from the binary version) so all five entries can be updated in one place:

const knownEngineImportRef = "main" // or Version

var knownEngineImports = map[string]string{
    "opencode": fmt.Sprintf("github/gh-aw/.github/workflows/shared/opencode.md@%s", knownEngineImportRef),
    ...
}

@copilot please address this.

registry := NewEngineRegistry()
catalog := NewEngineCatalog(registry)

_, err := catalog.Resolve("totally-unknown-engine", 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] No test covers case-insensitive lookup. The production code calls strings.ToLower(id), but there is no test that passes e.g. "OpenCode" or "CRUSH" and asserts the tip still appears.

💡 Suggested test case to add to TestEngineCatalog_Resolve_KnownImportTip
{
    name:           "opencode case-insensitive",
    engineID:       "OpenCode",
    wantImportPath: "github/gh-aw/.github/workflows/shared/opencode.md@main",
},

Without this, a future change to the strings.ToLower call would break the feature silently.

@copilot please address this.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 75/100 — Acceptable

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

📊 Metrics (8 tests)
Metric Value
Analyzed 8 (Go: 8, JS: 0)
✅ Design 8 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 4 (50%)
Duplicate clusters 0
Inflation YES (test +63 lines vs prod +24 lines = 2.6:1)
🚨 Violations 0
Test File Classification Issues
TestNewEngineCatalog_BuiltIns engine_definition_test.go:15 design_test, high_value None
TestEngineCatalog_Resolve_LegacyStringFormat engine_definition_test.go:49 design_test, high_value None
TestEngineCatalog_Resolve_PrefixFallback engine_definition_test.go:71 design_test, high_value None
TestEngineCatalog_Resolve_UnknownEngine engine_definition_test.go:85 design_test, high_value None
TestEngineCatalog_Resolve_KnownImportTip engine_definition_test.go:104 design_test, high_value None
TestEngineCatalog_Resolve_UnknownNoTip engine_definition_test.go:154 design_test, high_value None
TestEngineCatalog_Resolve_ConfigPassthrough engine_definition_test.go:166 design_test, low_value None
TestEngineCatalog_Register_Custom engine_definition_test.go:178 design_test, high_value None

Verdict

passed. 0% implementation tests (threshold: 30%). Score penalized 10pts for test inflation (2.6:1 lines ratio); all tests are strong behavioral contracts.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 40.9 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: 75/100. 0% implementation tests (threshold: 30%).

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

Verdict: Approve with non-blocking suggestions

Small, well-tested addition (import-tip map + Resolve error enrichment). No correctness or security bugs found in the changed lines; flagged concerns are maintainability hardening, not blockers.

Themes
  • @main-pinned import suggestions in the tip message are a drift/reproducibility risk (low severity today since nothing auto-fetches them).
  • knownEngineImports is a second source of truth versus the actual files in .github/workflows/shared/*.md; nothing currently validates the two stay in sync.
  • No collision guard between knownEngineImports keys and future built-in engine IDs.
  • Test coverage for the five new entries and the negative (unknown-engine, no-tip) case is solid.

🔎 Code quality review by PR Code Quality Reviewer · auto · 40.7 AIC · ⊞ 7.8K
Comment /review to run again

Comment thread pkg/workflow/engine_definition.go Outdated
"crush": "github/gh-aw/.github/workflows/shared/crush.md@main",
"cursor": "github/gh-aw/.github/workflows/shared/cursor.md@main",
"aider": "github/gh-aw/.github/workflows/shared/aider.md@main",
"goose": "github/gh-aw/.github/workflows/shared/goose.md@main",

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.

Import tip pins engines to the mutable @main branch rather than a tagged release or SHA.

💡 Why this matters

All five suggested import paths (opencode, crush, cursor, aider, goose) use @main. Since main is a moving target, the shared definition file content a user imports today can differ from what they get next week if main is force-pushed, rebased, or the shared engine file changes shape. docs/reference/imports.md explicitly documents that refs can be a semantic tag, branch, or commit SHA — a pinned tag/SHA would give reproducible, auditable imports instead of drifting silently.

var knownEngineImports = map[string]string{
    "opencode": "github/gh-aw/.github/workflows/shared/opencode.md@v1.2.3", // or a pinned commit SHA
}

This is only a suggested fix in an error message today (nothing auto-fetches it), so the risk is low-severity now, but it normalizes an anti-pattern that could get copy-pasted into places that do auto-resolve imports.

Comment thread pkg/workflow/engine_definition.go Outdated
Runtime CodingAgentEngine // resolved adapter from the EngineRegistry
}

// knownEngineImports maps engine IDs that are not built into the binary to the

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.

knownEngineImports duplicates knowledge that already lives in .github/workflows/shared/*.md, and nothing keeps the two in sync.

💡 Why this matters

The map is a second source of truth for which engine IDs have a shared definition file and where it lives. If a shared file under .github/workflows/shared/ is ever renamed, moved, or deleted, this map will keep emitting a tip pointing at a broken import path, and none of the new tests (TestEngineCatalog_Resolve_KnownImportTip) would catch the drift because they only assert against the map's own values, not against the actual filesystem.

A cheap guard would be a test that globs .github/workflows/shared/*.md and asserts every knownEngineImports value resolves to an existing file (and optionally that every existing shared engine file has a corresponding map entry), so the two never silently diverge.

Comment thread pkg/workflow/engine_definition.go Outdated
//
// To add a new well-known engine, append an entry here with the engine ID as the
// key and the fully-qualified path to its shared engine definition file as the value.
var knownEngineImports = map[string]string{

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.

No safeguard stops a future built-in engine ID from colliding with an entry already present in knownEngineImports.

💡 Why this matters

Resolve only consults knownEngineImports after both the exact catalog lookup and the runtime-ID prefix fallback fail, so today there's no functional bug. But if a new built-in engine is ever added under one of these five names (e.g. a native cursor engine ships later), the map entry becomes stale dead code that nobody is prompted to remove, and — more importantly — there's no test or init-time check that would flag the naming collision to a reviewer. A simple init()-time assertion (or a unit test) that knownEngineImports keys don't overlap with registry.GetSupportedEngines() would catch this automatically instead of relying on someone remembering to grep the map.

Copilot AI and others added 2 commits August 7, 2026 14:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI and others added 4 commits August 7, 2026 14:51
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>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please address the latest maintainer feedback, refresh the branch if GitHub can update it cleanly, and run the pr-finisher skill before handing back to maintainers.

Open review items to address (newest first):

Branch refresh was requested.

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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 21.1 AIC · ⊞ 8.3K ·
Comment /souschef to run again

github-actions Bot and others added 2 commits August 7, 2026 15:04
@pelikhan

pelikhan commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Comment thread pkg/workflow/engine_definition.go Outdated
const (
knownEngineImportsOwner = "github"
knownEngineImportsRepo = "gh-aw"
knownEngineImportsPath = ".github/aw/engines.json"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot must be laoded from github through a raw user path

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

Copy link
Copy Markdown
Collaborator

@copilot Please address the remaining maintainer/review feedback, refresh the branch if GitHub can update it cleanly, and run the pr-finisher skill before handing back to maintainers.

Open items to address (newest first):

Branch refresh was requested.

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

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 8 AIC · ⊞ 8.4K ·
Comment /souschef to run again

Comment thread .github/aw/engines.json Outdated
"engines": [
{
"id": "aider",
"import": "github/gh-aw/.github/workflows/shared/aider.md@e3caca541fa7311d84947e25d3a7bfe4be3b431f"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot let the cli add the sha/release version that embedded in the cli.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan August 7, 2026 17:04
@pelikhan

pelikhan commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request . take claude golden from main

…er-agent-imports

# Conflicts:
#	pkg/workflow/testdata/TestWasmGolden_AllEngines/claude.golden

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

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request . take claude golden from main

Resolved in bf911d0 — merged origin/main and took pkg/workflow/testdata/TestWasmGolden_AllEngines/claude.golden from main.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@pelikhan
pelikhan merged commit 18e8ecb into main Aug 7, 2026
@pelikhan
pelikhan deleted the copilot/update-compiler-agent-imports branch August 7, 2026 18:18
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.

4 participants