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
fix: address staged review findings
Steven Enamakel3fd701d4f1a8
diff --git a/.github/workflows/ci-full.yml b/.github/workflows/ci-full.ymlindex 6206dfae87..09ec720207 100644--- a/.github/workflows/ci-full.yml+++ b/.github/workflows/ci-full.yml@@ -321,6 +321,7 @@ jobs:- name: Run Playwright web E2E suiteenv:OPENHUMAN_WORKSPACE: ${{ runner.temp }}/openhuman-playwright-workspace+ OPENHUMAN_E2E_ALLOW_EPHEMERAL_KEY: "1"run: |mkdir -p "$OPENHUMAN_WORKSPACE"workspace_root="$OPENHUMAN_WORKSPACE"diff --git a/.github/workflows/e2e-playwright.yml b/.github/workflows/e2e-playwright.ymlindex b88e4a1ff6..d6db083267 100644--- a/.github/workflows/e2e-playwright.yml+++ b/.github/workflows/e2e-playwright.yml@@ -84,6 +84,7 @@ jobs:- name: Run Playwright web E2E suiteenv:OPENHUMAN_WORKSPACE: ${{ runner.temp }}/openhuman-playwright-workspace+ OPENHUMAN_E2E_ALLOW_EPHEMERAL_KEY: "1"run: |mkdir -p "$OPENHUMAN_WORKSPACE"workspace_root="$OPENHUMAN_WORKSPACE"diff --git a/app/scripts/e2e-web-session.sh b/app/scripts/e2e-web-session.shindex df5f6cd555..1c8d70d183 100755--- a/app/scripts/e2e-web-session.sh+++ b/app/scripts/e2e-web-session.sh@@ -30,10 +30,15 @@ export OPENHUMAN_WORKSPACEexport OPENHUMAN_KEYRING_BACKEND="${OPENHUMAN_KEYRING_BACKEND:-file}"if [ -n "$E2E_WEB_WORKSPACE_EXPLICIT" ]; thenif [ -z "${OPENHUMAN_KEYRING_MASTER_KEY:-}" ] &&- [ -z "${OPENHUMAN_KEYRING_MASTER_KEY_FILE:-}" ]; then+ [ -z "${OPENHUMAN_KEYRING_MASTER_KEY_FILE:-}" ] &&+ [ "${OPENHUMAN_E2E_ALLOW_EPHEMERAL_KEY:-}" != "1" ]; thenecho "ERROR: an explicit OPENHUMAN_WORKSPACE requires OPENHUMAN_KEYRING_MASTER_KEY or OPENHUMAN_KEYRING_MASTER_KEY_FILE." >&2exit 2fi+ if [ "${OPENHUMAN_E2E_ALLOW_EPHEMERAL_KEY:-}" = "1" ] &&+ [ -z "${OPENHUMAN_KEYRING_MASTER_KEY:-}" ]; then+ unset OPENHUMAN_KEYRING_MASTER_KEY_FILE+ fielse# A disposable workspace must not accidentally inherit a key-file path# outside the test tree from the developer or runner environment.diff --git a/crates/openhuman-core/src/channels/host/channel_events.rs b/crates/openhuman-core/src/channels/host/channel_events.rsindex 67d0ef5c64..3f39386f4b 100644--- a/crates/openhuman-core/src/channels/host/channel_events.rs+++ b/crates/openhuman-core/src/channels/host/channel_events.rs@@ -197,12 +197,18 @@ impl ChannelTurnStateSubscriber {cancellation: tokio_util::sync::CancellationToken::new(),}}- async fn mark(&self, channel: &str, reply_target: &str, event_ws: &PathBuf, busy: bool) {+ async fn mark(+ &self,+ channel: &str,+ reply_target: &str,+ event_ws: &PathBuf,+ busy: bool,+ ) -> bool {if self.cancellation.is_cancelled()|| !capabilities_for(channel).remote_control|| *event_ws != self.workspace_dir{- return;+ return false;}#[cfg(test)]let client = if self.config.is_none() {@@ -227,6 +233,7 @@ impl ChannelTurnStateSubscriber {if result.is_err() {tracing::debug!("channel turn status unavailable");}+ result.is_ok()}}#[async_trait]@@ -244,17 +251,21 @@ impl EventHandler<DomainEvent> for ChannelTurnStateSubscriber {reply_target,workspace_dir,..- } => self.mark(channel, reply_target, workspace_dir, true).await,+ } => {+ self.mark(channel, reply_target, workspace_dir, true).await;+ }DomainEvent::ChannelMessageProcessed {channel,reply_target,workspace_dir,..- } => self.mark(channel, reply_target, workspace_dir, false).await,+ } => {+ self.mark(channel, reply_target, workspace_dir, false).await;+ }_ => {}}}}-#[cfg(test)]+#[cfg(all(test, feature = "modules", feature = "e2e-test-support"))]#[path = "channel_events_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/channels/host/channel_events_tests.rs b/crates/openhuman-core/src/channels/host/channel_events_tests.rsindex 9636de0e9c..588da094a6 100644--- a/crates/openhuman-core/src/channels/host/channel_events_tests.rs+++ b/crates/openhuman-core/src/channels/host/channel_events_tests.rs@@ -133,50 +133,18 @@ async fn approvals_for_web_email_or_unrouted_requests_are_ignored() {assert!(discord.sent.lock().unwrap().is_empty());}-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]-async fn turn_state_events_leave_remote_status_idle_after_completion() {+async fn turn_state_accepts_busy_and_idle_updates_for_remote_channels() {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"] {- 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}");+ 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");}}@@ -185,13 +153,20 @@ async fn turn_state_ignores_non_remote_channels_and_stale_workspaces() {let dir = tempdir().unwrap();let ws = dir.path().to_path_buf();let sub = ChannelTurnStateSubscriber::new(ws.clone());- sub.handle(&received("email", "[email protected]", None, &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;- let status = remote_status(&ws, "telegram", "chat-1")- .await- .expect("/status should return a response");- assert!(status.contains("idle"), "{status}");+ 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;+ assert!(+ status,+ "the matching workspace should accept the idle update"+ );}diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rsindex c8b404d866..05ceb3485d 100644--- a/crates/openhuman-core/src/channels/mod.rs+++ b/crates/openhuman-core/src/channels/mod.rs@@ -122,12 +122,7 @@ pub use runtime::start_channels;#[cfg(feature = "channels")]pub(crate) use runtime::{session, start_channels_with_session};-#[cfg(all(- test,- feature = "channels",- feature = "modules",- feature = "e2e-test-support"-))]+#[cfg(all(test, feature = "channels", feature = "modules"))]#[path = "module_fixture_tests.rs"]pub(crate) mod module_fixture;diff --git a/crates/openhuman-core/src/channels/module_fixture_tests.rs b/crates/openhuman-core/src/channels/module_fixture_tests.rsindex 18e265f08e..6f11e8b68e 100644--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs@@ -18,6 +18,7 @@ pub(crate) async fn client() -> ModuleClient {}#[tokio::test]+#[cfg(feature = "e2e-test-support")]async fn released_module_prepares_runtime_limits_over_confidential_bus_call() {use tinychannels_bus::module_control::{ChannelControlRequest, ChannelControlResult};@@ -44,6 +45,7 @@ async fn released_module_prepares_runtime_limits_over_confidential_bus_call() {}#[tokio::test]+#[cfg(feature = "e2e-test-support")]async fn released_module_prepares_legacy_inbound_facts_over_confidential_bus_call() {use tinychannels_bus::module_inbound::{ChannelInboundSource, PrepareChannelInboundRequest, PreparedChannelInbound,diff --git a/crates/openhuman-core/src/modules/ops_tests.rs b/crates/openhuman-core/src/modules/ops_tests.rsindex 1b8d82bbde..d59052d351 100644--- a/crates/openhuman-core/src/modules/ops_tests.rs+++ b/crates/openhuman-core/src/modules/ops_tests.rs@@ -599,6 +599,7 @@ fn status_reports_the_source_that_serves_a_module() {}}+#[cfg(feature = "e2e-test-support")]#[tokio::test]async fn a_pinned_release_module_serves_the_module_and_status_says_so() {use crate::config::schema::ModuleSourceMode;@@ -606,6 +607,7 @@ async fn a_pinned_release_module_serves_the_module_and_status_says_so() {let mut config = Config::default();config.modules.enabled = true;+ config.modules.allow_download = false;config.modules.source = ModuleSourceMode::Release;ops::ensure_loaded(&config, "tinychannels").awaitdiff --git a/scripts/__tests__/e2e-web-bundle-guard.test.mjs b/scripts/__tests__/e2e-web-bundle-guard.test.mjsindex 3ba79f1aa4..33a2b4cf90 100644--- a/scripts/__tests__/e2e-web-bundle-guard.test.mjs+++ b/scripts/__tests__/e2e-web-bundle-guard.test.mjs@@ -200,6 +200,34 @@ test("an explicit workspace requires its own keyring key", () => {}});+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 --git a/scripts/__tests__/publish-updater-manifest.test.mjs b/scripts/__tests__/publish-updater-manifest.test.mjsindex 0ec5eef59b..3fe04fb92a 100644--- a/scripts/__tests__/publish-updater-manifest.test.mjs+++ b/scripts/__tests__/publish-updater-manifest.test.mjs@@ -22,6 +22,7 @@ const script = resolve(dirname(fileURLToPath(import.meta.url)),"../release/publish-updater-manifest.sh",);+const jqAvailable = spawnSync("jq", ["--version"], { encoding: "utf8" }).status === 0;const ASSETS = ["OpenHuman_0.64.1_aarch64.app.tar.gz",@@ -75,7 +76,7 @@ esac}}-test("manifest advertises both NSIS and MSI updater bundles for windows-x86_64", () => {+test("manifest advertises both NSIS and MSI updater bundles for windows-x86_64", { skip: !jqAvailable }, () => {const { res, manifest } = run(ASSETS);assert.equal(res.status, 0, res.stderr);assert.match(manifest.platforms["windows-x86_64"].url, /x64-setup\.exe$/);@@ -86,7 +87,7 @@ test("manifest advertises both NSIS and MSI updater bundles for windows-x86_64",);});-test("publishing is refused when the MSI updater bundle is missing", () => {+test("publishing is refused when the MSI updater bundle is missing", { skip: !jqAvailable }, () => {const { res, manifest } = run(ASSETS.filter((a) => !a.endsWith(".msi")));assert.notEqual(res.status, 0);assert.match(res.stderr, /windows-x86_64-msi/);diff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.shindex e732abd7c3..c291e6b259 100755--- a/scripts/test-rust-with-mock.sh+++ b/scripts/test-rust-with-mock.sh@@ -311,6 +311,13 @@ run_tinychannels_release_fixture_tests() {OPENHUMAN_MODULE_PATH="$tinychannels_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \cargo_test --features e2e-test-support --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 \+ -- --exact --test-threads=1 "$@"+ OPENHUMAN_MODULE_PATH="$tinychannels_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \+ cargo_test --features e2e-test-support --lib \+ channels::host::channel_events::tests:: -- --test-threads=1 "$@"}run_full_suite() {