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(modules): harden boundary auditing and pre-core reporting
Steven Enamakel011cb148f87e
diff --git a/.github/ci-paths-filter.yml b/.github/ci-paths-filter.ymlindex 5da78fa8e7..f7b7c8dbf2 100644--- a/.github/ci-paths-filter.yml+++ b/.github/ci-paths-filter.yml@@ -129,6 +129,8 @@ scripts:- '.github/workflows/ci-*.yml'- '.github/ci-paths-filter.yml'- 'scripts/ci/self-hosted/**'+ - 'scripts/ci/check-module-boundaries.mjs'+ - 'scripts/ci/module-boundaries.json'- 'scripts/mock-api/**'- 'scripts/*.mjs'- 'scripts/__tests__/**'diff --git a/crates/openhuman-core/src/modules/failure.rs b/crates/openhuman-core/src/modules/failure.rsindex 81a5894649..301a58640a 100644--- a/crates/openhuman-core/src/modules/failure.rs+++ b/crates/openhuman-core/src/modules/failure.rs@@ -45,14 +45,6 @@ impl Reason {/// is bounded. Concurrent callers cannot duplicate the same terminal report.pub(super) fn report(record: &'static ModuleRecord, reason: Reason) {static REPORTED: OnceLock<Mutex<HashSet<(&'static str, Reason)>>> = OnceLock::new();- let first = REPORTED- .get_or_init(|| Mutex::new(HashSet::new()))- .lock()- .unwrap_or_else(std::sync::PoisonError::into_inner)- .insert((record.id, reason));- if !first {- return;- }let platform = format!("{}-{}", std::env::consts::OS, std::env::consts::ARCH);let capture = || {crate::core::observability::report_error(@@ -68,6 +60,22 @@ pub(super) fn report(record: &'static ModuleRecord, reason: Reason) {],)};+ // Pre-core embedders may call before Sentry is initialized. Do not spend+ // the process deduplication key on an event no bound client can receive.+ #[cfg(feature = "crash-reporting")]+ let retain_key = sentry::Hub::current().client().is_some();+ #[cfg(not(feature = "crash-reporting"))]+ let retain_key = true;+ if retain_key {+ let first = REPORTED+ .get_or_init(|| Mutex::new(HashSet::new()))+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .insert((record.id, reason));+ if !first {+ return;+ }+ }// A host may have put request payloads or user paths on its current scope.// These terminal events carry only the closed metadata above.#[cfg(feature = "crash-reporting")]diff --git a/crates/openhuman-core/src/modules/failure_tests.rs b/crates/openhuman-core/src/modules/failure_tests.rsindex 81eefc7610..2626f93b6d 100644--- a/crates/openhuman-core/src/modules/failure_tests.rs+++ b/crates/openhuman-core/src/modules/failure_tests.rs@@ -65,3 +65,21 @@ fn reason_codes_and_stages_are_closed_vocabulary() {assert!(reason.stage().chars().all(|c| c.is_ascii_lowercase()));}}++#[cfg(feature = "crash-reporting")]+#[test]+fn a_pre_core_report_without_a_sentry_client_can_be_captured_later() {+ let record = crate::modules::registry::find("tinyhosts").unwrap();+ let hub = std::sync::Arc::new(sentry::Hub::new_from_top(sentry::Hub::current()));+ hub.bind_client(None);+ sentry::Hub::run(hub, || report(record, Reason::IncompatibleContract));+ let events = sentry::test::with_captured_events(|| {+ report(record, Reason::IncompatibleContract);+ report(record, Reason::IncompatibleContract);+ });+ assert_eq!(events.len(), 1, "{events:?}");+ assert_eq!(+ events[0].tags.get("module").map(String::as_str),+ Some("tinyhosts")+ );+}diff --git a/crates/openhuman-embed/Cargo.toml b/crates/openhuman-embed/Cargo.tomlindex d93d0e3b99..378d07c615 100644--- a/crates/openhuman-embed/Cargo.toml+++ b/crates/openhuman-embed/Cargo.toml@@ -11,7 +11,7 @@ publish = false[features]# `channels` is in core's default set already; enabling it here too compiles# the `Runtime::channels` facade in a default build.-default = ["openhuman-core/default", "channels"]+default = ["openhuman-core/default", "channels", "modules"]http-server = ["openhuman-core/http-server"]inference = ["openhuman-core/inference"]documents = ["openhuman-core/documents"]diff --git a/scripts/__tests__/check-module-boundaries.test.mjs b/scripts/__tests__/check-module-boundaries.test.mjsindex 0c564dc32b..a0689dbc8a 100644--- a/scripts/__tests__/check-module-boundaries.test.mjs+++ b/scripts/__tests__/check-module-boundaries.test.mjs@@ -1,14 +1,14 @@import assert from 'node:assert/strict';import { readFileSync } from 'node:fs';import test from 'node:test';-import { auditGraph, graph, isImplementation, validatePolicy } from '../ci/check-module-boundaries.mjs';+import { auditGraph, graph, isImplementation, validatePolicy, CONTRACT_REGISTRY } from '../ci/check-module-boundaries.mjs';const policy = JSON.parse(readFileSync(new URL('../ci/module-boundaries.json', import.meta.url), 'utf8'));const strict = { ...policy, exceptions: [] };function metadata(edges, names = {}) {const ids = [...new Set(Object.entries(edges).flatMap(([id, deps]) => [id, ...deps.map(d => d[0])]))];return {- packages: ids.map(id => ({ id, name: names[id] ?? id })),+ packages: ids.map(id => ({ id, name: names[id] ?? id, source: CONTRACT_REGISTRY })),resolve: { nodes: ids.map(id => ({ id, deps: (edges[id] ?? []).map(([pkg, kind = null, target = null]) => ({ pkg, dep_kinds: [{ kind, target }] })) })) },};}@@ -100,3 +100,19 @@ test('a same-named contract from another source cannot evade independent auditinm.packages.find(pkg => pkg.name === 'tinyjuice-bus').manifest_path = '/pinned/Cargo.toml';assert.equal(auditGraph(m, ['host'], pinned).violations.length, 0);});+++test('allowlisted vocabulary names cannot mask a path, git or alternate-registry package', () => {+ for (const source of [null, undefined, 'git+https://example.invalid/serde', 'registry+https://example.invalid/index']) {+ const m = metadata({ 'tinyjuice-bus': [['serde']], serde: [['syn']] });+ m.packages.find(pkg => pkg.name === 'serde').source = source;+ const result = auditGraph(m, ['tinyjuice-bus'], strict, 'tinyjuice-bus');+ assert.deepEqual(result.violations.map(v => v.package), ['serde']);+ }+});++test('every approved vocabulary descendant must come from the approved registry', () => {+ const m = metadata({ 'tinyjuice-bus': [['serde']], serde: [['syn']] });+ m.packages.find(pkg => pkg.name === 'syn').source = null;+ assert.deepEqual(auditGraph(m, ['tinyjuice-bus'], strict, 'tinyjuice-bus').violations[0].path, ['tinyjuice-bus', 'serde', 'syn']);+});diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjsindex bb108a9094..6467321333 100644--- a/scripts/__tests__/self-hosted-lanes.test.mjs+++ b/scripts/__tests__/self-hosted-lanes.test.mjs@@ -656,3 +656,12 @@ test("module boundaries run for Rust and scripts changes in both profiles", () =}}});+++test("module boundary policy and checker changes arm their own scripts lane", () => {+ const filters = fs.readFileSync(path.join(repoRoot, ".github/ci-paths-filter.yml"), "utf8");+ const scripts = filters.split(/^scripts:\s*$/m)[1].split(/^\S[^\n]*:/m)[0];+ for (const file of ["scripts/ci/check-module-boundaries.mjs", "scripts/ci/module-boundaries.json"]) {+ assert.ok(scripts.includes(`'${file}'`), `${file} must arm the scripts area`);+ }+});diff --git a/scripts/ci/README.md b/scripts/ci/README.mdindex 3f28a7e490..e9cb0ab8eb 100644--- a/scripts/ci/README.md+++ b/scripts/ci/README.md@@ -35,8 +35,10 @@ not a completed migration. `pnpm rust:module-boundaries:complete` additionallyrejects all exceptions and pending contracts. Cargo failure is an audit failure.Generated probes and lockfiles stay in the checkout's `target/module-boundaries/`.-Only `check-openhuman-rust-layout.mjs` and `check-crate-chain.mjs` are wired to a pnpm script-(`pnpm rust:layout`); the rest are invoked directly, e.g.+`check-openhuman-rust-layout.mjs` and `check-crate-chain.mjs` run through+`pnpm rust:layout`. The module-boundary audit has the two pnpm commands above,+and the ambient-access ratchet runs through `pnpm saas:ambient`. Other gates+are invoked directly, e.g.`node scripts/ci/check-feature-forwarding.mjs` or`bash scripts/ci/orch-ip-gate.sh`, and can be run the same way locally. Everygate here runs from `.github/workflows/ci-lite.yml`; `ci-full.yml` does notdiff --git a/scripts/ci/check-dep-sim-calibration.sh b/scripts/ci/check-dep-sim-calibration.shindex a43acd9c5d..e7e9960120 100755--- a/scripts/ci/check-dep-sim-calibration.sh+++ b/scripts/ci/check-dep-sim-calibration.sh@@ -110,8 +110,11 @@ cd "$(dirname "$0")/../.."# 315 -> 316 on 2026-10-09: cron and flows on the storage ports add the# first-party tinyflows-drivers crate (one package, one name; no new# external crate).-# This matches the current `flows:338:316:2` entry in+# 316 -> 317 on 2026-10-10: pre-core module registry vocabulary adds the+# pure tinycomputer-bus contract to loader-disabled builds; no native or+# implementation dependency is added.+# This matches the current `flows:339:317:2` entry in# scripts/kernel-floor.limits; its preceding entries are historical.-EXPECTED_NAMES=316+EXPECTED_NAMES=317exec python3 scripts/dep-sim.py --cut-nothing --expect-names "${EXPECTED_NAMES}"diff --git a/scripts/ci/check-module-boundaries.mjs b/scripts/ci/check-module-boundaries.mjsindex 2f339a282d..ee430fb8b7 100644--- a/scripts/ci/check-module-boundaries.mjs+++ b/scripts/ci/check-module-boundaries.mjs@@ -5,6 +5,8 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';import { dirname, join, resolve } from 'node:path';import { fileURLToPath, pathToFileURL } from 'node:url';+export const CONTRACT_REGISTRY = 'registry+https://github.com/rust-lang/crates.io-index';+export const CONTRACT_CLOSURE = new Set(['serde', 'serde_core', 'serde_derive', 'serde_json', 'itoa', 'memchr', 'zmij','thiserror', 'thiserror-impl', 'schemars', 'schemars_derive', 'dyn-clone',@@ -66,7 +68,7 @@ export function auditGraph(metadata, roots, policy, contract = null) {if (path.length > 1) {const sourceMismatch = !contract && policy.contractManifests?.[name] &&packages.get(id).manifest_path !== policy.contractManifests[name];- const forbidden = contract ? !CONTRACT_CLOSURE.has(name) :+ const forbidden = contract ? !CONTRACT_CLOSURE.has(name) || packages.get(id).source !== CONTRACT_REGISTRY :isImplementation(name, policy) || sourceMismatch;if (forbidden) {const scope = contract ?? 'hosts';diff --git a/scripts/kernel-floor.limits b/scripts/kernel-floor.limitsindex 265c412e25..5bbb8ea2b0 100644--- a/scripts/kernel-floor.limits+++ b/scripts/kernel-floor.limits@@ -668,4 +668,9 @@# 338/316/2 2026-10-09 cron and flows on the storage ports add the first-party# tinyflows-drivers crate (one package, one name; no new# external crate, native builds unchanged).-flows:338:316:2+# 339/317/2 2026-10-10 Pre-core module registry vocabulary adds tinycomputer-bus+# to loader-disabled builds. Only its pure contract is+# added (one package/name); no native or implementation+# dependency is introduced. This foundation is additive,+# not a dependency-shedding claim.+flows:339:317:2