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
chore(ci): serialize json-rpc and mcp-registry e2e suites
Steven Enamakel76f9379676b8
diff --git a/.config/nextest.toml b/.config/nextest.tomlindex cc4b5de46b..f29d6191c6 100644--- a/.config/nextest.toml+++ b/.config/nextest.toml@@ -20,7 +20,19 @@ final-status-level = "fail"# a separate process.[test-groups]agent-harness-e2e = { max-threads = 1 }+json-rpc-e2e = { max-threads = 1 }+mcp-registry = { max-threads = 1 }[[profile.ci.overrides]]filter = 'binary(=agent_harness_e2e)'test-group = 'agent-harness-e2e'++# RPC bootstrap writes a fixed temporary token path across processes. Retain+# the original serial contract of both resource-sensitive integration suites.+[[profile.ci.overrides]]+filter = 'binary(=json_rpc_e2e)'+test-group = 'json-rpc-e2e'++[[profile.ci.overrides]]+filter = 'binary(=mcp_registry_multi_server)'+test-group = 'mcp-registry'diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjsindex dca2e20189..5e9c7e5d25 100644--- a/scripts/__tests__/self-hosted-lanes.test.mjs+++ b/scripts/__tests__/self-hosted-lanes.test.mjs@@ -46,7 +46,10 @@ const NONE = Object.fromEntries(Object.keys(AREA_ENV).map((k) => [k, false]));const EX63_ENV = { CI_SCRATCH_DIR: "/scratch" };test("EX63 verifies preinstalled tools before cache setup and validation", () => {- const privateJob = ciLanes.slice(ciLanes.indexOf(" ex63:"), ciLanes.indexOf(" plan:"));+ const privateJob = ciLanes.slice(+ ciLanes.indexOf(" ex63:"),+ ciLanes.indexOf(" plan:"),+ );const verify = privateJob.indexOf("- name: Verify private runner contract");const cache = privateJob.indexOf("- name: Setup Tinymold");const detect = privateJob.indexOf("- name: Detect changed areas");@@ -366,21 +369,37 @@ test("hosted matrix only spins up groups with active lanes", () => {test("private lanes reuse checkout targets, preserve mold through RUSTFLAGS resets, and omit wrappers", () => {const plan = buildPlan({ profile: "ex63", areas: ALL, env: EX63_ENV });const rust = plan.lanes.filter((l) => l.heavy != null);- assert.equal(new Set(rust.filter((l) => l.name !== "rust-cov").map((l) => l.targetDir)).size, 1);+ assert.equal(+ new Set(rust.filter((l) => l.name !== "rust-cov").map((l) => l.targetDir))+ .size,+ 1,+ );for (const lane of rust) {assert.match(lane.targetDir, /^target\/ci-private-/);- assert.equal(lane.env.CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER, "/usr/local/bin/rust-mold-linker");+ assert.equal(+ lane.env.CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER,+ "/usr/local/bin/rust-mold-linker",+ );assert.equal(lane.env.RUSTC_WRAPPER, undefined);assert.equal(lane.env.RUSTC_WORKSPACE_WRAPPER, undefined);}- assert.notEqual(rust.find((l) => l.name === "rust-cov").targetDir, rust.find((l) => l.name === "rust-lint").targetDir);- assert.ok(buildPlan({ profile: "hosted", areas: ALL }).lanes.every((l) => !l.targetDir));+ assert.notEqual(+ rust.find((l) => l.name === "rust-cov").targetDir,+ rust.find((l) => l.name === "rust-lint").targetDir,+ );+ assert.ok(+ buildPlan({ profile: "hosted", areas: ALL }).lanes.every(+ (l) => !l.targetDir,+ ),+ );});test("private gates-off, storage, and Tauri execute equivalent coverage suites with nextest", () => {const plan = buildPlan({ profile: "ex63", areas: ALL, env: EX63_ENV });for (const name of ["rust-gates-off", "storage-drivers", "tauri"]) {- for (const c of plan.lanes.find((l) => l.name === name).checks.filter((c) => /cargo (test|llvm-cov)/.test(c.run))) {+ for (const c of plan.lanes+ .find((l) => l.name === name)+ .checks.filter((c) => /cargo (test|llvm-cov)/.test(c.run))) {assert.match(c.run, /cargo llvm-cov nextest/);assert.match(c.run, /--no-tests=fail/);assert.match(c.run, /--lcov --output-path ci-out\/lcov\//);@@ -388,23 +407,43 @@ test("private gates-off, storage, and Tauri execute equivalent coverage suites wassert.match(c.run, /exit "\$rc"$/);}}- const checks = Object.fromEntries(plan.lanes.flatMap((l) => l.checks.map((c) => [c.name, c])));- assert.match(checks["gate-contract-tests-features"].run, /--features modules,mcp,e2e-test-support/);+ const checks = Object.fromEntries(+ plan.lanes.flatMap((l) => l.checks.map((c) => [c.name, c])),+ );+ assert.match(+ checks["gate-contract-tests-features"].run,+ /--features modules,mcp,e2e-test-support/,+ );assert.match(checks["gate-contract-tests-features"].run, /--test-threads=1/);assert.match(checks["cron-module-tests"].run, /--test-threads=1/);- assert.match(checks["storage-lib-tests"].run, /not test\(cron::bus_host::tests::\)/);- assert.equal(checks["tauri-coverage"].env.CARGO_BUILD_TARGET_DIR, "target/ci-private-coverage");+ assert.match(+ checks["storage-lib-tests"].run,+ /not test\(cron::bus_host::tests::\)/,+ );+ assert.equal(+ checks["tauri-coverage"].env.CARGO_BUILD_TARGET_DIR,+ "target/ci-private-coverage",+ );});test("private auxiliary coverage reports after failed tests and preserves the failure", () => {const dir = fs.mkdtempSync(path.join(os.tmpdir(), "lane-coverage-report-"));const cargo = path.join(dir, "cargo");const calls = path.join(dir, "calls");- fs.writeFileSync(cargo, '#!/bin/sh\necho "$*" >> "$CARGO_CALLS"\nif [ "$2" = nextest ]; then exit 17; fi\nexit 0\n', { mode: 0o755 });+ fs.writeFileSync(+ cargo,+ '#!/bin/sh\necho "$*" >> "$CARGO_CALLS"\nif [ "$2" = nextest ]; then exit 17; fi\nexit 0\n',+ { mode: 0o755 },+ );const plan = buildPlan({ profile: "ex63", areas: ALL, env: EX63_ENV });const check = plan.lanes.find((l) => l.name === "storage-drivers").checks[0];const result = spawnSync("bash", ["-o", "pipefail", "-c", check.run], {- cwd: repoRoot, env: { ...process.env, PATH: `${dir}:${process.env.PATH}`, CARGO_CALLS: calls },+ cwd: repoRoot,+ env: {+ ...process.env,+ PATH: `${dir}:${process.env.PATH}`,+ CARGO_CALLS: calls,+ },});assert.equal(result.status, 17);const commands = fs.readFileSync(calls, "utf8").trim().split("\n");@@ -412,7 +451,10 @@ test("private auxiliary coverage reports after failed tests and preserves the faassert.match(commands[0], /^llvm-cov nextest /);assert.match(commands[1], /^llvm-cov report /);const tauri = plan.lanes.find((l) => l.name === "tauri");- assert.match(tauri.checks.find((c) => c.name === "build-tauri").run, /cargo build .*--bin OpenHuman/);+ assert.match(+ tauri.checks.find((c) => c.name === "build-tauri").run,+ /cargo build .*--bin OpenHuman/,+ );fs.rmSync(dir, { recursive: true, force: true });});@@ -420,18 +462,33 @@ test("private runner serializes independent lanes after failures even when paralconst out = fs.mkdtempSync(path.join(os.tmpdir(), "lanes-private-"));fs.mkdirSync(path.join(out, "logs"));const check = (name, run) => ({ name, run, when: true, needs: [] });- const plan = { profile: "ex63", lanes: [- { name: "first", checks: [check("fails", "exit 1"), check("continues", "echo continued")] },- { name: "second", checks: [check("independent", "echo independent")] },- ] };+ const plan = {+ profile: "ex63",+ lanes: [+ {+ name: "first",+ checks: [+ check("fails", "exit 1"),+ check("continues", "echo continued"),+ ],+ },+ { name: "second", checks: [check("independent", "echo independent")] },+ ],+ };const runner = new Runner(plan, { out, maxParallel: 8 });assert.equal(runner.maxParallel, 1);const lanes = await runner.run();assert.equal(lanes[0].checks[0].status, "failure");assert.equal(lanes[0].checks[1].status, "success");assert.equal(lanes[1].checks[0].status, "success");- assert.ok(Date.parse(lanes[1].checks[0].start) >= Date.parse(lanes[0].checks[1].end));- assert.equal(new Runner({ ...plan, profile: "hosted" }, { out, maxParallel: 8 }).maxParallel, 8);+ assert.ok(+ Date.parse(lanes[1].checks[0].start) >= Date.parse(lanes[0].checks[1].end),+ );+ assert.equal(+ new Runner({ ...plan, profile: "hosted" }, { out, maxParallel: 8 })+ .maxParallel,+ 8,+ );fs.rmSync(out, { recursive: true, force: true });});diff --git a/scripts/ci/nextest-coverage.sh b/scripts/ci/nextest-coverage.shnew file mode 100644index 0000000000..f78b2eb6f4--- /dev/null+++ b/scripts/ci/nextest-coverage.sh@@ -0,0 +1,32 @@+#!/usr/bin/env bash+# One durable JUnit report and count inventory per instrumented configuration.+set -euo pipefail+suite="$1"+shift+case "$suite" in '' | *[!a-zA-Z0-9._-]*) echo 'invalid nextest suite name' >&2; exit 64 ;; esac+report_dir="${NEXTEST_REPORT_DIR:-${PWD}/ci-out/nextest}"+mkdir -p "$report_dir"+report_dir="$(cd "$report_dir" && pwd)"+config="${report_dir}/${suite}.toml"+report="${report_dir}/${suite}.xml"+# Absolute paths keep reports out of the compiler target tree and survive its+# cleanup. A fresh config retains the repository's timeouts/resource groups.+node - "$config" "$report" <<'JS'+const fs = require('node:fs');+const [config, report] = process.argv.slice(2);+fs.writeFileSync(config, fs.readFileSync('.config/nextest.toml', 'utf8') + '\n[profile.ci.junit]\npath = ' + JSON.stringify(report) + '\n');+JS+rm -f "$report" "${report_dir}/${suite}.json"+args=()+for arg in "$@"; do+ args+=("$arg")+ if [ "$arg" = nextest ]; then args+=(--config-file "$config"); fi+done+rc=0+bash scripts/ci-cancel-aware.sh "${args[@]}" || rc=$?+report_rc=0+node scripts/ci/nextest-report.mjs "$report" "${report_dir}/${suite}.json" ${NEXTEST_EXPECTED_TARGETS:+"${NEXTEST_EXPECTED_TARGETS}"} || report_rc=$?+# A report/inventory failure must not hide the test runner's actual failure or+# cancellation. Successful executions must also produce nonempty reports.+[ "$rc" != 0 ] || rc="$report_rc"+exit "$rc"diff --git a/scripts/ci/nextest-report.mjs b/scripts/ci/nextest-report.mjsnew file mode 100644index 0000000000..c05d97dc60--- /dev/null+++ b/scripts/ci/nextest-report.mjs@@ -0,0 +1,21 @@+#!/usr/bin/env node+// Consume nextest's JUnit vocabulary; retain counts before checking inventory.+import fs from "node:fs";++const [report, output, expectedFile] = process.argv.slice(2);+const xml = fs.readFileSync(report, "utf8");+const decode = (value) => value.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");+const suites = [...xml.matchAll(/<testsuite\s+([^>]+)>/g)].map((match) => {+ const attributes = Object.fromEntries([...match[1].matchAll(/([\w-]+)="([^"]*)"/g)].map((entry) => [entry[1], decode(entry[2])]));+ return { name: attributes.name, tests: Number(attributes.tests ?? 0), failures: Number(attributes.failures ?? 0), errors: Number(attributes.errors ?? 0), skipped: Number(attributes.skipped ?? 0) };+});+const counts = { tests: 0, failures: 0, errors: 0, skipped: 0, suites };+for (const suite of suites) for (const key of ["tests", "failures", "errors", "skipped"]) counts[key] += suite[key];+fs.writeFileSync(output, `${JSON.stringify(counts, null, 2)}\n`);+console.log(`[ci][nextest] ${report}: ${counts.tests} tests, ${counts.failures} failures, ${counts.errors} errors, ${counts.skipped} skipped`);+const expected = expectedFile ? fs.readFileSync(expectedFile, "utf8").split(/\r?\n/).filter(Boolean) : [];+const missing = expected.filter((target) => !suites.some((suite) => (suite.name === target || suite.name?.endsWith(`::${target}`)) && suite.tests > 0));+if (counts.tests === 0 || missing.length > 0) {+ console.error(`[ci][nextest] expected nonempty suites; missing/empty: ${missing.join(", ") || "entire selection"}`);+ process.exitCode = 1;+}diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjsindex 93c458ba15..9dac06f8bb 100644--- a/scripts/ci/self-hosted/lanes-plan.mjs+++ b/scripts/ci/self-hosted/lanes-plan.mjs@@ -136,16 +136,18 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {// Private lanes run sequentially and share compatible build products.// Instrumented objects stay separate from ordinary build/link checks.- const targetDir = (lane) => ex63- ? `target/ci-private-${lane === "cov" ? "coverage" : "build"}`- : null;- const rustEnv = ex63 ? {- CARGO_INCREMENTAL: "0",- CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: "/usr/local/bin/rust-mold-linker",- } : {- CARGO_INCREMENTAL: "0",- RUSTFLAGS: "-C link-arg=-fuse-ld=mold",- };+ const targetDir = (lane) =>+ ex63 ? `target/ci-private-${lane === "cov" ? "coverage" : "build"}` : null;+ const rustEnv = ex63+ ? {+ CARGO_INCREMENTAL: "0",+ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER:+ "/usr/local/bin/rust-mold-linker",+ }+ : {+ CARGO_INCREMENTAL: "0",+ RUSTFLAGS: "-C link-arg=-fuse-ld=mold",+ };const covEnv = {...rustEnv,CARGO_PROFILE_DEV_DEBUG: "0",@@ -593,7 +595,9 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {if (!["rust-gates-off", "storage-drivers"].includes(lane.name)) continue;for (const check of lane.checks) {if (!check.run.startsWith("cargo test ")) continue;- const [cargoArgs, filters] = check.run.slice("cargo test ".length).split(" -- ");+ const [cargoArgs, filters] = check.run+ .slice("cargo test ".length)+ .split(" -- ");let args = cargoArgs.replace("--no-fail-fast ", "");let expression = "";let serial = "";@@ -603,14 +607,21 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {const tokens = filters.trim().split(/\s+/);for (let i = 0; i < tokens.length; i++) {if (tokens[i] === "--skip") exclude.push(tokens[++i]);- else if (tokens[i] === "--test-threads=1") serial = " --test-threads=1";+ else if (tokens[i] === "--test-threads=1")+ serial = " --test-threads=1";else include.push(tokens[i]);}const terms = include.map((f) => `test(${f})`).join(" | ");expression = ` -E '${terms ? `(${terms})` : "all()"}${exclude.map((f) => ` & not test(${f})`).join("")}'`;}- check.env = { ...covEnv, CARGO_BUILD_TARGET_DIR: "target/ci-private-coverage" };- check.run = coverageSuite(`${args}${expression}${serial}`, `lcov-${check.name}.info`);+ check.env = {+ ...covEnv,+ CARGO_BUILD_TARGET_DIR: "target/ci-private-coverage",+ };+ check.run = coverageSuite(+ `${args}${expression}${serial}`,+ `lcov-${check.name}.info`,+ );}}const tauriLane = lanes.find((l) => l.name === "tauri");@@ -622,8 +633,17 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {run: "bash scripts/ci-cancel-aware.sh cargo build --manifest-path crates/openhuman-app/Cargo.toml --bin OpenHuman",});const tauri = tauriLane.checks.find((c) => c.name === "tauri-coverage");- tauri.env = { ...covEnv, CARGO_BUILD_TARGET_DIR: "target/ci-private-coverage" };- tauri.run = "unset RUSTFLAGS; " + coverageSuite("--manifest-path crates/openhuman-app/Cargo.toml", "lcov-tauri.info", "crates/openhuman-app/Cargo.toml");+ tauri.env = {+ ...covEnv,+ CARGO_BUILD_TARGET_DIR: "target/ci-private-coverage",+ };+ tauri.run =+ "unset RUSTFLAGS; " ++ coverageSuite(+ "--manifest-path crates/openhuman-app/Cargo.toml",+ "lcov-tauri.info",+ "crates/openhuman-app/Cargo.toml",+ );}for (const lane of lanes) {diff --git a/scripts/ci/self-hosted/lanes.mjs b/scripts/ci/self-hosted/lanes.mjsindex 4f827ddbfc..b79649099c 100644--- a/scripts/ci/self-hosted/lanes.mjs+++ b/scripts/ci/self-hosted/lanes.mjs@@ -291,7 +291,12 @@ export class Runner {constructor(plan, { out, maxParallel, maxHeavy = Infinity }) {this.plan = plan;this.out = out;- this.maxParallel = plan.profile === "ex63" ? 1 : maxParallel > 0 ? maxParallel : plan.lanes.length;+ this.maxParallel =+ plan.profile === "ex63"+ ? 1+ : maxParallel > 0+ ? maxParallel+ : plan.lanes.length;this.heavy = new PrioritySemaphore(maxHeavy);this.maxHeavy = maxHeavy;// check id -> { pgid, peakRssMiB } while running; sampled every 5 s.@@ -351,7 +356,8 @@ export class Runner {runCommand(lane, check, logStream, record) {const env = { ...process.env, ...(lane.env ?? {}), ...(check.env ?? {}) };if (lane.targetDir) {- env.CARGO_BUILD_TARGET_DIR = check.env?.CARGO_BUILD_TARGET_DIR ?? lane.targetDir;+ env.CARGO_BUILD_TARGET_DIR =+ check.env?.CARGO_BUILD_TARGET_DIR ?? lane.targetDir;delete env.CARGO_TARGET_DIR;mkdirSync(lane.targetDir, { recursive: true });}@@ -774,7 +780,7 @@ async function main() {runner: process.env.RUNNER_NAME ?? null,areas,lanes,-+heavySlots: Number.isFinite(maxHeavy) ? maxHeavy : null,memory: runner.memory,cacheBytes: du(process.env.CI_CACHE_DIR),