Skip to content

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

Open
pelikhan with Copilot wants to merge 31 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 31 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


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


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


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


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


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


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


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


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


Generated by 👨‍🍳 PR Sous Chef · 10.4 AIC · ⌖ 4.23 AIC · ⊞ 7.1K ·
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.

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, address unresolved review comments, refresh the branch if needed, and rerun checks once ready.
Unresolved review threads:

All four threads were addressed in prior commits — the code fixes are confirmed still in place:

  • r3551263720buildFirewallCommand passes workflowData to ComputeAWFExcludeEnvVarNames (line 424 of behavior_defined_engine.go). ✅
  • r3551263753GetSecretValidationStep passes workflowData to GetRequiredSecretNames (line 150). ✅
  • r3551263780 — MCP config env var is set even without a config-file block, falling back to McpServersJsonPathExpr or behavior.MCP.ConfigPath (lines 342–344, 401–404). ✅ (Thread is is_outdated: true on GitHub.)
  • r3551263802mkdir -p "$(dirname "$GITHUB_WORKSPACE/...")" is used for the json-merge path (line 443). ✅

Branch is up to date with main, working tree clean, lock files in sync. These threads remain visually unresolved on GitHub because the GraphQL mutation to dismiss them returns 403 from the agent context — a maintainer needs to dismiss them manually.

  • ✅ Reviews — All fixes in place; threads need maintainer dismissal on GitHub.
  • ✅ Checks (local) — make check-stale-lock-files passes. Working tree clean.
  • ❓ Checks (CI) — Needs human re-trigger after maintainer approval.
  • ✅ Mergeable — Up to date with main, no conflicts.

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-crush

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

⚠️ Smoke Crush failed. Crush encountered unexpected challenges...

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-opencode

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

⚠️ Smoke OpenCode failed. OpenCode encountered unexpected challenges...

@pelikhan

Copy link
Copy Markdown
Collaborator

Copilot AI and others added 2 commits July 10, 2026 15:25
…uild.permission)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ues for v1.2.14

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

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot investigate https://github.com/github/gh-aw/actions/runs/29102495368/job/86394843308#step:28:1 and fix OpenCode support

Fixed in commit Fix OpenCode config format: use agent.build.permission with allow values for v1.2.14.

Root cause: OpenCode v1.2.14's config schema rejects a top-level "permissions" key with an unrecognized_keys error. The opencode.md engine definition was writing:

{ "permissions": { "bash": true, "edit": true, ... } }

Fix: Updated to the correct nested format that v1.2.14 accepts:

{
  "agent": {
    "build": {
      "permission": {
        "bash": "allow",
        "edit": "allow",
        "read": "allow",
        "glob": "allow",
        "grep": "allow",
        "webfetch": "allow",
        "websearch": "allow",
        "external_directory": "allow"
      }
    }
  }
}

smoke-opencode.lock.yml recompiled. OpenCode tests pass. CI re-trigger needed to confirm.

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-opencode

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke OpenCode MISSION COMPLETE! OpenCode delivered. 🔥

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot investigate why OpenCode did not inference and fix it

https://github.com/github/gh-aw/actions/runs/29104424434/job/86401490785

OpenCode CLI v1.2.14 contacts opencode.ai (telemetry/version checks) and
models.dev (model capability discovery) before starting inference. Both
domains were blocked by the AWF firewall, preventing OpenCode from
performing any LLM calls.

Add both domains to OpenCodeBaseDefaultDomains and OpenCodeDefaultDomains
in domains.go, then recompile all workflow lock files so the new entries
appear in both GH_AW_ALLOWED_DOMAINS and the AWF firewall allowDomains JSON
blob in smoke-opencode.lock.yml (and any other OpenCode-engine workflows).

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

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot investigate why OpenCode did not inference and fix it

https://github.com/github/gh-aw/actions/runs/29104424434/job/86401490785

Fixed in the latest commit. The firewall logs from run 29104424434 showed opencode.ai | 0 | 2 (blocked) and models.dev | 0 | 1 (blocked). OpenCode CLI v1.2.14 contacts both domains for model capability discovery before starting inference — the blocks prevented any LLM calls from being made (confirmed by "No token usage data found" in the run summary).

Added opencode.ai and models.dev to OpenCodeBaseDefaultDomains and OpenCodeDefaultDomains in domains.go. Both domains now appear in the AWF firewall allowDomains and GH_AW_ALLOWED_DOMAINS after recompiling all 256 lock files.

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-opencode

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke OpenCode MISSION COMPLETE! OpenCode delivered. 🔥

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

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

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

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot investigate why OpenCode failed

@pelikhan

Copy link
Copy Markdown
Collaborator

See @copilot https://github.com/github/gh-aw/actions/runs/29106051746/job/86406899073#step:28: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.

4 participants