Skip to content

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

refactor(feature-forwarding): track shell forwarding on openhuman-rpc

Steven Enamakel95019718383f
diff --git a/scripts/lib/feature-forwarding.mjs b/scripts/lib/feature-forwarding.mjs
index acf5cde4a6..73dce9e5ad 100644
--- a/scripts/lib/feature-forwarding.mjs
+++ b/scripts/lib/feature-forwarding.mjs
@@ -17,7 +17,9 @@
// reached zero gates — silently re-arming the exact failure described below.
// That is why assertion 1 exists and why it compares an explicit list.
//
-// Why this exists (#4919): the shell declares `openhuman_core` with
+// Why this exists (#4919): the shell declares its one openhuman dependency
+// (`openhuman_core` then; `openhuman-rpc` now, which forwards each gate down
+// the chain rpc -> tinyhumans -> embed -> core) with
// `default-features = false`, so it does NOT inherit the core's `default` list.
// Every default-ON gate must be forwarded by hand, and nothing enforced that.
// When the two drift, the domain is compiled out of the shipped desktop app and
@@ -52,6 +54,20 @@ export const INTENTIONALLY_NOT_FORWARDED = {
// 'some-gate': 'Reason it must not ship in the desktop build.',
};
+/**
+ * Gates the shell turns on on its `openhuman-rpc` dependency that are NOT
+ * core gates, mapped to why. They are rpc's (and, for `jev`, tinyhumans')
+ * own, so they never appear in `scripts/ci/product-features.txt`, and the
+ * product assertion must not read them as "unexpected".
+ */
+export const SHELL_RPC_LOCAL_GATES = {
+ 'http-client':
+ "openhuman-rpc's authenticated JSON-RPC client; the shell relays non-loopback runtimes through it.",
+ server:
+ "openhuman-rpc's JSON-RPC server and `host::desktop`, which the shell boots its embedded core with.",
+ jev: 'The Jev-backed `tool_search` ranker (openhuman-tinyhumans), shipped by the product.',
+};
+
/**
* Strip TOML `#` comments while respecting quoted strings, so a `#` inside a
* value (or an issue number in a comment) can't truncate a real line.
@@ -132,13 +148,14 @@ export function parseCoreDefaultFeatures(coreToml) {
}
/**
- * What the shell forwards on its `openhuman_core` dependency.
+ * What the shell forwards on its `openhuman-rpc` dependency — the only
+ * openhuman crate it names (`scripts/ci/check-crate-chain.mjs`).
*
* Returns `{ defaultFeatures, features }`. `defaultFeatures: true` means the
* shell inherits the core's defaults and forwarding is moot — there is nothing
* to drift.
*/
-export function parseShellForwardedFeatures(shellToml, depName = 'openhuman_core') {
+export function parseShellForwardedFeatures(shellToml, depName = 'openhuman-rpc') {
const text = stripComments(shellToml);
// `[ \t]` not `\s`, for the same newline-matching reason as above.
const declAt = text.search(new RegExp(`^[ \\t]*${depName}[ \\t]*=[ \\t]*\\{`, 'm'));
@@ -260,7 +277,12 @@ export function parseProductFeatures(text) {
* dropping a gate from the shell fails on `missing`, and adding one the
* product never agreed to fails on `unexpected`.
*/
-export function checkProductForwarding({ productFeatures, coreFeatureNames, shell }) {
+export function checkProductForwarding({
+ productFeatures,
+ coreFeatureNames,
+ shell,
+ localGates = SHELL_RPC_LOCAL_GATES,
+}) {
const empty = { missing: [], unexpected: [], unknown: [] };
if (shell === null) return { ok: false, reason: 'dependency-not-found', ...empty };
if (shell.defaultFeatures) {
@@ -276,7 +298,11 @@ export function checkProductForwarding({ productFeatures, coreFeatureNames, shel
const missing = productFeatures.filter(gate => !forwarded.has(gate));
// Forwarded by the shell but not in the product set → the product grew a
// gate without anyone editing the file that says what the product is.
- const unexpected = shell.features.filter(gate => !product.has(gate));
+ // `openhuman-rpc`'s own gates (server, client, Jev ranker) are not core
+ // gates and never belong in the product file; they are exempt by name.
+ const unexpected = shell.features.filter(
+ gate => !product.has(gate) && !Object.prototype.hasOwnProperty.call(localGates, gate)
+ );
// Named in the product set but not declared by the core → typo, or a gate
// renamed/deleted without updating this list.
const unknown = productFeatures.filter(gate => !known.has(gate));
@@ -291,11 +317,11 @@ export function checkProductForwarding({ productFeatures, coreFeatureNames, shel
export function formatProductReport(result, { productFeatures, shell }) {
if (result.reason === 'dependency-not-found') {
- return 'FAIL: could not find the `openhuman_core` dependency in the shell manifest.\nThe guard cannot verify forwarding — fix the parser or the manifest.';
+ return 'FAIL: could not find the `openhuman-rpc` dependency in the shell manifest.\nThe guard cannot verify forwarding — fix the parser or the manifest.';
}
if (result.reason === 'shell-inherits-defaults') {
return [
- 'FAIL: the shell no longer sets `default-features = false` on `openhuman_core`.',
+ 'FAIL: the shell no longer sets `default-features = false` on `openhuman-rpc`.',
'It would inherit `[features] default`, which is the CONTRIBUTOR set and is',
'deliberately smaller than the product — voice, web3, documents, meet, contacts',
'and crash-reporting would vanish from the shipped app.',
@@ -316,7 +342,7 @@ export function formatProductReport(result, { productFeatures, shell }) {
lines.push(
'',
'Each of these is compiled OUT of the shipped desktop app, silently.',
- 'Add it to the `openhuman_core` features list in crates/openhuman-app/Cargo.toml.',
+ 'Add it to the `openhuman-rpc` features list in crates/openhuman-app/Cargo.toml.',
'See #4901 (voice, 56 users) and #4918 (tokenjuice-treesitter).'
);
}
@@ -366,7 +392,7 @@ export function diffForwarding({ coreDefaults, shell, allowlist = {} }) {
export function formatReport(result, { coreDefaults, shell, allowlist = {} }) {
if (result.reason === 'dependency-not-found') {
- return 'FAIL: could not find the `openhuman_core` dependency in the shell manifest.\nThe guard cannot verify forwarding — fix the parser or the manifest.';
+ return 'FAIL: could not find the `openhuman-rpc` dependency in the shell manifest.\nThe guard cannot verify forwarding — fix the parser or the manifest.';
}
if (result.reason === 'inherits-defaults') {
return 'OK: the shell inherits the core default features (no `default-features = false`), so no forwarding is required.';
@@ -388,7 +414,7 @@ export function formatReport(result, { coreDefaults, shell, allowlist = {} }) {
lines.push(
'',
'Each of these is compiled OUT of the shipped desktop app, silently.',
- 'Fix by adding the gate to the `openhuman_core` features list in',
+ 'Fix by adding the gate to the `openhuman-rpc` features list in',
'crates/openhuman-app/Cargo.toml — or, if the exclusion is deliberate, add it to',
'INTENTIONALLY_NOT_FORWARDED in scripts/ci/check-feature-forwarding.mjs',
'with a reason. See #4901 (voice) and #4918 (tokenjuice-treesitter).'
@@ -399,15 +425,19 @@ export function formatReport(result, { coreDefaults, shell, allowlist = {} }) {
return lines.join('\n');
}
-// ── the library chain: core → embed → tinyhumans → rpc, and cli (#6364) ───
+// ── the library chain: core → embed → tinyhumans → rpc → cli/tui (#6364) ──
//
// The shell is not the only manifest that re-declares the core's gates. The
-// library layers forward them 1:1 three more times:
+// library layers and the other hosts forward them 1:1:
//
// openhuman-embed <gate> = ["openhuman-core/<gate>"]
// openhuman-tinyhumans <gate> = ["openhuman-embed/<gate>"]
// openhuman-rpc <gate> = ["openhuman-tinyhumans/<gate>"]
-// openhuman-cli <gate> = ["openhuman-core/<gate>", "openhuman-tinyhumans/<gate>"]
+// openhuman-cli <gate> = ["openhuman-rpc/<gate>"]
+// openhuman-tui <gate> = ["openhuman-rpc/<gate>"]
+//
+// (The desktop shell forwards on its `openhuman-rpc` dependency line instead
+// of a features table; `checkProductForwarding` covers it.)
//
// Nothing enforced those three lists, and they fail in both directions:
//
@@ -433,10 +463,8 @@ export function formatReport(result, { coreDefaults, shell, allowlist = {} }) {
*/
export const CHAIN_GATES_NOT_FORWARDED = {
'openhuman-embed': {
- 'e2e-test-support':
- 'Exposes the destructive `openhuman.test_reset` RPC for the E2E build only. An embedder must never be able to turn a data wipe on.',
'rss-bench':
- 'Library-side hook for the embedded-RSS benchmark (#5046). Its binaries live in `openhuman-cli`, which forwards the gate directly.',
+ 'Library-side hook for the embedded-RSS benchmark (#5046). Its binaries moved to the openhuman-benchmarks repository (#6944), which builds the core directly; no host in this repository turns it on.',
},
};
@@ -461,8 +489,6 @@ export const CHAIN_LOCAL_GATES = {
},
'openhuman-cli': {
'bin-tools': 'CLI argument parsing + logger init for the `openhuman-fleet` binary.',
- 'rss-bench-dhat':
- 'dhat heap profiling for the `library-profile` binary; perturbs RSS, so it is opt-in and has no core twin.',
},
};
@@ -484,11 +510,10 @@ export function parseFeatureTable(toml) {
*
* `{ crate, gates, required: true }` — every gate must be declared here and
* must forward to `<crate>/<gate>`. That is core → embed, embed →
- * tinyhumans, tinyhumans → rpc, core → cli.
+ * tinyhumans, tinyhumans → rpc, rpc → cli and rpc → tui.
* `{ crate, gates, required: false }` — only gates this crate ALREADY
- * declares have to carry the forward. That is tinyhumans → cli: the cli
- * forwards to both parents, but only for the gates tinyhumans has, and a
- * core-only gate like `e2e-test-support` must not be demanded of it.
+ * declares have to carry the forward: for a crate that forwards to a
+ * second parent only where that parent has the gate.
*
* A forward is checked by TARGET, not just by name: a gate declared as
* `voice = ["openhuman-core/web3"]` is as broken as a missing one and looks
@@ -638,3 +663,16 @@ export function formatChainReport(result, { notForwarded = {} } = {}) {
if (result.ok) lines.push(` OK: forwards every gate of the crates below it.`);
return lines.join('\n');
}
+
+/**
+ * The gates a host must forward from `openhuman-rpc`: rpc's gates minus its
+ * own local ones (`http-client`, `server`, `session-store`). A host turns those
+ * on on its dependency line when it needs them; they are not product gates and
+ * there is nothing to forward.
+ */
+export function rpcForwardedGates(rpcFeatures) {
+ const local = CHAIN_LOCAL_GATES['openhuman-rpc'] ?? {};
+ return [...rpcFeatures.keys()].filter(
+ name => name !== 'default' && !Object.prototype.hasOwnProperty.call(local, name)
+ );
+}