[PR #283] feat(p2p): make Iroh backend optional #315

Open
opened 2026-10-29 14:22:07 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/283
Author: @CharlesXu-HQ
Created: 9/13/2026
Status: 🔄 Open

Base: main ← Head: feat/p2p-iroh-optional


📝 Commits (1)

  • f254c65 feat(p2p): make iroh backend optional

📊 Changes

9 files changed (+65 additions, -10 deletions)

View changed files

📝 .github/workflows/release.yml (+1 -1)
📝 Cargo.toml (+3 -2)
📝 Makefile (+3 -3)
📝 config/default.toml (+2 -1)
📝 deploy/docker/Dockerfile.agentenv (+2 -2)
📝 docs/src/configuration/reference.md (+1 -1)
📝 src/p2p/config.rs (+13 -0)
📝 src/p2p/error.rs (+1 -0)
📝 src/p2p/mod.rs (+39 -0)

📄 Description

What

Make the Iroh P2P backend optional behind a p2p-iroh Cargo feature. Default development and unit-test builds no longer compile iroh or iroh-blobs, while the release Makefile targets, Docker image, and release workflow continue to include Iroh support.

When P2P is enabled with transport = "iroh" in a binary built without the feature, startup now returns a clear error naming the required feature.

Why

Iroh brings a large transitive dependency graph into ordinary builds even when P2P is disabled. This implements the P2 dependency-isolation item in #8 without changing the capabilities of distributed release artifacts.

Part of #8 (P2)

Scope and non-goals

This PR includes Cargo feature wiring, compile-time gates around the Iroh implementation, a missing-feature error, release build flags, focused tests, and configuration documentation. It does not change the P2P configuration schema, transport behavior when Iroh is compiled in, or the default p2p.enabled = false setting.

Design and behavior changes

  • iroh and iroh-blobs are optional dependencies selected by p2p-iroh.
  • Iroh-only modules and resolved configuration fields are compiled only with that feature.
  • Disabled P2P continues to use DisabledP2pTransport in a no-feature build.
  • Selecting Iroh without p2p-iroh fails before backend initialization and reports the feature required to enable it.
  • Formal release paths explicitly enable p2p-iroh.

Compatibility and operations

  • Public API or generated protocol: N/A; no public API or generated protocol changes.
  • Configuration or defaults: Existing keys and defaults are unchanged. Custom builds that enable Iroh P2P must add --features p2p-iroh.
  • Snapshot manifest, artifact layout, or storage format: N/A; no format changes.
  • Upgrade and rollback: Packaged release builds retain Iroh support. Rolling back removes the build-time option and restores the unconditional dependency.
  • Host requirements, permissions, ports, or dependencies: Runtime requirements are unchanged for feature-enabled builds. Default development builds omit the Iroh dependency graph.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

Commands and results:

make fmt
  passed

make clippy
  passed on Linux with Rust 1.98.1

cargo tree --locked -p agentenv --no-default-features -e normal
  no iroh or iroh-blobs packages

cargo tree --locked -p agentenv --no-default-features --features p2p-iroh -e normal
  includes iroh v1.0.3 and iroh-blobs v0.103.0

cargo test --locked -p agentenv --lib p2p::tests --no-default-features
  5 passed

cargo test --locked -p agentenv --lib p2p::iroh::endpoint::tests --features p2p-iroh
  3 passed

Skipped checks and reasons:

  • make test-unit and integration tests require broader host capabilities and are unrelated to the compile-time gate; focused no-feature and feature-enabled P2P tests passed.
  • services/ and generated code are unchanged.
  • No benchmark result is claimed; the dependency-tree assertion directly verifies removal from default builds.

Risks and reviewer notes

Custom source builds that previously enabled P2P without build flags must enable p2p-iroh. The repository's formal release paths have been updated to preserve their existing runtime capability.

Cargo also reports an existing future-incompatibility notice in the third-party proc-macro-error2 crate; it is not emitted as a project Clippy warning.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/283 **Author:** [@CharlesXu-HQ](https://github.com/CharlesXu-HQ) **Created:** 9/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/p2p-iroh-optional` --- ### 📝 Commits (1) - [`f254c65`](https://github.com/kvcache-ai/AgentENV/commit/f254c655bbfbf77cb21d60bf2df1d6c492aaa35c) feat(p2p): make iroh backend optional ### 📊 Changes **9 files changed** (+65 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yml` (+1 -1) 📝 `Cargo.toml` (+3 -2) 📝 `Makefile` (+3 -3) 📝 `config/default.toml` (+2 -1) 📝 `deploy/docker/Dockerfile.agentenv` (+2 -2) 📝 `docs/src/configuration/reference.md` (+1 -1) 📝 `src/p2p/config.rs` (+13 -0) 📝 `src/p2p/error.rs` (+1 -0) 📝 `src/p2p/mod.rs` (+39 -0) </details> ### 📄 Description ## What Make the Iroh P2P backend optional behind a `p2p-iroh` Cargo feature. Default development and unit-test builds no longer compile `iroh` or `iroh-blobs`, while the release Makefile targets, Docker image, and release workflow continue to include Iroh support. When P2P is enabled with `transport = "iroh"` in a binary built without the feature, startup now returns a clear error naming the required feature. ## Why Iroh brings a large transitive dependency graph into ordinary builds even when P2P is disabled. This implements the P2 dependency-isolation item in #8 without changing the capabilities of distributed release artifacts. ## Related issue Part of #8 (P2) ## Scope and non-goals This PR includes Cargo feature wiring, compile-time gates around the Iroh implementation, a missing-feature error, release build flags, focused tests, and configuration documentation. It does not change the P2P configuration schema, transport behavior when Iroh is compiled in, or the default `p2p.enabled = false` setting. ## Design and behavior changes - `iroh` and `iroh-blobs` are optional dependencies selected by `p2p-iroh`. - Iroh-only modules and resolved configuration fields are compiled only with that feature. - Disabled P2P continues to use `DisabledP2pTransport` in a no-feature build. - Selecting Iroh without `p2p-iroh` fails before backend initialization and reports the feature required to enable it. - Formal release paths explicitly enable `p2p-iroh`. ## Compatibility and operations - Public API or generated protocol: N/A; no public API or generated protocol changes. - Configuration or defaults: Existing keys and defaults are unchanged. Custom builds that enable Iroh P2P must add `--features p2p-iroh`. - Snapshot manifest, artifact layout, or storage format: N/A; no format changes. - Upgrade and rollback: Packaged release builds retain Iroh support. Rolling back removes the build-time option and restores the unconditional dependency. - Host requirements, permissions, ports, or dependencies: Runtime requirements are unchanged for feature-enabled builds. Default development builds omit the Iroh dependency graph. ## Validation - [x] `make fmt` - [x] `make clippy` - [ ] `make test-unit` - [ ] Relevant Rust integration tests - [ ] `make -C services test` (required when `services/` changes) - [ ] Generated clients/server regenerated with the documented `make` target - [x] Documentation updated - [ ] Benchmarks or performance comparison completed Commands and results: ```text make fmt passed make clippy passed on Linux with Rust 1.98.1 cargo tree --locked -p agentenv --no-default-features -e normal no iroh or iroh-blobs packages cargo tree --locked -p agentenv --no-default-features --features p2p-iroh -e normal includes iroh v1.0.3 and iroh-blobs v0.103.0 cargo test --locked -p agentenv --lib p2p::tests --no-default-features 5 passed cargo test --locked -p agentenv --lib p2p::iroh::endpoint::tests --features p2p-iroh 3 passed ``` Skipped checks and reasons: - `make test-unit` and integration tests require broader host capabilities and are unrelated to the compile-time gate; focused no-feature and feature-enabled P2P tests passed. - `services/` and generated code are unchanged. - No benchmark result is claimed; the dependency-tree assertion directly verifies removal from default builds. ## Risks and reviewer notes Custom source builds that previously enabled P2P without build flags must enable `p2p-iroh`. The repository's formal release paths have been updated to preserve their existing runtime capability. Cargo also reports an existing future-incompatibility notice in the third-party `proc-macro-error2` crate; it is not emitted as a project Clippy warning. ## Checklist - [x] The PR contains one coherent change and no unrelated formatting or refactoring. - [x] New behavior is covered by tests, or I explained why testing is impractical. - [x] Logs and examples contain no credentials, tokens, or private registry information. - [x] I did not manually edit generated code without updating its source and regenerating it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#315
No description provided.