Skip to content

[CF-DATAPLANE] Support dynamic Rust CPEX plugins in CF Dataplane #4918

@lucarlig

Description

@lucarlig

The CF Dataplane currently integrates with native Rust CPEX through contextforge-gateway-rs-cpex, but plugin factories are registered statically in-process. We should extend the dataplane integration to support dynamic Rust plugin loading once contextforge-org/cpex#53 is merged/released.

Work needed:

  1. Enable CF Dataplane to load Rust CPEX plugins from shared libraries at runtime.
  2. Support dynamic plugin configuration through the existing runtime config path.
  3. Preserve existing plugin reload behavior when configuration changes.
  4. Keep the first implementation focused on the current MCP tool hooks.
  5. Add regression coverage for successful dynamic plugin execution and failure cases such as bad paths, bad entries, or ABI mismatch.
  6. Document the operational constraints for dynamic plugins, including same-version ABI requirements and in-process execution.

Current code points:

  • crates/contextforge-gateway-rs-cpex/src/handle.rs owns CpexRuntimeRegistry and PluginFactoryRegistry.
  • crates/contextforge-gateway-rs-cpex/src/runtime.rs builds GatewayPluginRuntime from CpexConfig and validates the supported CPEX subset.
  • crates/contextforge-gateway-rs-cpex/src/config.rs loads runtime CPEX config from Redis key ContextForgeGatewayRuntimePluginConfig.
  • crates/contextforge-gateway-rs-cpex/src/factory.rs only covers statically registered CMF plugin factories today.

This extends #4525 from native Rust CPEX integration to runtime-loadable Rust CPEX plugins.

Metadata

Metadata

Assignees

No one assigned

    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