Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

Merge remote-tracking branch 'upstream/main' into tinywallet-release-0192

Steven Enamakel002e9c7203b6
diff --cc crates/openhuman-core/src/channels/host/channel_events_tests.rs
index 9ecdf48f33,9ecdf48f33..0c7563e705
--- a/crates/openhuman-core/src/channels/host/channel_events_tests.rs
+++ b/crates/openhuman-core/src/channels/host/channel_events_tests.rs
@@@ -132,13 -132,13 +132,38 @@@ async fn approvals_for_web_email_or_unr
assert!(discord.sent.lock().unwrap().is_empty());
}
--// Busy flags now live in the module's own storage scope and are written by the
--// module, so this needs the linked-module fixture, which is blocked on the
--// tinybus epic (see `channels::module_fixture`). It failed the same way before
--// the storage contract, on the fixture panic.
++async fn remote_status(ws: &Path, channel: &str, reply_target: &str) -> Option<String> {
++ let client = crate::channels::module_fixture::client().await;
++ let result: tinychannels_bus::module_remote::RemoteOperationResult = client
++ .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 release module should answer the status command");
++ result.reply
++}
++
#[tokio::test]
--#[ignore = "blocked on the linked tinychannels-module fixture (tinybus epic)"]
--async fn turn_state_marks_busy_for_every_remote_control_channel() {
++async fn turn_state_events_leave_remote_status_idle_after_completion() {
let dir = tempdir().unwrap();
let ws = dir.path().to_path_buf();
let sub = ChannelTurnStateSubscriber::new(ws.clone());
@@@ -147,6 -147,6 +172,10 @@@
for channel in ["telegram", "discord"] {
sub.handle(&received(channel, "chat-99", None, &ws)).await;
sub.handle(&processed(channel, "chat-99", &ws)).await;
++ let status = remote_status(&ws, channel, "chat-99")
++ .await
++ .expect("/status should return a response");
++ assert!(status.contains("idle"), "{channel}: {status}");
}
}
@@@ -155,12 -155,12 +184,13 @@@ async fn turn_state_ignores_non_remote_
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;
++ assert!(remote_status(&ws, "email", "[email protected]").await.is_none());
let other = tempdir().unwrap().path().to_path_buf();
sub.handle(&received("telegram", "chat-1", None, &other))
.await;
-- sub.handle(&processed("telegram", "chat-1", &other)).await;
++ let status = remote_status(&ws, "telegram", "chat-1")
++ .await
++ .expect("/status should return a response");
++ assert!(status.contains("idle"), "{status}");
}
diff --cc crates/openhuman-core/src/channels/module_fixture_tests.rs
index ac7ec108f6,ac7ec108f6..3c82b6aec8
--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs
+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs
@@@ -1,28 -1,28 +1,23 @@@
--//! A linked TinyChannels module fixture for host-side unit tests.
++//! The pinned TinyChannels release fixture for host-side unit tests.
//!
--//! 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.
++//! 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.
++use crate::config::Config;
use crate::modules::client::ModuleClient;
use tinychannels_bus::methods;
--/// Return a client for the compiled, linked TinyChannels module fixture.
--///
--/// BLOCKED on the tinybus epic: `tinychannels-module` v0.1.29 pins `tinybus =0.1.4`
--/// while the workspace tinybus is 0.1.3, so the module cannot be a dev-dependency
--/// and the fixture cannot be linked. Tests that need it fail with this message
--/// until the dependency is restored.
++/// Return a client for the checksum-pinned TinyChannels test module.
pub(crate) async fn client() -> ModuleClient {
-- panic!("tinychannels-module fixture unavailable: blocked on tinybus 0.1.4 (tinybus epic)")
++ let mut config = Config::default();
++ config.modules.enabled = true;
++ ModuleClient::new(config)
}
#[tokio::test]
--async fn linked_module_prepares_runtime_limits_over_confidential_bus_call() {
++async fn released_module_prepares_runtime_limits_over_confidential_bus_call() {
use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};
let response: ChannelControlResult = client()
@@@ -48,7 -48,7 +43,7 @@@
}
#[tokio::test]
--async fn linked_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {
++async fn released_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {
use tinychannels_bus::module_inbound::{
ChannelInboundSource, PrepareChannelInboundRequest, PreparedChannelInbound,
};
diff --cc crates/openhuman-core/src/channels/routes_tests.rs
index 57dabaf812,421a578253..75963cffac
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@@ -2,15 -2,15 +2,12 @@@ use super::*
use crate::channels::context::{
conversation_history_key, ChannelRuntimeContext, RouteSelectionMap, TurnModelSourceCacheMap,
};
--use crate::channels::host::ChannelTurnStateSubscriber;
--use crate::core::events::DomainEvent;
use async_trait::async_trait;
use std::collections::HashMap;
use std::future::Future;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
- use std::task::{Context, Poll, Wake, Waker};
- use tinybus::EventHandler;
+ use std::task::{Context, Poll, Waker};
-use tinybus::EventHandler;
use tinychannels::routes::resolve_provider_alias;
use tinychannels_bus::context::ChatMessage;
use tinychannels_bus::ChannelMessage;
@@@ -513,7 -507,7 +504,7 @@@ async fn handle_runtime_command_telegra
}
#[tokio::test]
--async fn handle_runtime_command_telegram_new_status_and_sessions_round_trip() {
++async fn handle_runtime_command_telegram_new_reports_unavailable_storage() {
let tempdir = tempfile::tempdir().unwrap();
let ctx = runtime_context(tempdir.path().to_path_buf());
let channel_impl = Arc::new(RecordingChannel::default());
@@@ -525,7 -519,7 +516,7 @@@
vec![ChatMessage::user("old history")],
);
-- let new_msg = ChannelMessage {
++ let msg = ChannelMessage {
id: "1".into(),
sender: "alice".into(),
reply_target: "chat-remote".into(),
@@@ -538,103 -532,103 +529,22 @@@
assert!(
handle_runtime_command_if_needed(
&ctx,
-- &new_msg,
- Some(&channel),
- &conversation_history_key(&new_msg)
- )
- .await
- );
- assert!(ctx
- .conversation_histories
- .lock()
- .unwrap()
- .get(sender_key)
- .is_none());
-
- ctx.conversation_histories
- .lock()
- .unwrap()
- .insert(sender_key.to_string(), vec![ChatMessage::user("after new")]);
- set_route_selection(
- &ctx,
- sender_key,
- ChannelRouteSelection {
- provider: "anthropic".into(),
- model: "claude-3".into(),
- },
- );
-
- let subscriber = ChannelTurnStateSubscriber::new(tempdir.path().to_path_buf());
- subscriber
- .handle(&DomainEvent::ChannelMessageReceived {
- channel: "telegram".into(),
- message_id: "2".into(),
- sender: "alice".into(),
- reply_target: "chat-remote".into(),
- content: "work".into(),
- thread_ts: Some("42".into()),
- inbound_envelope: None,
- workspace_dir: tempdir.path().to_path_buf(),
- })
- .await;
-
- let status_msg = ChannelMessage {
- id: "3".into(),
- sender: "alice".into(),
- reply_target: "chat-remote".into(),
- content: "/status".into(),
- channel: "telegram".into(),
- timestamp: 0,
- thread_ts: Some("42".into()),
- sender_name: None,
- };
- assert!(
- handle_runtime_command_if_needed(
- &ctx,
- &status_msg,
++ &msg,
Some(&channel),
- &conversation_history_key(&new_msg)
- &conversation_history_key(&status_msg)
++ &conversation_history_key(&msg)
)
.await
);
- assert!(ctx
- .conversation_histories
- .lock()
- .unwrap()
- .get(sender_key)
- .is_none());
-
- ctx.conversation_histories
- .lock()
- .unwrap()
- .insert(sender_key.to_string(), vec![ChatMessage::user("after new")]);
- set_route_selection(
- &ctx,
- sender_key,
- ChannelRouteSelection {
- provider: "anthropic".into(),
- model: "claude-3".into(),
- },
- );
-
- let subscriber = ChannelTurnStateSubscriber::new(tempdir.path().to_path_buf());
- subscriber
- .handle(&DomainEvent::ChannelMessageReceived {
- channel: "telegram".into(),
- message_id: "2".into(),
- sender: "alice".into(),
- reply_target: "chat-remote".into(),
- content: "work".into(),
- thread_ts: Some("42".into()),
- inbound_envelope: None,
- workspace_dir: tempdir.path().to_path_buf(),
- })
- .await;
-
- let status_msg = ChannelMessage {
- id: "3".into(),
- sender: "alice".into(),
- reply_target: "chat-remote".into(),
- content: "/status".into(),
- channel: "telegram".into(),
- timestamp: 0,
- thread_ts: Some("42".into()),
- sender_name: None,
- };
- assert!(
- handle_runtime_command_if_needed(
- &ctx,
- &status_msg,
- Some(&channel),
- &conversation_history_key(&status_msg)
- )
- .await
- );
--
-- let sessions_msg = ChannelMessage {
-- id: "4".into(),
-- sender: "alice".into(),
-- reply_target: "chat-remote".into(),
-- content: "/sessions".into(),
-- channel: "telegram".into(),
-- timestamp: 0,
-- thread_ts: Some("42".into()),
-- sender_name: None,
-- };
++ let sent = channel_impl.sent.lock().unwrap();
++ assert_eq!(sent.len(), 1);
assert!(
-- handle_runtime_command_if_needed(
-- &ctx,
-- &sessions_msg,
-- Some(&channel),
-- &conversation_history_key(&sessions_msg)
-- )
-- .await
++ sent[0].content.contains("Created thread"),
++ "{}",
++ sent[0].content
);
--
-- let sent = channel_impl.sent.lock().unwrap();
-- assert_eq!(sent.len(), 3);
-- assert!(sent[0].content.contains("Started new session"));
assert!(sent[0]
.content
-- .contains("In-memory channel history cleared for this chat."));
--
-- assert!(sent[1].content.contains("**Status**"));
-- assert!(sent[1].content.contains("Thread: `Telegram"));
-- assert!(sent[1].content.contains("Provider: `anthropic`"));
-- assert!(sent[1].content.contains("Model: `claude-3`"));
-- assert!(sent[1].content.contains("In-memory turns: 1"));
-- assert!(sent[1].content.contains("Turn: in progress"));
--
-- assert!(sent[2].content.contains("**Recent sessions**"));
-- assert!(sent[2].content.contains("→ `Telegram"));
-- assert!(sent
-- .iter()
-- .all(|message| message.thread_ts.as_deref() == Some("42")));
++ .contains("failed to persist the chat binding"));
++ assert!(sent[0].content.contains("host storage is unavailable"));
++ assert_eq!(sent[0].thread_ts.as_deref(), Some("42"));
}
diff --cc crates/openhuman-core/src/modules/ops_tests.rs
index 145453c38a,225175b553..1b8d82bbde
--- a/crates/openhuman-core/src/modules/ops_tests.rs
+++ b/crates/openhuman-core/src/modules/ops_tests.rs
@@@ -600,25 -600,25 +600,23 @@@ fn status_reports_the_source_that_serve
}
#[tokio::test]
--#[ignore = "blocked on tinybus 0.1.4 (tinybus epic): tinychannels-module cannot be a dev-dependency"]
--async fn a_registered_linked_factory_serves_the_module_and_status_says_so() {
++async fn a_pinned_release_module_serves_the_module_and_status_says_so() {
use crate::config::schema::ModuleSourceMode;
use crate::modules::types::ModuleSource;
-- // Restore `register_linked("tinychannels", tinychannels_module::linked_module);`
-- // once the tinybus epic lets tinychannels-module be a dev-dependency again.
let mut config = Config::default();
-- config.modules.source = ModuleSourceMode::Linked;
++ config.modules.enabled = true;
++ config.modules.source = ModuleSourceMode::Release;
ops::ensure_loaded(&config, "tinychannels")
.await
-- .expect("the linked module is admitted through the seam");
++ .expect("the pinned release module is admitted through the seam");
let status = list(&config)
.into_iter()
.find(|m| m.id == "tinychannels")
.expect("tinychannels is registered");
assert_eq!(status.state, ModuleState::Ready);
-- assert_eq!(status.source, Some(ModuleSource::Linked));
++ assert_eq!(status.source, Some(ModuleSource::Release));
assert_eq!(status.detail, None);
}
diff --cc scripts/test-rust-with-mock.sh
index 5439fee8c9,5439fee8c9..033f523e59
--- a/scripts/test-rust-with-mock.sh
+++ b/scripts/test-rust-with-mock.sh
@@@ -90,12 -90,12 +90,20 @@@ local_source_ids=(
if local_module_source_is_source; then
local_source_ids+=(tinyconnectors tinyjuice tinysearch tinyhosts tinymcp)
else
-- for released_id in tinyjuice tinysearch; do
++ for released_id in tinychannels tinyjuice tinysearch; do
released_dir="$(stage_release_module "$released_id" "$wallet_platform" "$module_ext")"
export OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"
done
fi
++# TinyChannels host unit tests use the pinned module artifact through the
++# regular loader. Its source module is not linked into the core: tinychannels-
++# module currently requires TinyBus 0.1.4 while this host pins 0.1.3.
++if local_module_source_is_source; then
++ released_dir="$(stage_release_module tinychannels "$wallet_platform" "$module_ext")"
++ export OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"
++fi
++
# Wallet JSON-RPC E2E sends a recovery phrase only to an attested module. Build
# artifacts are deliberately not treated as release-pinned recipients, so use
# the checksum-pinned release archive and its accompanying `modules.toml`.
@@@ -234,6 -234,6 +242,11 @@@ run_raw_coverage_modules()
true; then
OPENHUMAN_MODULE_PATH="$connectors_module_path" \
cargo_test --test raw_coverage_all -- "${module}::" --test-threads=1 "$@"
++ elif [ "$module" = "automation_scheduling_e2e" ]; then
++ # This target executes a scheduled shell job through the verified TinyBox
++ # release, which the ordinary isolated raw-coverage processes do not see.
++ OPENHUMAN_MODULE_PATH="$connectors_module_path" \
++ cargo_test --test raw_coverage_all -- "${module}::" --test-threads=1 "$@"
else
cargo_test --test raw_coverage_all -- "${module}::" --test-threads=1 "$@"
fi