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 E2E review findings
Steven Enamakeld722de6345db
diff --git a/app/scripts/e2e-web-session.sh b/app/scripts/e2e-web-session.shindex 99ae274fc8..df5f6cd555 100755--- a/app/scripts/e2e-web-session.sh+++ b/app/scripts/e2e-web-session.sh@@ -20,14 +20,25 @@ PW_CORE_RPC_TOKEN="${PW_CORE_RPC_TOKEN:-openhuman-playwright-token}"PW_CORE_RPC_URL="http://127.0.0.1:${OPENHUMAN_CORE_PORT}/rpc"PW_BASE_URL="http://127.0.0.1:${E2E_WEB_PORT}"-OPENHUMAN_WORKSPACE="${OPENHUMAN_WORKSPACE:-$(mktemp -d)}"+E2E_WEB_WORKSPACE_EXPLICIT="${OPENHUMAN_WORKSPACE:+1}"CREATED_TEMP_WORKSPACE=""-if [ ! -d "${OPENHUMAN_WORKSPACE}" ] || [[ "${OPENHUMAN_WORKSPACE}" == /tmp/* ]]; then+if [ -z "$E2E_WEB_WORKSPACE_EXPLICIT" ]; then+ OPENHUMAN_WORKSPACE="$(mktemp -d)"CREATED_TEMP_WORKSPACE="$OPENHUMAN_WORKSPACE"fiexport OPENHUMAN_WORKSPACEexport OPENHUMAN_KEYRING_BACKEND="${OPENHUMAN_KEYRING_BACKEND:-file}"-export OPENHUMAN_KEYRING_MASTER_KEY="${OPENHUMAN_KEYRING_MASTER_KEY:-$(printf '55%.0s' $(seq 1 32))}"+if [ -n "$E2E_WEB_WORKSPACE_EXPLICIT" ]; then+ if [ -z "${OPENHUMAN_KEYRING_MASTER_KEY:-}" ] &&+ [ -z "${OPENHUMAN_KEYRING_MASTER_KEY_FILE:-}" ]; then+ echo "ERROR: an explicit OPENHUMAN_WORKSPACE requires OPENHUMAN_KEYRING_MASTER_KEY or OPENHUMAN_KEYRING_MASTER_KEY_FILE." >&2+ exit 2+ fi+else+ # A disposable workspace must not accidentally inherit a key-file path+ # outside the test tree from the developer or runner environment.+ unset OPENHUMAN_KEYRING_MASTER_KEY_FILE+fiMOCK_PID=""CORE_PID=""@@ -275,6 +286,11 @@ if [ -n "$STALE_SOURCE" ]; thenexit 1fi+if [ -z "${OPENHUMAN_KEYRING_MASTER_KEY:-}" ] &&+ [ -z "${OPENHUMAN_KEYRING_MASTER_KEY_FILE:-}" ]; then+ export OPENHUMAN_KEYRING_MASTER_KEY="$(node -e 'process.stdout.write(require("node:crypto").randomBytes(32).toString("hex"))')"+fi+export OPENHUMAN_CORE_BIN="$E2E_WEB_CORE_TARGET_DIR/debug/openhuman-core"if [ ! -x "$OPENHUMAN_CORE_BIN" ]; thenecho "ERROR: standalone core binary is missing at $OPENHUMAN_CORE_BIN. Run pnpm --filter openhuman-app test:e2e:web:build first." >&2diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.tomlindex 634adc6d96..040d1e98d5 100644--- a/crates/openhuman-cli/Cargo.toml+++ b/crates/openhuman-cli/Cargo.toml@@ -235,11 +235,11 @@ required-features = ["storage-sqlite", "modules"][[test]]# The released TinyMCP cdylib under the real host: add a server, restart the-# core, list it (#7737). Ignored without a staged module; the Rust e2e runner-# stages the registry-pinned release and runs it.+# core, list it (#7737). Its opt-in `e2e-test-support` feature is set by the+# Rust e2e runners after they stage the registry-pinned TinyMCP release.name = "tinymcp_storage_smoke_e2e"path = "../../tests/tinymcp_storage_smoke_e2e.rs"-required-features = ["storage-sqlite", "modules", "mcp"]+required-features = ["storage-sqlite", "modules", "mcp", "e2e-test-support"][[test]]name = "saas_mode_e2e"diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rsindex 05ceb3485d..c8b404d866 100644--- a/crates/openhuman-core/src/channels/mod.rs+++ b/crates/openhuman-core/src/channels/mod.rs@@ -122,7 +122,12 @@ pub use runtime::start_channels;#[cfg(feature = "channels")]pub(crate) use runtime::{session, start_channels_with_session};-#[cfg(all(test, feature = "channels", feature = "modules"))]+#[cfg(all(+ test,+ feature = "channels",+ feature = "modules",+ feature = "e2e-test-support"+))]#[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 3c82b6aec8..18e265f08e 100644--- a/crates/openhuman-core/src/channels/module_fixture_tests.rs+++ b/crates/openhuman-core/src/channels/module_fixture_tests.rs@@ -13,6 +13,7 @@ use tinychannels_bus::methods;pub(crate) async fn client() -> ModuleClient {let mut config = Config::default();config.modules.enabled = true;+ config.modules.allow_download = false;ModuleClient::new(config)}diff --git a/scripts/__tests__/e2e-web-bundle-guard.test.mjs b/scripts/__tests__/e2e-web-bundle-guard.test.mjsindex 44951ea635..3ba79f1aa4 100644--- a/scripts/__tests__/e2e-web-bundle-guard.test.mjs+++ b/scripts/__tests__/e2e-web-bundle-guard.test.mjs@@ -72,7 +72,14 @@ function makeTree(script) {// reporting ready; otherwise a fast runner can race the child process.writeExecutable(path.join(bin, "node"),- `#!/usr/bin/env bash\n${record("node")}\ntouch "${mockStarted}"\n`,+ `#!/usr/bin/env bash+${record("node")}+if [[ "$*" == *"randomBytes"* ]]; then+ printf '%064d' 0+else+ touch "${mockStarted}"+fi+`,);writeExecutable(path.join(bin, "curl"),@@ -123,7 +130,7 @@ fireturn { root, bin, calls, cleanup };}-function run(tree, script) {+function run(tree, script, extraEnv = {}) {const env = {...process.env,PATH: `${tree.bin}:${process.env.PATH}`,@@ -134,7 +141,9 @@ function run(tree, script) {OPENHUMAN_CORE_PORT: "17788",RUST_HOST_TRIPLE: "test-triple",OPENHUMAN_WORKSPACE: path.join(tree.root, "workspace"),+ OPENHUMAN_KEYRING_MASTER_KEY: "11".repeat(32),E2E_WEB_CORE_TARGET_DIR: path.join(tree.root, "target"),+ ...extraEnv,};const file = path.join(tree.root, "app", "scripts", script);try {@@ -173,6 +182,24 @@ test("the session refuses a dist-web that e2e-web-build.sh did not produce", ()}});+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_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("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 — the@@ -187,10 +214,18 @@ test("the session accepts a marked bundle and proceeds past the guard", () => {'{"e2e_mock_port":"18473","openhuman_core_port":"17788"}\n',);- const res = run(tree, "e2e-web-session.sh");+ const res = run(tree, "e2e-web-session.sh", {+ OPENHUMAN_WORKSPACE: "",+ OPENHUMAN_KEYRING_MASTER_KEY: "",+ OPENHUMAN_KEYRING_MASTER_KEY_FILE: "/host/master.key",+ });assert.doesNotMatch(res.output, /was not built for E2E/);assert.match(res.output, /standalone core binary is missing/);+ assert.ok(+ tree.calls().some((call) => call.includes("randomBytes")),+ "a disposable workspace gets a fresh key",+ );assert.ok(tree.calls().some((c) => c.includes("mock-api-server.mjs")),`expected the mock backend to be started:\n${tree.calls().join("\n")}`,diff --git a/scripts/__tests__/e2e-web-ports.test.mjs b/scripts/__tests__/e2e-web-ports.test.mjsindex cd3542632c..3e3b465bc5 100644--- a/scripts/__tests__/e2e-web-ports.test.mjs+++ b/scripts/__tests__/e2e-web-ports.test.mjs@@ -61,7 +61,15 @@ function makeTree() {// The mock backend "starts" and exits at once, so the health probe waits for// the stub to record the launch rather than racing the child process.- writeExecutable(path.join(bin, "node"), `#!/usr/bin/env bash\n${record("node")}\n`);+ writeExecutable(+ path.join(bin, "node"),+ `#!/usr/bin/env bash+${record("node")}+if [[ "$*" == *"randomBytes"* ]]; then+ printf '%064d' 0+fi+`,+ );writeExecutable(path.join(bin, "curl"),`#!/usr/bin/env bash@@ -166,6 +174,7 @@ function run(tree, script, env = {}) {CARGO_BIN: path.join(tree.bin, "cargo"),RUST_HOST_TRIPLE: "test-triple",OPENHUMAN_WORKSPACE: path.join(tree.root, "workspace"),+ OPENHUMAN_KEYRING_MASTER_KEY: "11".repeat(32),E2E_WEB_CORE_TARGET_DIR: path.join(tree.root, "target"),// Deliberately unset so each test states the ports it is exercising;// a developer's shell must not choose them.diff --git a/scripts/e2e-core.sh b/scripts/e2e-core.shindex 70e7ba8f72..518b7f574f 100755--- a/scripts/e2e-core.sh+++ b/scripts/e2e-core.sh@@ -102,5 +102,5 @@ export RUST_MIN_STACK="${RUST_MIN_STACK:-16777216}"cd "$REPO_ROOT"features="$(bash "$SCRIPT_DIR/ci/product-features.sh")$extra_features"bash "$SCRIPT_DIR/ci-cancel-aware.sh" cargo test -p openhuman-cli \- --features "$features" --test tinymcp_storage_smoke_e2e -- \- --ignored --test-threads=1 "$@"+ --features "$features,e2e-test-support" --test tinymcp_storage_smoke_e2e -- \+ --test-threads=1 "$@"diff --git a/scripts/test-rust-e2e.sh b/scripts/test-rust-e2e.shindex 86dff53edc..98fe6fe23e 100755--- a/scripts/test-rust-e2e.sh+++ b/scripts/test-rust-e2e.sh@@ -287,24 +287,12 @@ for suite in "${SUITES[@]}"; dofiif [ "$suite" = "tinymcp_storage_smoke_e2e" ]; then# Released TinyMCP cdylib under the real host and its storage backend- # (#7737). Ignored in a bare `cargo test` because it needs the staged- # module; the staging above put it on OPENHUMAN_MODULE_PATH. It spawns+ # (#7737). The staging above put it on OPENHUMAN_MODULE_PATH. It spawns# openhuman-core twice, so run it serially.- echo "[rust-e2e] $CARGO_BIN test --manifest-path Cargo.toml --test $suite (--ignored, serial)"- bash "$SCRIPT_DIR/ci-cancel-aware.sh" "$CARGO_BIN" test \- --manifest-path Cargo.toml --features "$PRODUCT_FEATURES" \- --test "$suite" -- --ignored --test-threads=1 ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"}- continue- fi- if [ "$suite" = "tinymcp_storage_smoke_e2e" ]; then- # Released TinyMCP cdylib under the real host and its storage backend- # (#7737). Ignored in a bare `cargo test` because it needs the staged- # module; the staging above put it on OPENHUMAN_MODULE_PATH. It spawns- # openhuman-core twice, so run it serially.- echo "[rust-e2e] $CARGO_BIN test --manifest-path Cargo.toml --test $suite (--ignored, serial)"+ echo "[rust-e2e] $CARGO_BIN test --manifest-path Cargo.toml --test $suite (serial)"bash "$SCRIPT_DIR/ci-cancel-aware.sh" "$CARGO_BIN" test \- --manifest-path Cargo.toml --features "$PRODUCT_FEATURES" \- --test "$suite" -- --ignored --test-threads=1 ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"}+ --manifest-path Cargo.toml --features "$PRODUCT_FEATURES,e2e-test-support" \+ --test "$suite" -- --test-threads=1 ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"}continuefiif [ "$suite" = "tinydocs_linked_e2e" ]; thendiff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.shindex f2a836163c..e732abd7c3 100755--- a/scripts/test-rust-with-mock.sh+++ b/scripts/test-rust-with-mock.sh@@ -92,6 +92,9 @@ if local_module_source_is_source; thenelsefor released_id in tinychannels tinyjuice tinysearch; doreleased_dir="$(stage_release_module "$released_id" "$wallet_platform" "$module_ext")"+ if [ "$released_id" = "tinychannels" ]; then+ tinychannels_dir="$released_dir"+ fiexport OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"donefi@@ -101,6 +104,7 @@ fi# module currently requires TinyBus 0.1.4 while this host pins 0.1.3.if local_module_source_is_source; thenreleased_dir="$(stage_release_module tinychannels "$wallet_platform" "$module_ext")"+ tinychannels_dir="$released_dir"export OPENHUMAN_MODULE_PATH="$released_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}"fi@@ -300,6 +304,15 @@ 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.+ OPENHUMAN_MODULE_PATH="$tinychannels_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \+ cargo_test --features e2e-test-support --lib channels::module_fixture:: \+ -- --test-threads=1 "$@"+}+run_full_suite() {# Several unit fixtures mutate process-wide state (provider overrides and# temporary executable paths). Keep this aggregate invocation deterministic;@@ -311,6 +324,7 @@ run_full_suite() {# `--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 "$@"cargo_test --doc -- "$@"while IFS= read -r target; do@@ -331,7 +345,7 @@ run_full_suite() {run_json_rpc_e2e "$@"elif [ "$target" = "tinymcp_storage_smoke_e2e" ]; thenOPENHUMAN_MODULE_PATH="$tinymcp_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \- cargo_test --test "$target" -- "$@"+ cargo_test --features e2e-test-support --test "$target" -- "$@"elif [ "$target" = "mcp_registry_e2e" ]; then# The TinyMCP module owns process-level directory transitions; this# binary exercises several workspaces against that shared module object.@@ -393,7 +407,7 @@ elif [ "$#" -ge 2 ] && [ "$1" = "--test" ] && [ "$2" = "tinymcp_storage_smoke_e2shiftfiOPENHUMAN_MODULE_PATH="$tinymcp_dir${OPENHUMAN_MODULE_PATH:+:$OPENHUMAN_MODULE_PATH}" \- cargo_test --test tinymcp_storage_smoke_e2e -- "$@"+ cargo_test --features e2e-test-support --test tinymcp_storage_smoke_e2e -- "$@"elif [ "$#" -ge 2 ] && [ "$1" = "--test" ] && [ "$2" = "mcp_registry_multi_server" ]; thenshift 2if [ "${1:-}" = "--" ]; thendiff --git a/tests/tinymcp_storage_smoke_e2e.rs b/tests/tinymcp_storage_smoke_e2e.rsindex 082b67414d..eb780309a1 100644--- a/tests/tinymcp_storage_smoke_e2e.rs+++ b/tests/tinymcp_storage_smoke_e2e.rs@@ -15,9 +15,10 @@//!//! Needs a released TinyMCP library on `OPENHUMAN_MODULE_PATH` (the runner,//! `scripts/test-rust-e2e.sh`, stages the registry-pinned release) or a build-//! from `scripts/modules/build.mjs tinymcp`, so it is ignored in a bare-//! `cargo test`. Nothing here reaches the network: the server is a stub that is-//! added disabled and never dialled.+//! from `scripts/modules/build.mjs tinymcp`, so the target is opt-in via+//! `e2e-test-support` rather than included in a bare `cargo test`. Nothing here+//! reaches the network: the server is a stub that is added disabled and never+//! dialled.#![cfg(all(feature = "mcp", feature = "modules", feature = "storage-sqlite"))]