feat(agent-runtime): add secure plugin runtime and surreal-graphs onboarding#54
Conversation
📝 WalkthroughWalkthroughAdds 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
…ormance-plug-and-play-architecture
Deploying corvus with
|
| 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 |
✅ Contributor ReportUser: @yacosta738
Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-02-20 to 2026-02-20 |
|
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. |
|
✅ Created PR with unit tests: #55 |
…ormance-plug-and-play-architecture
There was a problem hiding this comment.
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 | 🟠 MajorSurreal-graphs selection never triggers SurrealDB config prompts.
setup_memoryonly 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.
…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
There was a problem hiding this comment.
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.
…ormance-plug-and-play-architecture
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.
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
PluginsConfig,PluginSourceConfig, andPluginRevocationConfigstructs 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].Configstruct 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
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
memory-surreal-graphs-plugin) with a minimal implementation and manifest (Cargo.toml,lib.rs), and defined thecorvus-plugin.witinterface for memory, health, and capabilities [1] [2] [3].4. Memory Backend Extension
surreal-graphsmemory backend in the configuration and backend validation logic [1] [2].5. Codebase Integration
pluginsmodule 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
Chores