Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: close the two review-gate findings the consolidation missed

Adam Eivy57d49c7b2b4c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 99bfea681d..97ad98378a 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -22,7 +22,7 @@
## Fixed
-- **The `ignore-scripts` supply-chain guard was silently inactive for every workspace install, including CI.** The repo-root `.npmrc` has pinned `ignore-scripts=true` for a while, but npm resolves the project `.npmrc` from the *local prefix* and never walks up the directory tree — so it never applied to `cd client && npm install`, `cd server && npm install`, or `npm ci --prefix server` / `--prefix client`, which is exactly what CI runs and what the documented per-workspace test workflow uses. In those paths every dependency kept an install-time code-execution slot: the same slot the August 2026 keyv/cacheable (Shai-Hulud) worm used, via a `preinstall` hook, to harvest credentials before any application code ran. `client/`, `server/`, and `autofixer/` now each carry their own `.npmrc`, so the guard holds in all six install paths.
+- **The `ignore-scripts` supply-chain guard was silently inactive for every workspace install, including CI.** The repo-root `.npmrc` has pinned `ignore-scripts=true` for a while, but npm resolves the project `.npmrc` from the *local prefix* and never walks up the directory tree — so it never applied to `cd client && npm install`, `cd server && npm install`, or `npm ci --prefix server` / `--prefix client`, which is exactly what CI runs and what the documented per-workspace test workflow uses. In those paths every dependency kept an install-time code-execution slot: the same slot the August 2026 keyv/cacheable (Shai-Hulud) worm used, via a `preinstall` hook, to harvest credentials before any application code ran. `client/`, `server/`, `autofixer/`, and `browser/` now each carry their own `.npmrc`, so the guard holds in every workspace install path — whether entered by `cd`ing in or via `--prefix`.
Closing the hole made the trusted-rebuild allowlist load-bearing for the first time, and it had drifted across its four copies (the root `setup` script, `scripts/ensure-deps.js`, `update.sh`, `update.ps1`): the `esbuild` entries were dead — vite 8 dropped that dependency — while `onnxruntime-node` and `protobufjs` were missing entirely, so CI ran install hooks that the local setup skipped. All four now read one allowlist from `scripts/trusted-rebuilds.js`, and CI rebuilds it explicitly after installing server dependencies so `node-pty`'s native binding is still present for the smoke-boot. `scripts/trusted-rebuilds.test.js` fails if any workspace `.npmrc` loses the setting, or if a dependency shows up with an install hook nobody has decided about — the second case being how a missing native build otherwise surfaces much later as a confusing runtime crash.
diff --git a/.npmrc b/.npmrc
index c95b5fbaf5..f44b6f2364 100644
--- a/.npmrc
+++ b/.npmrc
@@ -4,7 +4,7 @@
# root. npm reads the project config from the local prefix and never walks up
# the directory tree, so `cd client && npm install` and `npm ci --prefix server`
# do NOT see this file — each workspace carries its own .npmrc for that reason
-# (client/.npmrc, server/.npmrc, autofixer/.npmrc). Deleting any of those
+# (client/.npmrc, server/.npmrc, autofixer/.npmrc, browser/.npmrc). Deleting any
# silently reopens an install-time code-execution slot for every dependency in
# that workspace.
#
diff --git a/client/lint-react-legacy-apis.grit b/client/lint-react-legacy-apis.grit
index a2c76f0369..abe62e5884 100644
--- a/client/lint-react-legacy-apis.grit
+++ b/client/lint-react-legacy-apis.grit
@@ -38,12 +38,27 @@ or {
// --- @eslint-react/no-missing-component-display-name ---------------------
// Flags an anonymous function or arrow passed to memo()/forwardRef().
+ //
+ // The two-argument `memo($fn, $areEqual)` branches are NOT redundant: a single
+ // `$fn` metavariable does not match a two-item argument list, so without them
+ // `memo(() => <div/>, areEqual)` — a legitimate and common form — escaped the rule
+ // entirely. `forwardRef` takes only the render function, so it needs no such pair.
+ //
+ // ORDER IS LOAD-BEARING: the two-arg branches must come FIRST. Grit's `or` takes
+ // the first branch that matches and does not backtrack when the shared `where`
+ // below then fails — so with `memo($fn)` listed first, a two-arg call matched it,
+ // failed the anonymous-function check, and was dropped without the two-arg branch
+ // ever being tried. Verified both ways: specific-first flags all four anonymous
+ // forms, general-first silently flags only two. Do not alphabetize these.
+ //
// NOTE: one deliberate divergence from @eslint-react — that rule also accepts a
- // later `Component.displayName = '...'` assignment as satisfying the
- // requirement; this pattern does not, so it is slightly STRICTER (never weaker).
- // `client/src` has zero memo()/forwardRef() call sites today, so the stricter
- // reading costs nothing; name the function and the diagnostic goes away.
+ // later `Component.displayName = '...'` assignment as satisfying the requirement;
+ // this pattern does not, so on that axis it is stricter. `client/src` has zero
+ // memo()/forwardRef() call sites today, so the stricter reading costs nothing;
+ // name the function and the diagnostic goes away.
or {
+ `memo($fn, $areEqual)`,
+ `$react.memo($fn, $areEqual)`,
`memo($fn)`,
`forwardRef($fn)`,
`$react.memo($fn)`,
diff --git a/client/package-lock.json b/client/package-lock.json
index 8e4f031191..b14069231b 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -24,7 +24,7 @@
"three": "0.185.1"
},
"devDependencies": {
- "@biomejs/biome": "^2.5.7",
+ "@biomejs/biome": "2.5.7",
"@tailwindcss/postcss": "4.3.3",
"@testing-library/jest-dom": "7.0.0",
"@testing-library/react": "16.3.2",
diff --git a/client/package.json b/client/package.json
index 0c05f1afbd..3317eec203 100644
--- a/client/package.json
+++ b/client/package.json
@@ -30,7 +30,7 @@
"three": "0.185.1"
},
"devDependencies": {
- "@biomejs/biome": "^2.5.7",
+ "@biomejs/biome": "2.5.7",
"@tailwindcss/postcss": "4.3.3",
"@testing-library/jest-dom": "7.0.0",
"@testing-library/react": "16.3.2",
diff --git a/docs/DEPS.md b/docs/DEPS.md
index f429b13a35..ba882ad135 100644
--- a/docs/DEPS.md
+++ b/docs/DEPS.md
@@ -3,7 +3,7 @@
Living reference of every third-party dependency in PortOS, why it's kept, and what the current verdict is. Updated by `/do:depfree` runs.
**Last audited:** 2026-08-04 (scoped audit of the `keyv`/`cacheable` supply-chain compromise); prior follow-up 2026-07-14 (issue #2547), prior full audit 2026-04-28 (default mode), tables corrected 2026-07-01 during a docs audit.
-**Verdict:** All dependencies justified. The 2026-08-04 audit replaced the entire `eslint` stack with `@biomejs/biome`, dropping 108 net client packages including the `file-entry-cache → flat-cache → keyv` chain named in the August 2026 Shai-Hulud npm compromise (PortOS held safe versions throughout — see the detailed finding below). The same pass closed a latent hole where `ignore-scripts=true` was only active for repo-root installs, not for any workspace install or CI. Since the last full audit: `sax` was removed (replaced with an owned parser, issue #1824), `portos-ai-toolkit` was vendored in-tree (`server/lib/aiToolkit/`), and monolithic `googleapis` was replaced with scoped `@googleapis/*` packages. The 2026-07-14 follow-up bumped `kokoro-js` to its latest patch `1.2.1` (still on maintenance watch — no publish since 2025-05) and aligned the dual `pm2` pins (root + server both `7.0.3`).
+**Verdict:** All dependencies justified. The 2026-08-04 audit replaced the entire `eslint` stack with `@biomejs/biome`, dropping 110 net client packages including the `file-entry-cache → flat-cache → keyv` chain named in the August 2026 Shai-Hulud npm compromise (PortOS held safe versions throughout — see the detailed finding below). The same pass closed a latent hole where `ignore-scripts=true` was only active for repo-root installs, not for any workspace install or CI. Since the last full audit: `sax` was removed (replaced with an owned parser, issue #1824), `portos-ai-toolkit` was vendored in-tree (`server/lib/aiToolkit/`), and monolithic `googleapis` was replaced with scoped `@googleapis/*` packages. The 2026-07-14 follow-up bumped `kokoro-js` to its latest patch `1.2.1` (still on maintenance watch — no publish since 2025-05) and aligned the dual `pm2` pins (root + server both `7.0.3`).
## Audit Methodology
@@ -139,6 +139,6 @@ These exist purely to force-bump transitive deps; revisit if `npm audit` flags n
## Install-Script Policy
-`ignore-scripts=true` is pinned in **every** workspace's own `.npmrc` (root, `client/`, `server/`, `autofixer/`) — not just the repo root. npm resolves the project `.npmrc` from the *local prefix* and never walks up the directory tree, so a root-only setting does not cover `cd client && npm install` or `npm ci --prefix server` (what CI runs). Deleting any workspace `.npmrc` silently re-grants every dependency in that workspace an install-time code-execution slot — the vector the Shai-Hulud worm used.
+`ignore-scripts=true` is pinned in **every** workspace's own `.npmrc` (root, `client/`, `server/`, `autofixer/`, `browser/`) — not just the repo root. The list is not maintained by hand: `discoverWorkspaces()` in `scripts/trusted-rebuilds.js` globs every top-level directory carrying a `package.json`, and the test asserts each discovered one has the setting — so a workspace added later is caught rather than silently unguarded. npm resolves the project `.npmrc` from the *local prefix* and never walks up the directory tree, so a root-only setting does not cover `cd client && npm install` or `npm ci --prefix server` (what CI runs). Deleting any workspace `.npmrc` silently re-grants every dependency in that workspace an install-time code-execution slot — the vector the Shai-Hulud worm used.
Packages that legitimately need an install script are named explicitly in the allowlist in `scripts/trusted-rebuilds.js`, the single source consumed by `npm run setup`, `scripts/ensure-deps.js`, `update.sh` / `update.ps1`, and CI. `scripts/trusted-rebuilds.test.js` fails if a workspace `.npmrc` loses the setting, or if a dependency appears with an install hook that nobody has explicitly decided about.
diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.js
index 0c5916762b..2a11396a7a 100644
--- a/scripts/ci-test-plan.test.js
+++ b/scripts/ci-test-plan.test.js
@@ -81,6 +81,14 @@ describe('CI test impact planner', () => {
'server/vitest.config.js',
'client/src/test/setup.js',
'server/lib/validation.js',
+ // The client lint configuration. Both of these carry real enforced rules —
+ // the .grit plugins include the crypto.randomUUID ban — so a change to
+ // either must widen CI the same way the former eslint.config.js did. This
+ // trigger went untested when it pointed at eslint.config.js, so the rename
+ // to biome.jsonc could have silently matched nothing.
+ 'client/biome.jsonc',
+ 'client/lint-no-random-uuid.grit',
+ 'client/lint-react-legacy-apis.grit',
]) {
const plan = buildCiTestPlan([path], { trackedFiles: TRACKED });
expect(plan.full, path).toBe(true);
@@ -90,6 +98,15 @@ describe('CI test impact planner', () => {
}
});
+ it('does not treat a source .grit or a mistyped biome.json as lint configuration', () => {
+ // Guards the trigger regex against over-matching: only the client's top-level
+ // config and its sibling .grit plugins should force a full run.
+ for (const path of ['client/src/foo.grit', 'client/biome.json', 'clientx/biome.jsonc']) {
+ const plan = buildCiTestPlan([path], { trackedFiles: TRACKED });
+ expect(plan.reason, path).not.toMatch(/lint configuration changed/);
+ }
+ });
+
it('selects the touched feature across server and client without pulling unrelated tests', () => {
const plan = buildCiTestPlan([
'.changelog/NEXT.md',
diff --git a/scripts/trusted-rebuilds.js b/scripts/trusted-rebuilds.js
index fcc894ffbd..10b03df594 100644
--- a/scripts/trusted-rebuilds.js
+++ b/scripts/trusted-rebuilds.js
@@ -101,7 +101,20 @@ export function rebuildTrusted(dir, label) {
function main() {
const label = process.argv[2];
if (!label) {
- console.error(`❌ usage: node scripts/trusted-rebuilds.js <${Object.keys(TRUSTED_REBUILDS).join('|')}>`);
+ // List the real workspaces, not just the keys of TRUSTED_REBUILDS — the CLI
+ // accepts any workspace (a rebuild-free one is a documented no-op), so
+ // advertising only `server` misrepresents what is valid.
+ console.error(`❌ usage: node scripts/trusted-rebuilds.js <${discoverWorkspaces().join('|')}>`);
+ process.exit(1);
+ }
+ // Validate the label against the real workspace list BEFORE the "nothing to do"
+ // check below. Otherwise a typo (`sever`) falls through to a green "✅ no trusted
+ // rebuilds needed" and exit 0 — reproducing the exact failure this module exists
+ // to prevent (node-pty left unbuilt, surfacing much later as a confusing
+ // MODULE_NOT_FOUND at smoke-boot) behind a CI step that reported success.
+ const workspaces = discoverWorkspaces();
+ if (!workspaces.includes(label)) {
+ console.error(`❌ unknown workspace '${label}'. Known workspaces: ${workspaces.join(', ')}`);
process.exit(1);
}
if (!TRUSTED_REBUILDS[label]) {
diff --git a/scripts/trusted-rebuilds.test.js b/scripts/trusted-rebuilds.test.js
index c83280a46e..d522669283 100644
--- a/scripts/trusted-rebuilds.test.js
+++ b/scripts/trusted-rebuilds.test.js
@@ -49,7 +49,12 @@ function packagesWithInstallHooks(label) {
} catch {
continue;
}
- if (LIFECYCLE_HOOKS.some((hook) => pkg?.scripts?.[hook])) found.add(pkg.name);
+ // A `binding.gyp` counts even with no explicit hook: npm runs node-gyp
+ // implicitly for such a package, and `ignore-scripts=true` blocks that too —
+ // so a gyp-only native dependency would otherwise be left unbuilt AND
+ // unflagged, which is the exact silent-failure this guard exists to prevent.
+ const hasImplicitGypBuild = existsSync(join(packageDir, 'binding.gyp'));
+ if (hasImplicitGypBuild || LIFECYCLE_HOOKS.some((hook) => pkg?.scripts?.[hook])) found.add(pkg.name);
}
return found;
}
@@ -109,6 +114,23 @@ describe('trusted rebuild allowlist', () => {
// Fail here instead, when the dependency lands, and force the decision.
const DELIBERATELY_UNBUILT = {};
+ it('detects install hooks at all, so the accounting assertion is not vacuous', () => {
+ // `unaccounted === []` also passes when the scan finds nothing, so a scan that
+ // silently broke (wrong path, changed npm layout, a `readdirSync` throw swallowed
+ // by the catch) would look exactly like a clean tree. Pin the known-hooked server
+ // packages so a broken scan fails loudly instead of reporting success.
+ //
+ // Deciding "absent" from the directory directly rather than from a `null` return
+ // is what makes this non-vacuous: the helper also returns `null` when it looks at
+ // the WRONG path, so trusting its own `null` would let exactly the broken-scan
+ // case skip the assertion it exists to make.
+ if (!existsSync(join(workspaceDir('server'), 'node_modules'))) return;
+ const hooked = packagesWithInstallHooks('server');
+ expect(hooked, 'scan returned null even though server/node_modules exists — it is looking at the wrong path').not.toBeNull();
+ expect(hooked.has('node-pty'), 'scan did not find node-pty — it declares install+postinstall').toBe(true);
+ expect(hooked.size).toBeGreaterThanOrEqual(3);
+ });
+
it.each(WORKSPACES)('%s: every installed package with an install hook is accounted for', (label) => {
const hooked = packagesWithInstallHooks(label);
if (hooked === null) return; // node_modules absent in this job
diff --git a/setup.ps1 b/setup.ps1
index b1f3cc7b6a..2f2b5a5acb 100644
--- a/setup.ps1
+++ b/setup.ps1
@@ -60,24 +60,17 @@ npm install
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
Pop-Location
-# Rebuild native bindings. Use `npm rebuild esbuild` instead of invoking a
-# hardcoded client/node_modules/esbuild/install.js path: esbuild is a transitive
-# dep (via vite) that npm may place anywhere inside the client dependency tree, so
-# the fixed client/node_modules/esbuild/install.js path doesn't exist when npm
-# nests it deeper — that path mismatch is what aborted setup.ps1 with
-# MODULE_NOT_FOUND on Windows (issue #1792). `npm rebuild esbuild --prefix client`
-# resolves esbuild wherever it landed within client's tree and re-runs its
-# binary-download postinstall. Mirrors the cross-platform `npm run setup` script
-# and setup.sh.
+# Run trusted install scripts skipped by ignore-scripts=true in each workspace's
+# .npmrc. The allowlist lives in scripts/trusted-rebuilds.js — a single home shared
+# with `npm run setup`, scripts/ensure-deps.js, update.sh/update.ps1 and CI, so a
+# package can never be granted an install-time execution slot in one path but not
+# another. Only the server needs rebuilds; client/autofixer/browser have no
+# install-script deps — vite 8 dropped the esbuild binary dependency that used to be
+# the reason, which is also what made the old hardcoded esbuild/install.js path fail
+# with MODULE_NOT_FOUND on Windows (issue #1792).
Write-Host ""
-Write-Host "Rebuilding esbuild, node-pty & sharp..." -ForegroundColor Yellow
-npm rebuild esbuild --prefix client
-if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
-# esbuild may not be a direct server dependency — don't fail setup if it's absent
-# (matches the `|| true` guard around the same step in `npm run setup`).
-npm rebuild esbuild --prefix server
-$global:LASTEXITCODE = 0
-npm rebuild node-pty sharp --prefix server
+Write-Host "Rebuilding trusted native dependencies..." -ForegroundColor Yellow
+node scripts/trusted-rebuilds.js server
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
# Run data setup scripts
diff --git a/setup.sh b/setup.sh
index 6ab198342a..4341cfe80d 100755
--- a/setup.sh
+++ b/setup.sh
@@ -25,7 +25,7 @@ if [ "$NODE_VERSION" -lt 18 ]; then
fi
# `npm run setup` is the all-in-one: submodules + root/client/server/autofixer
-# deps + esbuild postinstall + node-pty rebuild + data dir, db, and browser
+# deps + the trusted native rebuilds (scripts/trusted-rebuilds.js) + data dir, db, and browser
# setup. install:all is kept as a backward-compat alias.
echo "Installing dependencies and running setup..."
if ! npm run setup; then