Skip to content

Add declarative custom-engine frontmatter and migrate Crush/OpenCode to shared behavior definitions#44465

Open
pelikhan with Copilot wants to merge 14 commits into
mainfrom
copilot/define-agentic-engine-syntax
Open

Add declarative custom-engine frontmatter and migrate Crush/OpenCode to shared behavior definitions#44465
pelikhan with Copilot wants to merge 14 commits into
mainfrom
copilot/define-agentic-engine-syntax

Conversation

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This introduces a richer engine-definition frontmatter shape for shared/custom agentic engines and uses it to move Crush and OpenCode off bespoke Go implementations onto a common declarative runtime path. The new syntax is expressive enough for CLI-style engines that need install, config, execution, MCP, capability, and auth wiring, including Auggie-like cases.

  • New engine-definition surface

    • Adds engine.experimental, engine.auth, and engine.behaviors to the named engine definition form.
    • behaviors captures the runtime contract instead of hard-coding it in Go:
      • capabilities
      • manifest files/path prefixes
      • installation metadata
      • config file generation
      • execution command/args/env
      • MCP config target
    • auth provides explicit secret bindings for engines that need engine-specific credentials forwarded into the runtime.
  • Shared behavior-defined runtime

    • Adds a generic BehaviorDefinedEngine that materializes a CodingAgentEngine from frontmatter.
    • Reuses the existing universal provider/model routing where applicable, but also supports engine-specific secret/env bindings for nonstandard CLIs.
    • Registers imported named engine definitions during compilation so shared workflows can define engines declaratively instead of requiring Go registration.
  • Crush/OpenCode refactor

    • Replaces the bespoke Crush/OpenCode runtime logic with thin wrappers over builtin engine definitions.
    • Moves engine-specific behavior into:
      • pkg/workflow/data/engines/crush.md
      • pkg/workflow/data/engines/opencode.md
    • Keeps their existing runtime identity while making their install/config/execute behavior data-driven.
  • Schema and docs

    • Extends the workflow schema and frontmatter reference docs to describe the new engine-definition fields.
    • Documents the custom-engine shape with behavior blocks and auth bindings so new engines can be added without copy-pasting a dedicated Go implementation.
  • Coverage

    • Adds/updates tests for:
      • schema shape
      • builtin engine definitions
      • imported behavior-defined engines
      • Crush/OpenCode parity through the shared path
    • Includes an imported Auggie-style engine example to exercise explicit auth binding and declarative execution.

Example of the new shared engine definition shape:

engine:
  id: auggie
  display-name: Auggie
  experimental: true
  auth:
    - role: session
      secret: AUGMENT_SESSION_AUTH
  behaviors:
    supported-env-var-keys:
      - AUGMENT_SESSION_AUTH
    installation:
      package-manager: npm
      package-name: "@augmentcode/auggie"
      version: "1.0.0"
      step-name: Install Auggie
      binary-name: auggie
      include-node-setup: true
    config-file:
      path: .auggie.json
      step-name: Write Auggie Config
      content: '{"sandbox":"workspace-write"}'
      merge-strategy: json-merge
    execution:
      command-name: auggie
      args: [run]
      step-name: Execute Auggie CLI
      model-env-var: AUGGIE_MODEL
      mcp-config-env-var: AUGGIE_MCP_CONFIG
      write-timestamp: true

Generated by 👨‍🍳 PR Sous Chef · 10.4 AIC · ⌖ 5.15 AIC · ⊞ 7.1K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · 16.6 AIC · ⌖ 7.21 AIC · ⊞ 4.7K ·
Comment /souschef to run again

Copilot AI and others added 3 commits July 9, 2026 03:49
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>
Copilot AI changed the title Add declarative frontmatter syntax for custom agentic engines Add declarative custom-engine frontmatter and migrate Crush/OpenCode to shared behavior definitions Jul 9, 2026
Copilot AI requested a review from pelikhan July 9, 2026 04:18
@pelikhan

pelikhan commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot remove crush/opencode from Go code and only keep them as shared agentic workflow files.

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

pelikhan commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot create a new instruction file to help with configuring new agentic engines

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

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot remove crush/opencode from Go code and only keep them as shared agentic workflow files.

Addressed in 5537932.

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

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot create a new instruction file to help with configuring new agentic engines

Addressed in ab02806.

@pelikhan

pelikhan commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile
Run pr-finisher skill

Copilot AI and others added 3 commits July 9, 2026 05:20
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…c-engine-syntax

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

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and recompile
Run pr-finisher skill

Addressed in 1610bec.

@pelikhan pelikhan marked this pull request as ready for review July 9, 2026 11:27
Copilot AI review requested due to automatic review settings July 9, 2026 11:27

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

This PR expands the workflow frontmatter engine-definition format to support declarative, behavior-driven engines (including experimental flags, auth bindings, and runtime behavior blocks), and migrates the Crush and OpenCode engines off bespoke Go implementations onto this shared declarative runtime path.

Changes:

  • Introduces BehaviorDefinedEngine to materialize CodingAgentEngine runtimes from engine.behaviors, including installation/config/execution/MCP wiring and optional auth secret bindings.
  • Moves Crush/OpenCode engine behavior into embedded markdown definitions (pkg/workflow/data/engines/*.md) and updates engine registration + tests accordingly.
  • Extends the workflow JSON schema and docs to document engine.experimental, engine.auth, and engine.behaviors, and adds an internal guide for configuring declarative engines.
Show a summary per file
File Description
pkg/workflow/opencode_mcp.go Removes OpenCode-specific MCP renderer (superseded by behavior-defined path).
pkg/workflow/opencode_engine.go Removes bespoke OpenCode engine implementation (superseded by behavior-defined path).
pkg/workflow/opencode_engine_test.go Updates OpenCode tests to use builtin behavior-defined engine loader.
pkg/workflow/engine_includes_test.go Adds coverage for importing behavior-defined engine definitions from shared workflows.
pkg/workflow/engine_definition.go Extends engine definition structs to include experimental/auth/behaviors blocks.
pkg/workflow/engine_definition_loader.go Adds cached lookup for embedded builtin engine definitions.
pkg/workflow/engine_definition_loader_test.go Asserts Crush/OpenCode definitions are experimental and have behaviors.
pkg/workflow/engine_catalog_test.go Ensures schema surface includes experimental/auth/behaviors properties.
pkg/workflow/data/engines/opencode.md Defines OpenCode runtime behavior declaratively (install/config/exec/MCP).
pkg/workflow/data/engines/crush.md Defines Crush runtime behavior declaratively (install/config/exec/MCP).
pkg/workflow/crush_mcp.go Removes Crush-specific MCP renderer (superseded by behavior-defined path).
pkg/workflow/crush_engine.go Removes bespoke Crush engine implementation (superseded by behavior-defined path).
pkg/workflow/crush_engine_test.go Updates Crush tests to use builtin behavior-defined engine loader.
pkg/workflow/compiler_orchestrator_engine.go Registers named engine definitions found in includes/imports during compilation.
pkg/workflow/behavior_defined_engine.go Adds the shared declarative engine runtime implementation.
pkg/workflow/agentic_engine.go Registers Crush/OpenCode via builtin behavior-defined engines.
pkg/workflow/agent_validation_model_test.go Updates model-validation tests to use behavior-defined Crush/OpenCode engines.
pkg/parser/schemas/main_workflow_schema.json Extends schema for engine definition format with experimental/auth/behaviors.
pkg/cli/data/agentic_workflows_skill.md Adds pointer to the new declarative-engine configuration guide.
pkg/cli/data/agentic_workflows_fallback_aw_files.json Adds the new guide to fallback AW file list.
docs/src/content/docs/reference/frontmatter-full.md Documents the new engine definition fields and behaviors block.
.github/workflows/test-workflow.lock.yml Adds generated lock workflow for test workflow.
.github/workflows/test-dispatcher.lock.yml Adds generated lock workflow for dispatcher workflow.
.github/workflows/smoke-opencode.lock.yml Updates compiled smoke workflow to reflect declarative OpenCode behavior.
.github/workflows/smoke-crush.lock.yml Updates compiled smoke workflow to reflect declarative Crush behavior.
.github/skills/agentic-workflows/SKILL.md Adds reference to the new declarative-engine configuration guide.
.github/aw/github-agentic-workflows.md Links the new declarative engine configuration guide in the index.
.github/aw/configure-agentic-engine.md Adds a new guide for adding/updating declarative engine definitions.

Review details

Tip

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

  • Files reviewed: 27/30 changed files
  • Comments generated: 4
  • Review effort level: Low

Comment thread pkg/workflow/behavior_defined_engine.go
Comment thread pkg/workflow/behavior_defined_engine.go
Comment on lines +271 to +275
if exec.MCPConfigEnvVar != "" && HasMCPServers(workflowData) {
if behavior.ConfigFile != nil {
env[exec.MCPConfigEnvVar] = "${{ github.workspace }}/" + behavior.ConfigFile.Path
}
}

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.

Fixed in the previous commit. The env var is now set even when there's no config-file block — it falls back to constants.McpServersJsonPathExpr, or to behavior.MCP.ConfigPath if a behaviors.mcp.config-path is present.

Comment thread pkg/workflow/behavior_defined_engine.go Outdated
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review feedback, and rerun checks once the branch update settles.

Unresolved review feedback to address first:

  • copilot-pull-request-reviewer review feedback remains open.

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

Generated by 👨‍🍳 PR Sous Chef · 10.4 AIC · ⌖ 5.15 AIC · ⊞ 7.1K ·
Comment /souschef to run again

Copilot AI and others added 2 commits July 9, 2026 12:55
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
- GetSecretValidationStep: pass actual workflowData instead of empty WorkflowData{} so MCP/GitHub-tool secrets are included in validation
- buildFirewallCommand: pass actual workflowData to ComputeAWFExcludeEnvVarNames so provider API-key env vars are correctly excluded
- MCP config env var: also set env var when engine has mcp.config-path but no config-file block
- buildConfigFileStep json-merge: use dirname() to create parent directories for nested config paths

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

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address unresolved review feedback, and rerun checks once the branch update settles.

Unresolved review feedback to address first:...

Addressed all four open review threads from @copilot-pull-request-reviewer in the latest commit:

  • GetSecretValidationStep (line 150): Now passes actual workflowData to GetRequiredSecretNames instead of an empty WorkflowData{}, so MCP/GitHub-tool secrets are included in the validation step.
  • buildFirewallCommand (line 345): Now passes actual workflowData to ComputeAWFExcludeEnvVarNames, so provider API-key env vars (Anthropic, OpenAI, etc.) are correctly excluded from the firewall --env-all passthrough.
  • MCP config env var (lines 271–275): Env var is now also set when an engine has behaviors.mcp.config-path but no behaviors.config-file block, falling back to constants.McpServersJsonPathExpr as the default.
  • buildConfigFileStep json-merge mkdir (lines 363–373): Changed mkdir -p "$GITHUB_WORKSPACE" to mkdir -p "$(dirname "$GITHUB_WORKSPACE/%s")" so parent directories are created for nested config paths like .engine/config.json.

All unit tests pass locally.

Copilot AI requested a review from gh-aw-bot July 9, 2026 13:11
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🤖 PR Triage — Run §29020837798

Field Value
Category feature
Risk 🔴 High
Score 50 / 100
Action ⏸️ defer

Score breakdown: Impact 35 + Urgency 8 + Quality 7

Rationale: Very large diff (7 474 +/ 394 −) introducing a new declarative engine frontmatter system and migrating Crush/OpenCode. High architectural impact warrants careful design review before merging. No urgency signal. Recommend review as a standalone design session, not batch. Defer until scoped down or design reviewed.

Generated by 🔧 PR Triage Agent · 77.6 AIC · ⌖ 14.7 AIC · ⊞ 5.4K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address the unresolved review feedback below, and rerun checks once the branch is up to date.

Unresolved review feedback:...

All four review threads have been addressed:

  • r3551263720 (AWF exclude env): ✅ Resolved — buildFirewallCommand now passes actual workflowData to ComputeAWFExcludeEnvVarNames.
  • r3551263753 (GetSecretValidationStep): ✅ Resolved — now passes actual workflowData to GetRequiredSecretNames.
  • r3551263780 (MCP config env var): ✅ Fixed — env var is now set even without a config-file block, falling back to McpServersJsonPathExpr or behavior.MCP.ConfigPath. Replied to the outdated thread.
  • r3551263802 (mkdir json-merge): ✅ Resolved — now uses dirname() to create parent directories for nested config paths.

All unit tests pass locally.

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

Copy link
Copy Markdown
Collaborator

Copilot AI and others added 2 commits July 9, 2026 15:10
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

pr-sous-chef
@copilot please address these unresolved review threads first:

All four review threads have been addressed and the branch is now up to date with main:

  • r3551263720 (AWF exclude env) — ✅ Resolved. buildFirewallCommand passes actual workflowData to ComputeAWFExcludeEnvVarNames.
  • r3551263753 (GetSecretValidationStep) — ✅ Resolved. Now passes actual workflowData to GetRequiredSecretNames.
  • r3551263780 (MCP config env var) — ✅ Fixed (thread is outdated). Env var is set even without a config-file block, falling back to McpServersJsonPathExpr or behavior.MCP.ConfigPath. See commit a1011e8.
  • r3551263802 (mkdir json-merge) — ✅ Resolved. Uses dirname() for parent directory creation in json-merge path.

Branch has been merged with main (resolving the smoke-crush/smoke-opencode .lock.yml conflicts from the firewall 0.27.27 → 0.27.28 bump), then recompiled (260/260). Local validation: make fmt, make lint, make test-unit, make recompile, and make agent-report-progress all pass.

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.

4 participants