Skip to content

Provider preflight should check AI Client default registry #927

@chubes4

Description

@chubes4

WP Codebox sandbox provider preflight currently checks a fresh ProviderRegistry instance, so it misses providers registered by activated plugins through AiClient::defaultRegistry().

Evidence

Conductor proof retry12 ran through Homeboy Lab/Codebox with the generic provider stack shape after Extra-Chill/homeboy-extensions#1320 and WP Codebox #924:

  • Lab WP Codebox checkout: 3094847
  • Homeboy WordPress extension: 2.121.13
  • Run id: conductor-full-loop-proof-retry12-20260613
  • Artifact directory: /home/chubes/Developer/.tmp/homeboy-wp-codebox-artifacts-SUO3oc
  • Command evidence: /home/chubes/Developer/.tmp/homeboy-wp-codebox-artifacts-SUO3oc/wp-codebox-command-evidence.json
  • Redacted input: /home/chubes/Developer/.tmp/homeboy-wp-codebox-artifacts-SUO3oc/wp-codebox-agent-task-input.redacted.json

The input was generic and correct:

{
  "provider": "codex",
  "model": "gpt-5.5",
  "provider_plugin_paths": [
    "/home/chubes/Developer/ai-provider-for-openai-codex-oauth-provider"
  ],
  "runtime_overlays": [
    {
      "kind": "bundled-library",
      "library": "php-ai-client",
      "source": "/home/chubes/Developer/php-ai-client@custom-provider-auth",
      "target": "/wordpress/wp-includes/php-ai-client",
      "strategy": "wordpress-scoped-bundle"
    }
  ]
}

The runtime mounted and activated the provider plugin:

{
  "pluginFile": "ai-provider-for-openai/plugin.php",
  "slug": "ai-provider-for-openai",
  "target": "/wordpress/wp-content/plugins/ai-provider-for-openai",
  "loadAs": "plugin"
}

Activation evidence:

{
  "ai-provider-for-openai/plugin.php": {
    "active": true,
    "load_as": "plugin",
    "error": null
  }
}

The provider checkout registers Codex with the AI Client singleton:

$registry = AiClient::defaultRegistry();

if (!$registry->hasProvider(CodexProvider::class)) {
    $registry->registerProvider(CodexProvider::class);
}

But the generated WP Codebox preflight in commands.log checks a brand-new registry instance:

$provider_registry_class = \\WordPress\\AiClient\\Providers\\ProviderRegistry::class;
$registry = new $provider_registry_class();
if (method_exists($registry, 'isProviderConfigured') && $registry->isProviderConfigured($provider)) {
    return null;
}

That fresh registry cannot see plugin registrations made through AiClient::defaultRegistry(), so the run fails with:

Requested provider "codex" is not registered in wp-ai-client after sandbox provider plugins were loaded.

Expected

Provider preflight should check the same registry that plugins register against, likely WordPress\\AiClient\\AiClient::defaultRegistry() when available, instead of instantiating a fresh ProviderRegistry.

This should remain provider-agnostic: no Codex/OpenAI special cases. The preflight should validate any requested provider against the active AI Client registry used by loaded provider plugins.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions