Skip to content

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

test: harden debug RPC, i18n, and AppImage runtime tests

Steven Enamakeleab1c86f9ab9
diff --git a/scripts/__tests__/debug-web-ui.test.mjs b/scripts/__tests__/debug-web-ui.test.mjs
index bd20bbea23..dcc84b30bb 100644
--- a/scripts/__tests__/debug-web-ui.test.mjs
+++ b/scripts/__tests__/debug-web-ui.test.mjs
@@ -1,4 +1,5 @@
import assert from "node:assert/strict";
+import { createServer } from "node:http";
import net from "node:net";
import test from "node:test";
@@ -103,26 +104,27 @@ test("ensureSignedInChat propagates its bounded composer wait failure", async ()
});
test("core RPC client bounds a stalled request and propagates its timeout", async () => {
- let signal;
- const hangingFetch = (_url, init) => {
- signal = init.signal;
- return new Promise((_resolve, reject) => {
- signal.addEventListener("abort", () => reject(signal.reason), {
- once: true,
- });
- });
- };
+ const server = createServer(() => {});
+ await new Promise((resolve, reject) => {
+ server.once("error", reject);
+ server.listen(0, "127.0.0.1", resolve);
+ });
+
+ const { port } = server.address();
const rpc = createCoreRpcClient(
- "http://127.0.0.1:7788/rpc",
+ `http://127.0.0.1:${port}/rpc`,
"test-token",
- hangingFetch,
+ fetch,
5,
);
-
- await assert.rejects(rpc("openhuman.auth_get_state"), {
- name: "TimeoutError",
- });
- assert.equal(signal.aborted, true);
+ try {
+ await assert.rejects(rpc("openhuman.auth_get_state"), {
+ name: "TimeoutError",
+ });
+ } finally {
+ server.closeAllConnections();
+ await new Promise((resolve) => server.close(resolve));
+ }
});
test("coreLaunchSpec isolates the core from operator credentials, storage, and dotenv", () => {
diff --git a/scripts/__tests__/i18n-coverage.test.mjs b/scripts/__tests__/i18n-coverage.test.mjs
index dd288b0fdb..d68c3afbdb 100644
--- a/scripts/__tests__/i18n-coverage.test.mjs
+++ b/scripts/__tests__/i18n-coverage.test.mjs
@@ -22,14 +22,17 @@ test("core chat failure keys are used even though the UI translates them dynamic
closeSync(reportFd);
rmSync(directory, { recursive: true, force: true });
}
- const table = readFileSync(
+ const failureCopySources = [
"crates/openhuman-core/src/inference/failure_copy/table.rs",
- "utf8",
- );
- const keys = [...table.matchAll(/"(chat_error\.[a-z_]+)"/g)].map(
- (match) => match[1],
+ "vendor/tinyagents/vendor/tinyinference/crates/tinyinference-llm/src/failure/copy.rs",
+ ];
+ const keys = failureCopySources.flatMap((source) =>
+ [...readFileSync(source, "utf8").matchAll(/"(chat_error\.[a-z_]+)"/g)].map(
+ (match) => match[1],
+ ),
);
assert.ok(keys.length >= 28);
+ assert.equal(new Set(keys).size, keys.length, "failure-copy keys must be unique");
assert.deepEqual(
keys.filter((key) => report.unusedKeys.includes(key)),
[],
diff --git a/scripts/__tests__/validate-appimage-runtime.test.mjs b/scripts/__tests__/validate-appimage-runtime.test.mjs
index dcede8b06c..e40a1f8d41 100644
--- a/scripts/__tests__/validate-appimage-runtime.test.mjs
+++ b/scripts/__tests__/validate-appimage-runtime.test.mjs
@@ -66,11 +66,16 @@ function makeLinuxdeployAppDir() {
"#! /usr/bin/env bash",
"set -e",
'this_dir="$(readlink -f "$(dirname "$0")")"',
+ 'source "$this_dir"/apprun-hooks/"openhuman-system-webkit.sh"',
'source "$this_dir"/apprun-hooks/linuxdeploy-plugin-gtk.sh',
'exec "$this_dir"/AppRun.wrapped "$@"',
"",
].join("\n"),
);
+ script(
+ join(app, "apprun-hooks/openhuman-system-webkit.sh"),
+ "OPENHUMAN_BUNDLED_WEBKIT='libwebkit2gtk-4.1.so.0.4.1'\n",
+ );
script(join(app, "apprun-hooks/linuxdeploy-plugin-gtk.sh"), "#!/bin/sh\n");
elf(join(app, "AppRun.wrapped"));
elf(join(app, "usr/bin/OpenHuman"));
@@ -214,6 +219,14 @@ const MUTATIONS = [
"an apprun hook is not sourced by AppRun",
(a) => script(join(a, "apprun-hooks/orphan.sh"), "#!/bin/sh\n"),
],
+ [
+ "the system WebKit hook has no versioned bundled library stamp",
+ (a) =>
+ script(
+ join(a, "apprun-hooks/openhuman-system-webkit.sh"),
+ "OPENHUMAN_BUNDLED_WEBKIT='libwebkit2gtk-4.1.so.0'\n",
+ ),
+ ],
[
"the desktop entry has no Exec=",
(a) => {