Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Harden the OK external-contribution baseline (install, CI gates) (#2450)

Nick Gomez7bd0874b6939
diff --git a/.changeset/linux-install-without-toolchain.md b/.changeset/linux-install-without-toolchain.md
new file mode 100644
index 000000000..1355a564a
--- /dev/null
+++ b/.changeset/linux-install-without-toolchain.md
@@ -0,0 +1,5 @@
+---
+'@inkeep/open-knowledge': patch
+---
+
+`bun install` on a fresh clone no longer fails on machines without a C build toolchain. The desktop app's `node-pty` native dependency is now optional (its build is only needed for the macOS desktop terminal), and puppeteer's Chrome-for-Testing download (~600 MB on disk) — used only by an engineer-local memory probe — is skipped at install time (`bunx puppeteer browsers install chrome` fetches it on demand).
diff --git a/bun.lock b/bun.lock
index 84a9bf5de..491bc9014 100644
--- a/bun.lock
+++ b/bun.lock
@@ -336,7 +336,6 @@
"@napi-rs/keyring": "^1.3.0",
"@opentelemetry/api": "^1.9.0",
"electron-updater": "6.8.4",
- "node-pty": "1.1.0",
"pino": "^10.3.1",
"semver": "^7.7.4",
"yaml": "^2.8.3",
@@ -356,6 +355,9 @@
"typescript": "^5.7.2",
"vite": "^8.0.0",
},
+ "optionalDependencies": {
+ "node-pty": "1.1.0",
+ },
},
"packages/native-config": {
"name": "@inkeep/open-knowledge-native-config",
diff --git a/package.json b/package.json
index 23a96412b..13df78863 100644
--- a/package.json
+++ b/package.json
@@ -68,6 +68,9 @@
"overrides": {
"mdast-util-mdx-jsx": "3.2.0"
},
+ "puppeteer": {
+ "skipDownload": true
+ },
"patchedDependencies": {
"@handlewithcare/[email protected]": "patches/@handlewithcare%[email protected]",
diff --git a/packages/desktop/package.json b/packages/desktop/package.json
index d43e1f728..a59db7a4d 100644
--- a/packages/desktop/package.json
+++ b/packages/desktop/package.json
@@ -32,11 +32,13 @@
"@napi-rs/keyring": "^1.3.0",
"@opentelemetry/api": "^1.9.0",
"electron-updater": "6.8.4",
- "node-pty": "1.1.0",
"pino": "^10.3.1",
"semver": "^7.7.4",
"yaml": "^2.8.3"
},
+ "optionalDependencies": {
+ "node-pty": "1.1.0"
+ },
"devDependencies": {
"@electron/fuses": "^2.1.1",
"@electron/notarize": "^3.1.1",
diff --git a/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.ts b/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.ts
index 906822ae3..30989674f 100644
--- a/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.ts
+++ b/packages/desktop/tests/unit/electron-builder-node-pty-deps.test.ts
@@ -11,9 +11,16 @@ import { parse } from 'yaml';
* under `prebuilds/<platform>-<arch>/`. Three things must hold together or the
* in-app terminal is dead on arrival in the packaged `.app`:
*
- * 1. node-pty is a real (upstream) dependency — NOT `@lydell/node-pty`, whose
- * per-arch optionalDependency layout recreates the keyring universal-merge
- * hazard that forced this build arm64-only.
+ * 1. node-pty is the upstream package, pinned in optionalDependencies — NOT
+ * `@lydell/node-pty`, whose per-arch optionalDependency layout recreates
+ * the keyring universal-merge hazard that forced this build arm64-only.
+ * optionalDependencies placement is itself load-bearing in the other
+ * direction: node-pty's node-gyp build needs a C toolchain, and a failed
+ * optional install is dropped by bun instead of failing the whole repo's
+ * `bun install` (Linux contributors never run this macOS-only app).
+ * electron-builder packs installed optional production deps the same as
+ * regular ones, so the packaged app is unaffected on the macOS build
+ * host, where the native build always runs.
* 2. `**\/node-pty/prebuilds/**` is in asarUnpack. The generic `**\/*.node`
* rule unpacks `pty.node` but NOT `spawn-helper` (no `.node` extension);
* node-pty resolves the helper from `app.asar.unpacked` at runtime, so it
@@ -43,6 +50,7 @@ function readBuilderConfig(): {
function readPkg(): {
dependencies?: Record<string, string>;
+ optionalDependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
} {
return JSON.parse(readFileSync(pkgJson, 'utf8'));
@@ -55,13 +63,20 @@ describe('node-pty desktop packaging config', () => {
expect(existsSync(afterPack)).toBe(true);
});
- test('node-pty is an upstream dependency and @lydell/node-pty is not used', () => {
+ test('node-pty is an upstream optionalDependency and @lydell/node-pty is not used', () => {
const pkg = readPkg();
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
+ const deps = { ...pkg.dependencies, ...pkg.optionalDependencies, ...pkg.devDependencies };
expect(
- pkg.dependencies?.['node-pty'],
- 'node-pty must be a runtime dependency so electron-builder packs it into the app.',
+ pkg.optionalDependencies?.['node-pty'],
+ 'node-pty must be a pinned optionalDependency: electron-builder still packs installed ' +
+ 'optional production deps into the app, and optional placement keeps a failed node-gyp ' +
+ 'build (Linux contributor without a C toolchain) from failing the whole repo bun install.',
).toBe('1.1.0');
+ expect(
+ pkg.dependencies?.['node-pty'],
+ 'node-pty must not also appear in dependencies — that placement makes its native build ' +
+ 'failure fatal to bun install on machines without a C toolchain.',
+ ).toBeUndefined();
expect(
'@lydell/node-pty' in deps,
'@lydell/node-pty recreates the keyring per-arch universal-merge hazard — use upstream node-pty.',
diff --git a/packages/server/src/sync-engine.test.ts b/packages/server/src/sync-engine.test.ts
index ca7a2dbd2..ec1c1a1c5 100644
--- a/packages/server/src/sync-engine.test.ts
+++ b/packages/server/src/sync-engine.test.ts
@@ -9,11 +9,20 @@
* detection) belong in a future integration test that spins up a bare git repo.
*/
-import { describe as _bunDescribe, afterEach, beforeEach, expect, test } from 'bun:test';
-
-// Skip-on-CI gate (oven-sh/bun#11892): subprocess or git child spawns; Bun fails to reap children on ubuntu-latest GHA runners (oven-sh/bun#11892).
-// Tests run normally locally; follow-up will narrow the leak surface.
-const describe = process.env.CI ? _bunDescribe.skip : _bunDescribe;
+import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
+
+// CI-skip gate REMOVED (2026-07): this file was blanket-skipped on CI as a
+// workaround for oven-sh/bun#11892 (Bun fails to kill/reap spawned child
+// processes on GitHub Actions runners; still open upstream — a Bun runtime
+// defect, so the move to Blacksmith runners dates the lift but is not what
+// makes it safe). The lift is carried by two facts: the suite only spawns
+// short-lived git children via simple-git — not the long-lived spawn+kill
+// pattern from the bun issue — and the bare-remote fixtures now pin their
+// branch explicitly, so the suite passes under CI's `master`-default git
+// (inkeep/open-knowledge#361). If this file ever flakes or hangs in CI,
+// narrow to a targeted skip of the specific live-git describe blocks —
+// do not restore a blanket process.env.CI gate. 17 sibling files still carry
+// the blanket gate; per-file lift is tracked in inkeep/agents-private#2447.
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';