Skip to content

feat(agent-runtime): add secure plugin runtime and surreal-graphs onboarding#54

Merged
yacosta738 merged 6 commits into
mainfrom
bart/feature/dallay-134-secure-and-high-performance-plug-and-play-architecture
Feb 20, 2026
Merged

feat(agent-runtime): add secure plugin runtime and surreal-graphs onboarding#54
yacosta738 merged 6 commits into
mainfrom
bart/feature/dallay-134-secure-and-high-performance-plug-and-play-architecture

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

@yacosta738 yacosta738 commented Feb 20, 2026

This pull request introduces a secure, configurable runtime plugin system to the agent, along with an initial WASM plugin artifact and supporting infrastructure. The main changes include new configuration schema and environment variable support for plugins, a GitHub Actions workflow for building and publishing plugins, and the addition of a pilot plugin and interface definition.

Key changes:

1. Plugin System and Configuration

  • Added PluginsConfig, PluginSourceConfig, and PluginRevocationConfig structs to the agent's configuration schema (schema.rs), enabling secure plugin discovery, installation, and revocation policies with sensible defaults (e.g., allowlist, enforced revocation, official catalog) [1] [2].
  • Extended environment variable support for plugin settings: enabling/disabling plugins, customizing allowed publishers, specifying plugin sources, and revocation controls.
  • Updated the main Config struct and its default/parse logic to include plugins, and added comprehensive tests to ensure secure defaults and correct parsing [1] [2] [3] [4] [5].

2. Plugin Build and Publishing Workflow

  • Added a new GitHub Actions workflow (publish-plugins.yml) to build, bundle, optionally sign, and publish WASM plugin artifacts to OCI registries, including manifest and revocation metadata.

3. WASM Plugin Artifact and Interface

  • Introduced a pilot WASM plugin (memory-surreal-graphs-plugin) with a minimal implementation and manifest (Cargo.toml, lib.rs), and defined the corvus-plugin.wit interface for memory, health, and capabilities [1] [2] [3].

4. Memory Backend Extension

  • Added support for the new surreal-graphs memory backend in the configuration and backend validation logic [1] [2].

5. Codebase Integration

  • Registered the new plugins module in the agent runtime for further plugin system development.

These changes lay the foundation for a secure, extensible plugin system in the agent, with careful attention to configuration, security, and artifact management.

Summary by CodeRabbit

  • New Features

    • Added plugin-based memory backend system with selectable backends.
    • Introduced surreal-graphs as a memory backend option with automatic installation during onboarding and graceful fallback to the core markdown backend.
    • Config now includes plugins settings and onboarding reflects the new memory backend naming.
  • Chores

    • Added CI workflow to build, package, sign, and publish plugin bundles.

@linear
Copy link
Copy Markdown

linear Bot commented Feb 20, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

Adds plugin infrastructure and a publishing workflow, introduces a WIT plugin contract and a minimal memory.surreal.graphs WASM plugin, refactors runtime plugin/memory backends into a modular factory, and updates onboarding to auto-install or fall back when surreal-graphs is selected.

Changes

Cohort / File(s) Summary
CI: Plugin publishing workflow
.github/workflows/publish-plugins.yml
New GitHub Actions workflow to build WASM, generate plugin manifests (plugin-manifest.json, catalog.json, revocations.json), optionally cosign-sign, push artifacts to OCI via ORAS, and upload artifacts.
WASM plugin package
clients/agent-runtime/plugins/memory-surreal-graphs/Cargo.toml, clients/agent-runtime/plugins/memory-surreal-graphs/src/lib.rs
Adds memory.surreal.graphs plugin crate with release optimizations and a minimal C-ABI run() entrypoint stub for WASM artifact.
WIT plugin contract
clients/agent-runtime/plugins/wit/corvus-plugin.wit
New WIT world corvus-plugin defining memory (memory-entry record, store/recall/get/list/forget/count), health (health-check), and capabilities interfaces.
Runtime plugin system refactor
clients/agent-runtime/src/plugins/mod.rs
Major refactor: introduces modular backend packages (backend, chunker, embeddings, lucid, markdown, none, plugin, response_cache, snapshot, sqlite, surreal (feature-gated), traits, vector), re-exports backends/traits, and adds factory functions create_memory, create_memory_for_migration, and create_response_cache with selection/fallback logic.
Onboarding & public API
clients/agent-runtime/src/onboard/wizard.rs, clients/agent-runtime/src/lib.rs
Adds pub mod plugins;, introduces plugins: PluginsConfig on Config, updates wizard/quick-setup to attempt plugin install for surreal-graphs with fallback to markdown, renames/normalizes backend key to surreal-graphs, and updates tests and helper requires_surreal_memory_setup.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant Wizard as Wizard
    participant Config as Config
    participant PluginMgr as Plugin Manager
    participant Registry as OCI/Registry
    participant Backend as Memory Backend
    participant Fallback as Markdown Backend

    User->>Wizard: choose "surreal-graphs" backend
    Wizard->>Config: create default Config (includes plugins)
    Wizard->>PluginMgr: request install of memory.surreal.graphs
    PluginMgr->>Registry: fetch catalog/manifest (OCI) & artifact
    Registry-->>PluginMgr: return artifact + signatures
    PluginMgr->>PluginMgr: verify signature, digest, revocations
    alt verification succeeds
        PluginMgr->>PluginMgr: install/register plugin
        PluginMgr->>Config: record installed plugin
        Wizard->>Backend: create PluginBackedMemory (surreal-graphs)
        Backend-->>Wizard: initialized
    else verification fails
        PluginMgr->>Wizard: report failure
        Wizard->>Config: set backend -> markdown (fallback)
        Wizard->>Fallback: create MarkdownMemory
        Fallback-->>Wizard: fallback initialized
    end
    Wizard-->>User: onboarding complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(agent-runtime): add secure plugin runtime and surreal-graphs onboarding' clearly and specifically describes the main changes—a plugin system and surreal-graphs onboarding—matching the substantial additions to configuration, workflows, plugin artifacts, and wizard integration.
Description check ✅ Passed The PR description comprehensively covers all key changes: plugin configuration schema, GitHub Actions workflow, WASM plugin artifacts, interface definitions, and memory backend extension, with clear motivation and implementation details aligned to the template requirements.
Linked Issues check ✅ Passed The PR successfully implements Phase 0–2 objectives from DALLAY-134: configuration schema with secure defaults, plugin manager module, artifact/revocation foundations, wizard integration for surreal-graphs, and publishable plugin artifacts with WIT interface.
Out of Scope Changes check ✅ Passed All changes are directly aligned with DALLAY-134 scope: plugin configuration, build workflow, WASM artifacts, interface definitions, memory backend support, and wizard onboarding integration—no unrelated refactoring or scope creep detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bart/feature/dallay-134-secure-and-high-performance-plug-and-play-architecture

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 20, 2026

Deploying corvus with  Cloudflare Pages  Cloudflare Pages

Latest commit: d466688
Status: ✅  Deploy successful!
Preview URL: https://2d549e7f.corvus-42x.pages.dev
Branch Preview URL: https://bart-feature-dallay-134-secu.corvus-42x.pages.dev

View logs

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 20, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 89% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 9 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3037 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 364 >= 0
Merger Diversity Unique maintainers who merged PRs 3 >= 0
Repo History Merge Rate Merge rate in this repo 89% >= 0%
Repo History Min PRs Previous PRs in this repo 37 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-02-20 to 2026-02-20

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 20, 2026

Note

Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 20, 2026

✅ Created PR with unit tests: #55

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
clients/agent-runtime/src/onboard/wizard.rs (1)

2743-2748: ⚠️ Potential issue | 🟠 Major

Surreal-graphs selection never triggers SurrealDB config prompts.

setup_memory only branches on "surreal", so choosing "surreal-graphs" skips the SurrealDB configuration flow. If the plugin still needs SurrealDB connection details, this leaves users on defaults without prompting.

🛠️ Suggested fix
-    if backend == "surreal" {
+    if backend == "surreal" || backend == "surreal-graphs" {
         setup_surreal_memory_options(&mut config)?;
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clients/agent-runtime/src/onboard/wizard.rs` around lines 2743 - 2748, The
branch that triggers SurrealDB prompts only matches backend == "surreal", so
selecting "surreal-graphs" skips setup_surreal_memory_options and leaves
defaults; update the conditional around memory_config_defaults_for_backend /
setup_surreal_memory_options to also include "surreal-graphs" (e.g., backend ==
"surreal" || backend == "surreal-graphs", or match on a prefix) so
setup_surreal_memory_options(&mut config)? is called for both identifiers and
users are prompted for SurrealDB details.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/publish-plugins.yml:
- Around line 122-158: Pin the cosign download to a specific release (don’t use
"latest") and add checksum verification steps for both the cosign and oras
binaries before making them executable or running them: fetch a fixed cosign
release (replace the current cosign download URL used before the ./cosign
sign-blob call), download the corresponding checksums (and/or signature) from
the release, verify the downloaded cosign binary checksum/signature, and only
then chmod +x and run ./cosign; do the same for the oras tarball already pinned
to v1.2.3 (verify its checksum/signature after downloading
oras_1.2.3_linux_amd64.tar.gz and before extracting/using oras). Ensure the
verification failures cause the step to exit non-zero so the publish/sign steps
(the cosign sign-blob invocation and the ./oras push invocation) only run after
successful verification.

In `@clients/agent-runtime/src/onboard/wizard.rs`:
- Around line 5188-5192: The PR is missing confirmation that required Rust
validation steps were executed for clients/agent-runtime/src/onboard/wizard.rs;
run and commit results (or document intentional skips) for `cargo fmt --all --
--check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test`, and
update the PR description or add a short note in the file/commit explaining
which checks were run and any that were intentionally skipped with reasons;
reference this file and the test function containing `backend_key_from_choice`
to ensure formatting, lints, and tests pass before merging.

---

Outside diff comments:
In `@clients/agent-runtime/src/onboard/wizard.rs`:
- Around line 2743-2748: The branch that triggers SurrealDB prompts only matches
backend == "surreal", so selecting "surreal-graphs" skips
setup_surreal_memory_options and leaves defaults; update the conditional around
memory_config_defaults_for_backend / setup_surreal_memory_options to also
include "surreal-graphs" (e.g., backend == "surreal" || backend ==
"surreal-graphs", or match on a prefix) so setup_surreal_memory_options(&mut
config)? is called for both identifiers and users are prompted for SurrealDB
details.

Comment thread .github/workflows/publish-plugins.yml
Comment thread clients/agent-runtime/src/onboard/wizard.rs
…setup

Addressed review findings by pinning cosign release download and enforcing checksum verification for both cosign and oras before execution in publish-plugins workflow.

Updated wizard memory setup to trigger SurrealDB prompts for both surreal and surreal-graphs backends, with a dedicated unit test for backend gating.

Validation executed in clients/agent-runtime:

- cargo fmt --all -- --check (fails due pre-existing formatting diffs outside this change)

- cargo clippy --all-targets -- -D warnings (fails due pre-existing lint errors outside this change)

- cargo test (fails due pre-existing test failures outside this change)

Targeted verification passed:

- cargo test backend_key_from_choice_maps_supported_backends

- cargo test requires_surreal_memory_setup_accepts_plugin_backend
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
clients/agent-runtime/src/onboard/wizard.rs (1)

750-752: Minor UX consideration: surreal setup runs before plugin install.

If the user selects "surreal-graphs", they go through the full SurrealDB credentials/Docker wizard here, but the plugin install at lines 146-178 could subsequently fail and discard this configuration by falling back to markdown. Consider either (a) moving the plugin install check before setup_surreal_memory_options, or (b) warning the user upfront that the surreal-graphs backend requires a runtime plugin.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clients/agent-runtime/src/onboard/wizard.rs` around lines 750 - 752, The
wizard currently runs setup_surreal_memory_options before verifying/installing
the surreal-graphs runtime plugin, causing work to be discarded if plugin
installation later fails; either move the plugin installation/check (the code
that ensures the surreal-graphs plugin is present) to run before calling
setup_surreal_memory_options so the user only proceeds when the plugin is
available, or add an upfront warning in the onboarding flow (before calling
setup_surreal_memory_options) that selecting "surreal-graphs" requires a runtime
plugin and will attempt installation — implement the change by relocating the
plugin check/installer invocation to precede setup_surreal_memory_options (or by
inserting a clear warning prompt tied to the surreal-graphs selection) and
ensure any failure path cleanly aborts the surreal setup instead of continuing
to markdown fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/agent-runtime/src/onboard/wizard.rs`:
- Around line 146-178: Define and export the missing function
crate::plugins::install_official_surreal_graphs(&Config) that performs the
Surreal Graphs plugin installation and returns a Result<Plugin, Error> so the
existing calls compile; then remove the duplicated inline install-and-fallback
blocks (the match that logs success or on Err logs the warning and sets
config.memory = memory_config_defaults_for_backend("markdown")) and extract that
logic into a single shared helper (e.g.,
plugins::ensure_surreal_graphs_installed or
plugins::install_and_handle_surreal_graphs) which calls
install_official_surreal_graphs, handles logging and the fallback to
memory_config_defaults_for_backend("markdown"), and is invoked from both places
that currently call install_official_surreal_graphs(&config).

---

Nitpick comments:
In `@clients/agent-runtime/src/onboard/wizard.rs`:
- Around line 750-752: The wizard currently runs setup_surreal_memory_options
before verifying/installing the surreal-graphs runtime plugin, causing work to
be discarded if plugin installation later fails; either move the plugin
installation/check (the code that ensures the surreal-graphs plugin is present)
to run before calling setup_surreal_memory_options so the user only proceeds
when the plugin is available, or add an upfront warning in the onboarding flow
(before calling setup_surreal_memory_options) that selecting "surreal-graphs"
requires a runtime plugin and will attempt installation — implement the change
by relocating the plugin check/installer invocation to precede
setup_surreal_memory_options (or by inserting a clear warning prompt tied to the
surreal-graphs selection) and ensure any failure path cleanly aborts the surreal
setup instead of continuing to markdown fallback.

Comment thread clients/agent-runtime/src/onboard/wizard.rs
Restore plugins module API for official surreal-graphs installation and reuse a shared wizard helper for install+fallback handling.

Move surreal-graphs plugin verification/install ahead of surreal setup prompts to avoid discarded user input when plugin install fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant