Skip to content

Align Pi provider wiring with AWF spec and correct provider metadata for multi-provider engines#31758

Merged
pelikhan merged 8 commits into
mainfrom
copilot/review-pi-agentic-engine-integration
May 12, 2026
Merged

Align Pi provider wiring with AWF spec and correct provider metadata for multi-provider engines#31758
pelikhan merged 8 commits into
mainfrom
copilot/review-pi-agentic-engine-integration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Bug Fix

The Pi integration was not fully aligned with the AWF provider contract: provider setup lived mostly in execution-time wiring, while the Pi extension itself did not register providers from AWF-injected credentials. In parallel, provider metadata for provider-agnostic engines overstated engine-specific providers instead of reflecting the actual default GitHub-backed routing and supported secret variants.

  • What was the bug?

    • Pi extensions could not reliably see the workflow-configured provider/model context or register providers from the environment, which made provider selection less consistent with the AWF spec.
    • Pi-specific runtime requirements (github.mode: gh-proxy, cli-proxy: true) were documented but not enforced.
    • pi, opencode, and crush engine metadata advertised the wrong provider identity and incomplete alternative secret support.
  • How did you fix it?

    • Pi provider setup
      • Updated the Pi provider extension to register provider aliases directly from AWF-injected credentials:
        • github-copilot / copilot
        • anthropic
        • openai / codex
      • Added GH_AW_PI_MODEL so the original workflow engine.model is available to Pi extensions without changing Pi CLI model selection behavior.
    • Pi validation
      • Added compile-time validation for Pi workflows so they require:
        • tools.github.mode: gh-proxy
        • tools.cli-proxy: true
    • Engine metadata cleanup
      • Switched built-in metadata for pi, opencode, and crush to the default github provider, matching actual default routing behavior.
      • Expanded alternative secret metadata for these provider-agnostic engines to include Anthropic and OpenAI/Codex credentials.
    • Regression coverage
      • Added targeted JS coverage for Pi provider registration and model propagation.
      • Updated Go coverage for Pi validation, built-in engine metadata, and secret metadata expectations.
  • Example

    engine:
      id: pi
      model: anthropic/claude-sonnet-4
    
    tools:
      github:
        mode: gh-proxy
      cli-proxy: true

    With this change, gh-aw now exposes the configured model to the Pi extension and registers the matching provider from AWF-injected credentials before the agent starts.

Copilot AI and others added 4 commits May 12, 2026 17:40
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>
Copilot AI changed the title Fix Pi provider integration and multi-provider engine metadata Align Pi provider wiring with AWF spec and correct provider metadata for multi-provider engines May 12, 2026
Copilot AI requested a review from pelikhan May 12, 2026 17:50
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot update dev.md to use pi and github provider

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan added the dev label May 12, 2026
…ntic-engine-integration

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot merge main and recompile

Done in 98c1830. main is merged into this branch, make recompile completed cleanly, and the focused Go/JS validation passed after the merge.

@pelikhan pelikhan marked this pull request as ready for review May 12, 2026 18:38
Copilot AI review requested due to automatic review settings May 12, 2026 18:38
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot update dev.md to use pi and github provider

Done in d816c48. .github/workflows/dev.md now uses the Pi runtime with the GitHub provider, and dev.lock.yml was recompiled from it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 aligns the Pi engine/provider wiring with the AWF provider contract, improves compile-time validation for Pi workflows, and corrects built-in engine/provider metadata for provider-agnostic engines (Pi/OpenCode/Crush).

Changes:

  • Export GH_AW_PI_MODEL (original workflow model) for Pi extensions while continuing to pass the CLI model via --model.
  • Add compile-time validation enforcing Pi’s required tool configuration (tools.github.mode: gh-proxy, tools.cli-proxy: true).
  • Normalize metadata so pi, opencode, and crush default to the github provider and advertise Anthropic/OpenAI/Codex alternative secrets.
Show a summary per file
File Description
pkg/workflow/pi_engine.go Exports GH_AW_PI_MODEL for Pi extensions during execution.
pkg/workflow/pi_engine_test.go Updates coverage to assert GH_AW_PI_MODEL is present and PI_MODEL is not set.
pkg/workflow/engine_definition_test.go Adjusts built-in engine provider expectations for opencode, crush, pi.
pkg/workflow/engine_auth_test.go Updates built-in engine default secret expectations for opencode, crush, pi.
pkg/workflow/data/engines/pi.md Updates Pi engine metadata provider name to github.
pkg/workflow/data/engines/opencode.md Updates OpenCode engine metadata provider name to github.
pkg/workflow/data/engines/crush.md Updates Crush engine metadata provider name to github.
pkg/workflow/compiler_orchestrator_tools.go Hooks Pi-specific tool requirements validation into compilation.
pkg/workflow/agent_validation.go Adds validatePiEngineRequirements enforcing gh-proxy + cli-proxy.
pkg/workflow/agent_validation_model_test.go Adds tests for Pi tool requirements validation behavior.
pkg/constants/engine_constants.go Updates alternative secret metadata for multi-provider engines (incl. Pi).
pkg/constants/constants_test.go Adds regression coverage for multi-provider alternative secrets metadata.
actions/setup/js/pi_provider.cjs Registers providers/aliases from env and prefers GH_AW_PI_MODEL for extension context.
actions/setup/js/pi_provider.test.cjs Adds targeted JS tests for model precedence, provider registration, and logging.
.github/workflows/smoke-pi.lock.yml Updates locked workflow env to include GH_AW_PI_MODEL.
.github/workflows/dev.md Updates workflow frontmatter to inline runtime/provider structure.
.github/workflows/dev.lock.yml Regenerates lockfile to reflect updated model/env wiring.

Copilot's findings

Tip

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

  • Files reviewed: 17/17 changed files
  • Comments generated: 1

function registerConfiguredProviders(pi, logger) {
let registeredCount = 0;

const copilotToken = process.env.COPILOT_GITHUB_TOKEN || process.env.GITHUB_TOKEN;
@pelikhan pelikhan merged commit d202156 into main May 12, 2026
@pelikhan pelikhan deleted the copilot/review-pi-agentic-engine-integration branch May 12, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants