The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
Merge remote-tracking branch 'upstream/main' into tinywallet-release-0192
Steven Enamakel4daf14490be1
diff --cc crates/openhuman-core/src/channels/host/channel_events.rsindex 3f39386f4b,c75d25a030..cd9b7ea42e--- a/crates/openhuman-core/src/channels/host/channel_events.rs+++ b/crates/openhuman-core/src/channels/host/channel_events.rs@@@ -214,10 -208,11 +208,10 @@@ impl ChannelTurnStateSubscriberlet client = if self.config.is_none() {crate::channels::module_fixture::client().await} else {- ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default())+ crate::modules::client(self.config.as_deref().cloned().unwrap_or_default())};#[cfg(not(test))]- let client = ModuleClient::new(self.config.as_deref().cloned().unwrap_or_default());- let client =- crate::modules::client(self.config.as_deref().cloned().unwrap_or_default());++ let client = crate::modules::client(self.config.as_deref().cloned().unwrap_or_default());let result: Result<tinychannels_bus::module_remote::RemoteOperationResult, _> = client.call_confidential("tinychannels",diff --cc crates/openhuman-core/src/channels/host/channel_events_tests.rsindex 588da094a6,3f19c991f4..c9b6b3f7dd--- a/crates/openhuman-core/src/channels/host/channel_events_tests.rs+++ b/crates/openhuman-core/src/channels/host/channel_events_tests.rs@@@ -70,6 -70,6 +70,38 @@@ fn processed(channel: &str, reply_targe}}++#[cfg(feature = "e2e-test-support")]++async fn remote_status(ws: &Path, channel: &str, reply_target: &str) -> Option<String> {++ let result: tinychannels_bus::module_remote::RemoteOperationResult =++ crate::channels::module_fixture::client()++ .await++ .call_confidential(++ "tinychannels",++ tinychannels_bus::methods::EXECUTE_REMOTE,++ (tinychannels_bus::module_remote::RemoteOperation::Execute {++ workspace_dir: ws.to_string_lossy().into_owned(),++ message: ChannelMessage {++ id: "status-1".into(),++ channel: channel.into(),++ sender: "alice".into(),++ reply_target: reply_target.into(),++ content: "/status".into(),++ timestamp: 0,++ thread_ts: None,++ sender_name: None,++ },++ route: tinychannels_bus::module_remote::RemoteRoute {++ provider: "openai".into(),++ model: "test-model".into(),++ },++ history_len: 0,++ },),++ )++ .await++ .expect("the linked module should answer the status command");++ result.reply++}++fn approval(thread_id: Option<&str>, client_id: Option<&str>) -> DomainEvent {DomainEvent::ApprovalRequested {request_id: "req-1".into(),@@@ -133,40 -132,33 +164,62 @@@ async fn approvals_for_web_email_or_unrassert!(discord.sent.lock().unwrap().is_empty());}+ // Busy flags live in the module's own storage scope and are written by the+ // module, so this runs against the linked-module fixture+ // (`channels::module_fixture`).#[tokio::test]- async fn turn_state_accepts_busy_and_idle_updates_for_remote_channels() {++#[cfg(feature = "e2e-test-support")]+ async fn turn_state_marks_busy_for_every_remote_control_channel() {++ let _storage = crate::channels::module_fixture::install_memory_storage();let dir = tempdir().unwrap();let ws = dir.path().to_path_buf();let sub = ChannelTurnStateSubscriber::new(ws.clone());assert_eq!(sub.name(), "channels::turn_state");assert_eq!(sub.domains(), Some(&["channel"][..]));for channel in ["telegram", "discord"] {- let busy = sub.mark(channel, "chat-99", &ws, true).await;- assert!(busy, "{channel}: MarkTurn(busy=true) must be accepted");- let idle = sub.mark(channel, "chat-99", &ws, false).await;- assert!(idle, "{channel}: MarkTurn(busy=false) must be accepted");+ sub.handle(&received(channel, "chat-99", None, &ws)).await;++ let busy = remote_status(&ws, channel, "chat-99")++ .await++ .expect("/status should answer after a received event");++ assert!(busy.contains("in progress"), "{channel}: {busy}");+++ sub.handle(&processed(channel, "chat-99", &ws)).await;++ let idle = remote_status(&ws, channel, "chat-99")++ .await++ .expect("/status should answer after a processed event");++ assert!(idle.contains("idle"), "{channel}: {idle}");}}#[tokio::test]++#[cfg(feature = "e2e-test-support")]async fn turn_state_ignores_non_remote_channels_and_stale_workspaces() {++ let _storage = crate::channels::module_fixture::install_memory_storage();let dir = tempdir().unwrap();let ws = dir.path().to_path_buf();let sub = ChannelTurnStateSubscriber::new(ws.clone());- // Both events are dropped before the module is called: the test subscriber- // has no module client, so reaching it would panic in the fixture.- sub.handle(&received("email", "[email protected]", None, &ws)).await;- sub.handle(&processed("email", "[email protected]", &ws)).await;let other = tempdir().unwrap().path().to_path_buf();- let busy = sub.mark("telegram", "chat-1", &ws, true).await;- assert!(busy, "a matching workspace should accept MarkTurn");- assert!(- !sub.mark("email", "[email protected]", &ws, true).await,- "non-remote channels must not receive MarkTurn"- );- assert!(- !sub.mark("telegram", "chat-1", &other, false).await,- "a stale workspace must not clear turn state"- );- let status = sub.mark("telegram", "chat-1", &ws, false).await;- sub.handle(&received("telegram", "chat-1", None, &other))- .await;++ sub.handle(&received("email", "[email protected]", None, &ws)).await;++ assert!(remote_status(&ws, "email", "[email protected]").await.is_none());++++ sub.handle(&received("telegram", "chat-1", None, &ws)).await;++ let busy = remote_status(&ws, "telegram", "chat-1")++ .await++ .expect("/status should answer after a received event");++ assert!(busy.contains("in progress"), "{busy}");+++ sub.handle(&processed("telegram", "chat-1", &other)).await;++ let still_busy = remote_status(&ws, "telegram", "chat-1")++ .await++ .expect("/status should answer after a stale processed event");+ assert!(- status,- "the matching workspace should accept the idle update"++ still_busy.contains("in progress"),++ "a stale workspace must not clear turn state: {still_busy}"+ );++++ sub.handle(&processed("telegram", "chat-1", &ws)).await;++ let idle = remote_status(&ws, "telegram", "chat-1")++ .await++ .expect("/status should answer after a matching processed event");++ assert!(idle.contains("idle"), "{idle}");}diff --cc crates/openhuman-core/src/channels/module_fixture_tests.rsindex 9c229f4744,36a94db626..13b9ee3f64--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs@@@ -1,26 -1,43 +1,67 @@@- //! The pinned TinyChannels release fixture for host-side unit tests.+ //! A linked TinyChannels module fixture for host-side unit tests.//!- //! These tests exercise the real owning module over TinyBus without contacting- //! provider services. The host test runner stages the checksum-pinned module- //! release in `OPENHUMAN_MODULE_PATH`, and the regular release loader attaches- //! it to the process-wide module host.+ //! These tests exercise the real owning module over TinyBus without downloading+ //! a release artifact or reaching a provider service. The module is attached+ //! through the same seam local development uses: the factory is registered with+ //! [`register_linked`] and `[modules] source = "linked"` makes+ //! `ops::ensure_loaded` attach it to the process-wide module host, which lives+ //! on a process-lifetime runtime, so it outlives the short Tokio runtimes of+ //! individual tests.+ use crate::config::schema::ModuleSourceMode;use crate::config::Config;- use crate::modules::client::ModuleClient;- #[cfg(feature = "e2e-test-support")]+ use crate::modules::linked::register_linked;+ use crate::modules::{ops, runtime};++use std::sync::Arc;+ use tinybus::module::ModuleClient;use tinychannels_bus::methods;- /// Return a client for the checksum-pinned TinyChannels test module.+ const MODULE_ID: &str = "tinychannels";++ /// Return a client for the compiled, linked TinyChannels module fixture.pub(crate) async fn client() -> ModuleClient {+ register_linked(MODULE_ID, tinychannels_module::linked_module);let mut config = Config::default();- config.modules.enabled = true;- config.modules.allow_download = false;- ModuleClient::new(config)+ config.modules.source = ModuleSourceMode::Linked;+ ops::ensure_loaded(&config, MODULE_ID)+ .await+ .expect("the linked TinyChannels module should be admitted through the seam");+ let proxy = runtime::runtime()+ .await+ .expect("the module host should be running")+ .proxy(+ tinychannels_module::BUS_NAME,+ tinychannels_module::OBJECT_PATH,+ )+ .expect("the linked TinyChannels proxy should be valid");+ ops::fixture_client(proxy)+ }+++/// Temporarily install in-memory storage for module callbacks in isolated tests.++pub(crate) struct MemoryStorageGuard {++ previous: Option<Arc<dyn crate::storage::StorageBackend>>,++}++++/// Give the linked module a writable backend for storage-backed fixture calls.++pub(crate) fn install_memory_storage() -> MemoryStorageGuard {++ MemoryStorageGuard {++ previous: crate::storage::install(Arc::new(crate::storage::MemoryStorage::new())),++ }++}++++impl Drop for MemoryStorageGuard {++ fn drop(&mut self) {++ crate::storage::clear();++ if let Some(previous) = self.previous.take() {++ crate::storage::install(previous);++ }++ }+}+#[tokio::test]+#[cfg(feature = "e2e-test-support")]- async fn released_module_prepares_runtime_limits_over_confidential_bus_call() {+ async fn linked_module_prepares_runtime_limits_over_confidential_bus_call() {++ let _storage = install_memory_storage();use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};let response: ChannelControlResult = client()@@@ -46,8 -63,7 +87,9 @@@}#[tokio::test]+#[cfg(feature = "e2e-test-support")]- async fn released_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {+ async fn linked_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {++ let _storage = install_memory_storage();use tinychannels_bus::module_inbound::{ChannelInboundSource, PrepareChannelInboundRequest, PreparedChannelInbound,};diff --cc crates/openhuman-core/src/modules/ops_tests.rsindex d59052d351,e29059d7ec..57ed3f2872--- a/crates/openhuman-core/src/modules/ops_tests.rs+++ b/crates/openhuman-core/src/modules/ops_tests.rs@@@ -599,19 -612,17 +612,19 @@@ fn status_reports_the_source_that_serve}}- #[cfg(feature = "e2e-test-support")]#[tokio::test]- async fn a_pinned_release_module_serves_the_module_and_status_says_so() {++#[cfg(feature = "e2e-test-support")]+ async fn a_registered_linked_factory_serves_the_module_and_status_says_so() {use crate::config::schema::ModuleSourceMode;use crate::modules::types::ModuleSource;++ let _storage = crate::channels::module_fixture::install_memory_storage();+ crate::modules::linked::register_linked("tinychannels", tinychannels_module::linked_module);let mut config = Config::default();- config.modules.enabled = true;- config.modules.allow_download = false;- config.modules.source = ModuleSourceMode::Release;+ config.modules.source = ModuleSourceMode::Linked;ops::ensure_loaded(&config, "tinychannels").await- .expect("the pinned release module is admitted through the seam");+ .expect("the linked module is admitted through the seam");let status = list(&config).into_iter()diff --cc scripts/__tests__/e2e-web-bundle-guard.test.mjsindex 33a2b4cf90,44951ea635..5a2b1e5c82--- a/scripts/__tests__/e2e-web-bundle-guard.test.mjs+++ b/scripts/__tests__/e2e-web-bundle-guard.test.mjs@@@ -182,52 -173,6 +182,53 @@@ test("the session refuses a dist-web th}});+test("an explicit workspace requires its own keyring key", () => {+ const tree = makeTree("e2e-web-session.sh");+ try {+ const workspace = path.join(tree.root, "persistent-workspace");+ const res = run(tree, "e2e-web-session.sh", {+ OPENHUMAN_WORKSPACE: workspace,++ OPENHUMAN_E2E_ALLOW_EPHEMERAL_KEY: "",+ OPENHUMAN_KEYRING_MASTER_KEY: "",+ OPENHUMAN_KEYRING_MASTER_KEY_FILE: "",+ });++ assert.equal(res.status, 2, res.output);+ assert.match(res.output, /explicit OPENHUMAN_WORKSPACE requires/);+ assert.equal(fs.existsSync(workspace), false, "refuse before creating the supplied workspace");+ } finally {+ tree.cleanup();+ }+});++test("an ephemeral explicit workspace can generate a private key", () => {+ const tree = makeTree("e2e-web-session.sh");+ try {+ const distWeb = path.join(tree.root, "app", "dist-web");+ fs.mkdirSync(distWeb, { recursive: true });+ fs.writeFileSync(path.join(distWeb, MARKER), "VITE_OPENHUMAN_TARGET=web\n");+ fs.writeFileSync(+ path.join(distWeb, ".e2e-build-ports.json"),+ '{"e2e_mock_port":"18473","openhuman_core_port":"17788"}\n',+ );++ const res = run(tree, "e2e-web-session.sh", {+ OPENHUMAN_WORKSPACE: path.join(tree.root, "ci-workspace"),+ OPENHUMAN_E2E_ALLOW_EPHEMERAL_KEY: "1",+ OPENHUMAN_KEYRING_MASTER_KEY: "",+ OPENHUMAN_KEYRING_MASTER_KEY_FILE: "/host/master.key",+ });++ assert.match(res.output, /standalone core binary is missing/);+ assert.ok(+ tree.calls().some((call) => call.includes("randomBytes")),+ "an explicitly marked ephemeral workspace gets a fresh key",+ );+ } finally {+ tree.cleanup();+ }+});+test("the session accepts a marked bundle and proceeds past the guard", () => {// Pins that the guard is not simply always-fail. With the marker present the// session starts the mock backend and reaches its next precondition — thediff --cc scripts/ci/self-hosted/lanes-plan.mjsindex 2f81cec451,9cc5a491b2..8d9d4b5e98--- a/scripts/ci/self-hosted/lanes-plan.mjs+++ b/scripts/ci/self-hosted/lanes-plan.mjs@@@ -480,8 -480,7 +480,8 @@@ export function buildPlan({ profile, arrun:"cargo test --manifest-path Cargo.toml -p openhuman --no-default-features" +" --features modules,mcp,e2e-test-support --lib --" +- " modules::host:: modules::registry:: modules::storage_grant_tinywallet::" ++ " modules::runtime:: modules::registry:: modules::storage_grant_tinywallet::" ++ " modules::storage_grant_tinyconnectors::" +" mcp::server::resources:: test_support::introspect::",},{diff --cc scripts/test-rust-with-mock.shindex c291e6b259,5439fee8c9..ca7373e733--- a/scripts/test-rust-with-mock.sh+++ b/scripts/test-rust-with-mock.sh@@@ -304,22 -287,6 +304,22 @@@ run_build_only_reaper_test()-- --exact --test-threads=1 "$@"}- run_tinychannels_release_fixture_tests() {- # These confidential calls require the checksum-pinned release module and- # run in a fresh process so module-loader state cannot leak into the unit- # suite. The fixture disables downloads; only this staged path may serve it.++run_tinychannels_linked_fixture_tests() {++ # These confidential calls use the linked test module and run in fresh++ # processes so process-wide module-loader state cannot leak into the unit++ # suite. The linked source is explicit and never falls back to downloading.+ OPENHUMAN_MODULE_PATH="$tinychannels_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \- cargo_test --features e2e-test-support --lib channels::module_fixture:: \++ cargo_test --lib channels::module_fixture:: \+ -- --test-threads=1 "$@"+ OPENHUMAN_MODULE_PATH="$tinychannels_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \+ cargo_test --features e2e-test-support --lib \- modules::ops::tests::a_pinned_release_module_serves_the_module_and_status_says_so \++ modules::ops::tests::a_registered_linked_factory_serves_the_module_and_status_says_so \+ -- --exact --test-threads=1 "$@"+ OPENHUMAN_MODULE_PATH="$tinychannels_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \- cargo_test --features e2e-test-support --lib \++ cargo_test --lib \+ channels::host::channel_events::tests:: -- --test-threads=1 "$@"+}+run_full_suite() {# Several unit fixtures mutate process-wide state (provider overrides and# temporary executable paths). Keep this aggregate invocation deterministic;@@@ -331,7 -298,6 +331,7 @@@# `--workspace --bins` picks them up there (plus the TUI binary).cargo_test --bins -- --test-threads=1 "$@"run_build_only_reaper_test "$@"- run_tinychannels_release_fixture_tests "$@"++ run_tinychannels_linked_fixture_tests "$@"cargo_test --doc -- "$@"while IFS= read -r target; do