From b32bba1190945617e84ca2a1a3a3c2ff26220a3a Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:00:19 +1100 Subject: [PATCH 01/14] chore(porch): 1944 init air --- .../status.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml diff --git a/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml new file mode 100644 index 000000000..fd3b92dfb --- /dev/null +++ b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml @@ -0,0 +1,14 @@ +id: '1944' +title: raise-the-node-js-floor-to-22- +protocol: air +phase: implement +plan_phases: [] +current_plan_phase: null +gates: + pr: + status: pending +iteration: 1 +build_complete: false +history: [] +started_at: '2026-11-24T01:00:19.199Z' +updated_at: '2026-11-24T01:00:19.200Z' From 201ef2aca7916a6d250dcf0158555513f4be3455 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:03:22 +1100 Subject: [PATCH 02/14] [Air #1944] feat: Raise the Node.js floor to 22 and standardise CI on Node 22 - engines.node >=22.0.0; codev doctor's Node minimum 18.0.0 -> 22.0.0 - POSIX workflows: node-version 20 -> 22 - windows.yml: every job on Node 22; Node 20 install-guard leg removed - Guard message names Node.js 22 (both parity twins); ABI allow list unchanged - Docs: README, DEPENDENCIES.md (both trees), arch.md, cloud-instances.md, lessons-learned.md --- .github/workflows/dashboard-e2e.yml | 2 +- .github/workflows/e2e.yml | 2 +- .github/workflows/post-release-e2e.yml | 2 +- .github/workflows/sdk-canary.yml | 2 +- .github/workflows/test.yml | 12 +-- .github/workflows/windows.yml | 89 ++++++------------- README.md | 4 +- codev-skeleton/DEPENDENCIES.md | 22 ++--- codev/DEPENDENCIES.md | 22 ++--- codev/resources/arch.md | 2 +- codev/resources/cloud-instances.md | 4 +- codev/resources/lessons-learned.md | 2 +- codev/state/air-1944_thread.md | 7 ++ packages/codev/package.json | 2 +- packages/codev/scripts/native-deps-guard.mjs | 4 +- packages/codev/src/__tests__/doctor.test.ts | 56 ++++++++---- .../src/__tests__/native-deps-guard.test.ts | 17 ++-- .../spec-1658-native-load-commands.test.ts | 4 +- packages/codev/src/commands/doctor.ts | 2 +- packages/codev/src/lib/native-deps.ts | 4 +- .../__tests__/pty-session-native-load.test.ts | 2 +- scripts/windows-install-guard-check.mjs | 2 +- 22 files changed, 132 insertions(+), 133 deletions(-) create mode 100644 codev/state/air-1944_thread.md diff --git a/.github/workflows/dashboard-e2e.yml b/.github/workflows/dashboard-e2e.yml index 146971e37..289625860 100644 --- a/.github/workflows/dashboard-e2e.yml +++ b/.github/workflows/dashboard-e2e.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index abfe99b40..3843634bf 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -28,7 +28,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/post-release-e2e.yml b/.github/workflows/post-release-e2e.yml index 43f42cb22..8f8ed8757 100644 --- a/.github/workflows/post-release-e2e.yml +++ b/.github/workflows/post-release-e2e.yml @@ -26,7 +26,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' - name: Determine package version id: version diff --git a/.github/workflows/sdk-canary.yml b/.github/workflows/sdk-canary.yml index 29b1eca86..12a3b22be 100644 --- a/.github/workflows/sdk-canary.yml +++ b/.github/workflows/sdk-canary.yml @@ -34,7 +34,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5c7e78c5..7fe3a0907 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies @@ -140,7 +140,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies @@ -181,7 +181,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies @@ -232,7 +232,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies @@ -269,7 +269,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies @@ -306,7 +306,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index afed190f0..ddd1e3dbe 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -8,17 +8,19 @@ run-name: "Windows: ${{ inputs.purpose || 'unlabelled' }}" # # gh workflow run windows.yml --ref -f purpose='' [-f suites=true] [-f filter=] [-f tower=true] # +# Every job runs on Node 22, the one supported and tested Node version (#1944). +# # Jobs: -# probe scripts/windows-probe.mjs on Node 20/22/24 (x64) and 22/24 (ARM64): Git Bash, PATHEXT, named pipes, +# probe scripts/windows-probe.mjs on x64 and ARM64: Git Bash, PATHEXT, named pipes, # CIM census latency, job objects, detached survival, native-dependency installs. -# With tower=true the x64 Node 22 leg also starts Tower from the built checkout (building +# With tower=true the x64 leg also starts Tower from the built checkout (building # the repo on ARM64 fails in the artifact-canvas bundler; users install prebuilt packages). # targeted runs the packages/codev vitest files matching `filter` (skipped when empty). -# install-guard (install_guard=true) packs the branch packages, then on Node 20 installs them -# globally with node-gyp replaced by a failing stub: the install must fail with the -# supported-versions message and never reach the stub; on Node 22 it must succeed. -# unit, cli-e2e, post-release-e2e (suites=true) the full suites on windows-latest, Node 22 and 24 -# (Node 20 has no better-sqlite3 prebuild on Windows, so it cannot install there): +# install-guard (install_guard=true) packs the branch packages, then installs them globally +# with node-gyp replaced by a failing stub: the install must succeed from prebuilds +# and never reach the stub. (The guard's refusal of an unsupported Node is covered +# by its unit tests.) +# unit, cli-e2e, post-release-e2e (suites=true) the full suites on windows-latest: # unit runs the sdk, core and codev unit tests; cli-e2e runs the built CLI tests; # post-release-e2e packs the dispatched ref's packages and installs those tarballs # with verify-install.mjs, or a published release when `version` is set (setting @@ -41,7 +43,7 @@ on: required: false default: false install_guard: - description: 'Run the native-dependency install guard check (Node 20 refused, Node 22 installs)' + description: 'Run the native-dependency install guard check (Node 22 installs from prebuilds)' type: boolean required: false default: false @@ -70,21 +72,15 @@ env: jobs: probe: - name: Probe (${{ matrix.os }}, Node ${{ matrix.node }}) + name: Probe (${{ matrix.os }}) runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: fail-fast: false matrix: - os: [windows-latest] - node: ['20', '22', '24'] # ARM64: the spec supports it only if the native dependencies install from prebuilds; # measured here rather than inferred from release asset names. - include: - - os: windows-11-arm - node: '22' - - os: windows-11-arm - node: '24' + os: [windows-latest, windows-11-arm] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -95,41 +91,38 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node }} + node-version: '22' - name: Probe platform facts and native-dependency installs - run: node scripts/windows-probe.mjs --deps --out "$RUNNER_TEMP/probe-${{ matrix.os }}-node${{ matrix.node }}.json" + run: node scripts/windows-probe.mjs --deps --out "$RUNNER_TEMP/probe-${{ matrix.os }}.json" - name: Install dependencies - if: ${{ !cancelled() && inputs.tower && matrix.node == '22' && matrix.os == 'windows-latest' }} + if: ${{ !cancelled() && inputs.tower && matrix.os == 'windows-latest' }} run: pnpm install - name: Build packages/codev - if: ${{ !cancelled() && inputs.tower && matrix.node == '22' && matrix.os == 'windows-latest' }} + if: ${{ !cancelled() && inputs.tower && matrix.os == 'windows-latest' }} working-directory: packages/codev run: pnpm build - name: Probe Tower start - if: ${{ !cancelled() && inputs.tower && matrix.node == '22' && matrix.os == 'windows-latest' }} + if: ${{ !cancelled() && inputs.tower && matrix.os == 'windows-latest' }} run: node scripts/windows-probe.mjs --tower --out "$RUNNER_TEMP/probe-tower-${{ matrix.os }}.json" - name: Probe Tower start from the published package (global install) if: ${{ !cancelled() && inputs.tower }} - # Node 20 cannot install the package on Windows (no better-sqlite3 prebuild; audit 1.1), so - # that leg records the failure without turning the run red. - continue-on-error: ${{ matrix.node == '20' }} env: PUBLISHED: ${{ inputs.published }} run: | specs=() for v in $PUBLISHED; do specs+=(--tower-published "$v"); done - node scripts/windows-probe.mjs "${specs[@]}" --out "$RUNNER_TEMP/probe-published-${{ matrix.os }}-node${{ matrix.node }}.json" + node scripts/windows-probe.mjs "${specs[@]}" --out "$RUNNER_TEMP/probe-published-${{ matrix.os }}.json" - name: Upload probe reports if: always() uses: actions/upload-artifact@v4 with: - name: windows-probe-${{ matrix.os }}-node${{ matrix.node }} + name: windows-probe-${{ matrix.os }} path: ${{ runner.temp }}/probe-*.json if-no-files-found: warn @@ -145,7 +138,7 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v4 - - name: Setup Node.js 22 (build and pack) + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '22' @@ -166,22 +159,6 @@ jobs: done ls -l "$RUNNER_TEMP/packs" - - name: Setup Node.js 20 (unsupported on native Windows) - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Control - without the guard, better-sqlite3 falls back to node-gyp on Node 20 - run: node scripts/windows-install-guard-check.mjs --control "$RUNNER_TEMP/packs" - - - name: Guard - Node 20 install fails with the supported versions, node-gyp never runs - run: node scripts/windows-install-guard-check.mjs --unsupported "$RUNNER_TEMP/packs" - - - name: Setup Node.js 22 (supported) - uses: actions/setup-node@v4 - with: - node-version: '22' - - name: Supported - Node 22 installs from prebuilds run: node scripts/windows-install-guard-check.mjs --supported "$RUNNER_TEMP/packs" @@ -228,15 +205,11 @@ jobs: if-no-files-found: warn unit: - name: Unit tests (Node ${{ matrix.node }}) + name: Unit tests if: ${{ inputs.suites }} runs-on: windows-latest # The codev unit suite alone runs about 50 minutes on windows-latest. timeout-minutes: 120 - strategy: - fail-fast: false - matrix: - node: ['22', '24'] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -247,7 +220,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node }} + node-version: '22' cache: 'pnpm' - name: Install dependencies @@ -281,19 +254,15 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: windows-unit-report-node${{ matrix.node }} + name: windows-unit-report path: ${{ runner.temp }}/vitest-unit-report.json if-no-files-found: warn cli-e2e: - name: CLI tests (Node ${{ matrix.node }}) + name: CLI tests if: ${{ inputs.suites }} runs-on: windows-latest timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - node: ['22', '24'] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -304,7 +273,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node }} + node-version: '22' cache: 'pnpm' - name: Install dependencies @@ -319,14 +288,10 @@ jobs: run: pnpm exec vitest run --config vitest.cli.config.ts post-release-e2e: - name: Install verification (Node ${{ matrix.node }}) + name: Install verification if: ${{ inputs.suites || inputs.version != '' }} runs-on: windows-latest timeout-minutes: 45 - strategy: - fail-fast: false - matrix: - node: ['22', '24'] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -338,7 +303,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node }} + node-version: '22' - name: Install dependencies if: ${{ inputs.version == '' }} diff --git a/README.md b/README.md index bc5d985ce..dfa94ab36 100644 --- a/README.md +++ b/README.md @@ -114,13 +114,13 @@ If Tower is running during an upgrade, restart it afterwards so it picks up the | Dependency | Install | Purpose | |------------|---------|---------| -| Node.js 20+ (22 recommended) | `brew install node` | Runtime | +| Node.js 22+ | `brew install node` | Runtime | | git 2.5+ | (pre-installed) | Version control | | AI CLIs | See below | All three recommended | On Linux and WSL, also install `build-essential` and `python3` (node-pty compiles from source). -**Windows:** two paths. **Native**: Node.js 22 or 24 (x64 or ARM64), [Git for Windows](https://git-scm.com/download/win) and `jq`, no admin rights or Developer Mode needed. **WSL 2**: follow the Linux instructions inside your distribution. See [DEPENDENCIES.md](codev-skeleton/DEPENDENCIES.md#windows) for setup and limitations. +**Windows:** two paths. **Native**: Node.js 22 (x64 or ARM64), [Git for Windows](https://git-scm.com/download/win) and `jq`, no admin rights or Developer Mode needed. **WSL 2**: follow the Linux instructions inside your distribution. See [DEPENDENCIES.md](codev-skeleton/DEPENDENCIES.md#windows) for setup and limitations. **AI CLIs** (install all three for multi-model consultation): - Claude Code: `curl -fsSL https://claude.ai/install.sh | bash`, or `npm install -g @anthropic-ai/claude-code`. The `claude` consult lane runs this CLI and needs version 2.1.141 or newer. diff --git a/codev-skeleton/DEPENDENCIES.md b/codev-skeleton/DEPENDENCIES.md index 3977284bb..63d68ba1a 100644 --- a/codev-skeleton/DEPENDENCIES.md +++ b/codev-skeleton/DEPENDENCIES.md @@ -20,8 +20,8 @@ These are required for Agent Farm to function. | Requirement | Value | |-------------|-------| -| Minimum Version | 20.0.0 (native Windows: 22 or 24) | -| Recommended | 22 | +| Minimum Version | 22.0.0 | +| Tested | 22 | | Purpose | Runtime for Agent Farm server | Codev's native dependencies (node-pty, better-sqlite3) install from prebuilt binaries where one @@ -30,9 +30,9 @@ needs a C/C++ toolchain: - **Linux and WSL:** node-pty compiles from source, so install `build-essential` and `python3` before `npm install -g @cluesmith/codev`. -- **Native Windows:** Node 22 and 24 (x64 and ARM64) are supported. On a Node version with no - Windows prebuild (Node 20, for example) the install stops and names the supported versions, - rather than starting a source build. +- **Native Windows:** Node 22 (x64 and ARM64) is supported. On a Node version with no + Windows prebuild the install stops and names the supported version, rather than starting a + source build. **Installation:** @@ -44,10 +44,10 @@ brew install node curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt install -y nodejs build-essential python3 -# Windows: the Node.js 22 or 24 installer from https://nodejs.org +# Windows: the Node.js 22 installer from https://nodejs.org # Verify -node --version # Should show v20.x or higher (v22.x or v24.x on native Windows) +node --version # Should show v22.x ``` ### git @@ -173,7 +173,7 @@ codex --version | Dependency | Minimum Version | Required? | |------------|-----------------|-----------| -| Node.js | 20.0.0 (native Windows: 22 or 24) | Yes | +| Node.js | 22.0.0 | Yes | | git | 2.5.0 (native Windows: Git for Windows) | Yes | | jq | any | Native Windows only | | gh | latest | Yes | @@ -218,13 +218,13 @@ Codev runs directly on Windows 10 22H2 or Windows 11, x64 or ARM64, with no admi | Prerequisite | Notes | |--------------|-------| -| Node.js 22 or 24 | Node 20 is not supported on native Windows: better-sqlite3 has no Windows prebuild for it | +| Node.js 22 | The supported and tested version; Node 20 is not supported | | [Git for Windows](https://git-scm.com/download/win) | Provides `git` and Git Bash, the shell Codev uses for its scripts | | jq | `winget install jqlang.jq`; the forge scripts need it | | gh | `winget install GitHub.cli`, then `gh auth login` | ```powershell -# After installing Node.js 22 or 24 from https://nodejs.org +# After installing Node.js 22 from https://nodejs.org winget install Git.Git winget install jqlang.jq winget install GitHub.cli @@ -314,7 +314,7 @@ On native Windows, npm's global bin directory is `npm config get prefix` itself ### Install fails on native Windows with "supported Node versions" -Your Node version has no prebuilt better-sqlite3 for Windows. Install Node 22 or 24 and run the +Your Node version has no prebuilt better-sqlite3 for Windows. Install Node 22 and run the install again. ### Terminal connection issues diff --git a/codev/DEPENDENCIES.md b/codev/DEPENDENCIES.md index 3977284bb..63d68ba1a 100644 --- a/codev/DEPENDENCIES.md +++ b/codev/DEPENDENCIES.md @@ -20,8 +20,8 @@ These are required for Agent Farm to function. | Requirement | Value | |-------------|-------| -| Minimum Version | 20.0.0 (native Windows: 22 or 24) | -| Recommended | 22 | +| Minimum Version | 22.0.0 | +| Tested | 22 | | Purpose | Runtime for Agent Farm server | Codev's native dependencies (node-pty, better-sqlite3) install from prebuilt binaries where one @@ -30,9 +30,9 @@ needs a C/C++ toolchain: - **Linux and WSL:** node-pty compiles from source, so install `build-essential` and `python3` before `npm install -g @cluesmith/codev`. -- **Native Windows:** Node 22 and 24 (x64 and ARM64) are supported. On a Node version with no - Windows prebuild (Node 20, for example) the install stops and names the supported versions, - rather than starting a source build. +- **Native Windows:** Node 22 (x64 and ARM64) is supported. On a Node version with no + Windows prebuild the install stops and names the supported version, rather than starting a + source build. **Installation:** @@ -44,10 +44,10 @@ brew install node curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt install -y nodejs build-essential python3 -# Windows: the Node.js 22 or 24 installer from https://nodejs.org +# Windows: the Node.js 22 installer from https://nodejs.org # Verify -node --version # Should show v20.x or higher (v22.x or v24.x on native Windows) +node --version # Should show v22.x ``` ### git @@ -173,7 +173,7 @@ codex --version | Dependency | Minimum Version | Required? | |------------|-----------------|-----------| -| Node.js | 20.0.0 (native Windows: 22 or 24) | Yes | +| Node.js | 22.0.0 | Yes | | git | 2.5.0 (native Windows: Git for Windows) | Yes | | jq | any | Native Windows only | | gh | latest | Yes | @@ -218,13 +218,13 @@ Codev runs directly on Windows 10 22H2 or Windows 11, x64 or ARM64, with no admi | Prerequisite | Notes | |--------------|-------| -| Node.js 22 or 24 | Node 20 is not supported on native Windows: better-sqlite3 has no Windows prebuild for it | +| Node.js 22 | The supported and tested version; Node 20 is not supported | | [Git for Windows](https://git-scm.com/download/win) | Provides `git` and Git Bash, the shell Codev uses for its scripts | | jq | `winget install jqlang.jq`; the forge scripts need it | | gh | `winget install GitHub.cli`, then `gh auth login` | ```powershell -# After installing Node.js 22 or 24 from https://nodejs.org +# After installing Node.js 22 from https://nodejs.org winget install Git.Git winget install jqlang.jq winget install GitHub.cli @@ -314,7 +314,7 @@ On native Windows, npm's global bin directory is `npm config get prefix` itself ### Install fails on native Windows with "supported Node versions" -Your Node version has no prebuilt better-sqlite3 for Windows. Install Node 22 or 24 and run the +Your Node version has no prebuilt better-sqlite3 for Windows. Install Node 22 and run the install again. ### Terminal connection issues diff --git a/codev/resources/arch.md b/codev/resources/arch.md index 73e31dc90..7e6ea780b 100644 --- a/codev/resources/arch.md +++ b/codev/resources/arch.md @@ -1258,7 +1258,7 @@ const CONFIG = { - macOS (Darwin) - Linux (GNU/Linux), including WSL 2 - Native Windows 10/11, x64 and ARM64 (Spec 1658; see Platform Layer) -- Requires: Node.js 20+ (native Windows: 22 or 24), Bash 4.0+ (Git Bash on Windows), Git 2.5+ (worktree support), standard Unix utilities (plus `jq` on Windows) +- Requires: Node.js 22+ (tested on 22), Bash 4.0+ (Git Bash on Windows), Git 2.5+ (worktree support), standard Unix utilities (plus `jq` on Windows) - Native addon: node-pty (compiled during npm install on Linux, may need `npm rebuild node-pty`; prebuilt on Windows) - Runtime directory: `~/.codev/run/` for shellper Unix sockets (created automatically with `0700` permissions); Windows uses named pipes diff --git a/codev/resources/cloud-instances.md b/codev/resources/cloud-instances.md index 751a270a9..68e6c7858 100644 --- a/codev/resources/cloud-instances.md +++ b/codev/resources/cloud-instances.md @@ -158,8 +158,8 @@ apt install -y \ build-essential \ sqlite3 -# Node.js 20 LTS -curl -fsSL https://deb.nodesource.com/setup_20.x | bash - +# Node.js 22 LTS +curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt install -y nodejs # AI CLIs diff --git a/codev/resources/lessons-learned.md b/codev/resources/lessons-learned.md index ab08a9260..0c3bc3b7d 100644 --- a/codev/resources/lessons-learned.md +++ b/codev/resources/lessons-learned.md @@ -476,7 +476,7 @@ Generalizable wisdom extracted from review documents, ordered by impact. Updated - [From 1797] **Tests that build scratch git repos inherit the developer's global git config.** A global excludes file (here `**/.claude/settings.local.json`) silently hid the very paths a change-detection test wrote, so the test passed or failed by machine. Pin `core.excludesFile=/dev/null` (and anything else the test depends on) in every scratch repo. Same family: a shell `umask 077` filters `writeFileSync`'s mode, so a test asserting a permission change must set its precondition with an explicit `chmodSync`. - [From #1802] **A test that creates a file with an explicit `mode` and then asserts that mode is umask-dependent.** `cloud-config.test.ts` "enforces 0600 on pre-existing files" writes `{ mode: 0o644 }` as its precondition; under a sandboxed shell with `umask 077` the file is born `0600`, the precondition assertion fails, and porch's `tests` check goes red for a diff that never touched `packages/codev`. Confirm with `(umask 022; pnpm vitest run )` before suspecting the code; running the porch check under `umask 022` is fixing the environment, not bypassing the check. The durable fix (out of scope there) is a `chmodSync` after the write in the test setup; Spec 1797 made it, so that test no longer depends on the umask. - [From #1819] **A browser suite that writes must not run under the repo's default Playwright config, and isolating the state dir alone is not enough.** `playwright.config.ts`'s global setup activates the *repo* workspace on the test Tower and starts an architect shell. Even with `CODEV_AGENT_FARM_DIR` isolated (the minimum while the live Tower runs, because the global.db owner lock refuses a shared one), that shell's socket lands in `SHELLPER_SOCKET_DIR`, which defaults to `~/.codev/run`, the live Tower's socket dir. The test Tower also probes and unlinks sockets there at startup and every 60 s, and its husk sweep judges live shellpers against its own empty database. Pattern (`packages/codev/playwright.decisions.config.ts`): a dedicated config with no global setup, `testIgnore`d by the default config through one shared constant, and a refusal before any Tower starts unless `TOWER_TEST_PORT` (not 4100), `CODEV_AGENT_FARM_DIR` and `SHELLPER_SOCKET_DIR` are all set. Drive throwaway `mkdtemp` workspaces through `/workspace//`; they need no activation. -- [From #1819] **On Node 26 locally, `apps/web` tests that touch `localStorage` fail because Node's built-in Web Storage global shadows jsdom's.** Without `--localstorage-file`, Node's `localStorage` is undefined and wins over jsdom's, so every test reaching `getWebKey()` (Terminal*, VirtualKeyboard, architect-toolbar: 74 tests) fails for no reason in the diff. Run the web suite with `NODE_OPTIONS=--no-experimental-webstorage`. CI pins Node 20, so CI is unaffected. +- [From #1819] **On Node 26 locally, `apps/web` tests that touch `localStorage` fail because Node's built-in Web Storage global shadows jsdom's.** Without `--localstorage-file`, Node's `localStorage` is undefined and wins over jsdom's, so every test reaching `getWebKey()` (Terminal*, VirtualKeyboard, architect-toolbar: 74 tests) fails for no reason in the diff. Run the web suite with `NODE_OPTIONS=--no-experimental-webstorage`. CI pins Node 22, so CI is unaffected. - [From #1658] Seam-forced unit tests (forcing the platform to `win32` on macOS) prove the branch logic, never the platform. Real Windows runs found what no forced test could: Git Bash has neither `uuidgen` nor `/proc/sys/kernel/random/uuid` (the builder launch script would mint an empty session id), `System32\bash.exe` (the WSL launcher) can be first on `PATH`, and `.cmd` shims cannot be spawned without a shell. Pair every seam test with a real-host check. - [From #1869] **The browser run found what 65 unit and integration tests could not.** Every test passed while the workbench's sockets bypassed Tower and the IDE token sat in the cookie jar. Only a Playwright pass that recorded the actual WebSocket URLs and read `context.cookies()` exposed it. For a proxy feature, make "where does traffic really go" and "what lands in the jar" explicit acceptance assertions. diff --git a/codev/state/air-1944_thread.md b/codev/state/air-1944_thread.md new file mode 100644 index 000000000..e86fdf514 --- /dev/null +++ b/codev/state/air-1944_thread.md @@ -0,0 +1,7 @@ +# air-1944 thread: Node floor 22 + +- Architect (main) confirmed both open questions: all five POSIX workflows go 20 -> 22; the Node 20 install-guard leg is removed (issue default). Architect is reporting both readings to the owner and will flag any change before the pr gate. +- Windows workflow: every job on Node 22. Probe matrix is now `os: [windows-latest, windows-11-arm]` only; artifact names lost their `-node` suffix. Install guard keeps only the `--supported` check; `windows-install-guard-check.mjs` still has its `--control`/`--unsupported` modes for manual use. +- Guard message: "Node.js 22 (LTS), x64 or arm64" in both twins; ABI allow list unchanged (24/25/26 still install). +- No tracked `.npmrc` sets `engine-strict`, so a below-floor install on POSIX warns (EBADENGINE) and proceeds; on native Windows the preinstall guard still refuses an ABI with no prebuild. +- Adjacent fix: `codev doctor` checked Node >= 18.0.0; now 22.0.0, with a Node 20 failure test. Doctor test fixtures moved from v20 to v22. diff --git a/packages/codev/package.json b/packages/codev/package.json index c0e559268..7ba41a6fd 100644 --- a/packages/codev/package.json +++ b/packages/codev/package.json @@ -76,7 +76,7 @@ "vitest": "^4.0.15" }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" }, "keywords": [ "cli", diff --git a/packages/codev/scripts/native-deps-guard.mjs b/packages/codev/scripts/native-deps-guard.mjs index 783088422..297cbbdc1 100644 --- a/packages/codev/scripts/native-deps-guard.mjs +++ b/packages/codev/scripts/native-deps-guard.mjs @@ -23,14 +23,14 @@ export const WINDOWS_PREBUILD_NODE_ABIS = ['127', '137', '141', '147']; export const WINDOWS_PREBUILD_ARCHES = ['x64', 'arm64']; /** The Node versions Codev documents and tests on native Windows. */ -export const SUPPORTED_WINDOWS_NODE = 'Node.js 22 or 24 (LTS), x64 or arm64'; +export const SUPPORTED_WINDOWS_NODE = 'Node.js 22 (LTS), x64 or arm64'; /** The message printed whenever native Windows cannot use the prebuilt binaries. */ export function unsupportedWindowsNodeMessage(nodeVersion, arch) { return [ `@cluesmith/codev: native Windows needs ${SUPPORTED_WINDOWS_NODE}.`, `This is Node.js ${nodeVersion} (win32-${arch}), which has no prebuilt binary for Codev's native dependencies, and Codev does not compile them from source.`, - 'Install Node.js 22 or 24 (for example: winget install OpenJS.NodeJS.LTS), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', + 'Install Node.js 22 (for example: winget install OpenJS.NodeJS.LTS), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', ].join('\n'); } diff --git a/packages/codev/src/__tests__/doctor.test.ts b/packages/codev/src/__tests__/doctor.test.ts index a2d2fba9e..c1b6864f8 100644 --- a/packages/codev/src/__tests__/doctor.test.ts +++ b/packages/codev/src/__tests__/doctor.test.ts @@ -170,7 +170,7 @@ describe('doctor command', () => { vi.mocked(spawnSync).mockImplementation((cmd: string, args?: string[]) => { const arg = args?.[0] || ''; const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', 'claude': '1.0.0', @@ -192,6 +192,32 @@ describe('doctor command', () => { expect(result).toBe(0); }); + it('fails on Node 20, below the Node 22 floor (#1944)', async () => { + vi.mocked(execSync).mockImplementation((cmd: string) => { + if (cmd.includes('which')) return Buffer.from('/usr/bin/command'); + if (cmd.includes('gh auth status')) return Buffer.from('Logged in'); + return Buffer.from(''); + }); + vi.mocked(spawnSync).mockImplementation((cmd: string) => { + const responses: Record = { + 'node': 'v20.18.0', + 'tmux': 'tmux 3.4', + 'git': 'git version 2.40.0', + 'claude': '1.0.0', + 'gemini': '0.1.0', + 'codex': '0.60.0', + }; + const out = responses[cmd] || 'working'; + return { status: 0, stdout: out, stderr: '', signal: null, output: [null, out, ''], pid: 0 }; + }); + + const { doctor } = await import('../commands/doctor.js'); + const result = await doctor(); + expect(result).toBe(1); + const printed = vi.mocked(console.log).mock.calls.map((call) => String(call[0])).join('\n'); + expect(printed).toContain('need >= 22.0.0'); + }); + it('prints no Windows prerequisites section on POSIX (Spec 1658: POSIX output unchanged)', async () => { vi.mocked(execSync).mockImplementation(() => Buffer.from('/usr/bin/command')); vi.mocked(spawnSync).mockImplementation(() => ({ @@ -290,7 +316,7 @@ describe('doctor command', () => { vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', }; @@ -335,7 +361,7 @@ describe('doctor command', () => { vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'git': 'git version 2.40.0', }; return { @@ -377,7 +403,7 @@ describe('doctor command', () => { vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'git': 'git version 2.40.0', }; return { @@ -432,7 +458,7 @@ describe('doctor command', () => { return Buffer.from(''); }); vi.mocked(spawnSync).mockImplementation((cmd: string) => { - const responses: Record = { node: 'v20.0.0', git: 'git version 2.40.0' }; + const responses: Record = { node: 'v22.0.0', git: 'git version 2.40.0' }; return { status: 0, stdout: responses[cmd] || 'working', stderr: '', signal: null, output: [null, responses[cmd] || 'working', ''], pid: 0, @@ -550,7 +576,7 @@ describe('doctor command', () => { vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', 'claude': '1.0.0', @@ -610,7 +636,7 @@ describe('doctor command', () => { vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', 'claude': '1.0.0', @@ -676,7 +702,7 @@ describe('doctor command', () => { }; } const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', 'claude': '1.0.0', @@ -766,7 +792,7 @@ describe('doctor command', () => { }; } const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', 'claude': '1.0.0', @@ -834,7 +860,7 @@ describe('doctor command', () => { }); vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - node: 'v20.0.0', tmux: 'tmux 3.4', git: 'git version 2.40.0', + node: 'v22.0.0', tmux: 'tmux 3.4', git: 'git version 2.40.0', claude: '1.0.0', codex: '0.60.0', }; return { @@ -978,7 +1004,7 @@ describe('doctor command', () => { }); vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - node: 'v20.0.0', git: 'git version 2.40.0', claude: '1.0.0', + node: 'v22.0.0', git: 'git version 2.40.0', claude: '1.0.0', }; return { status: 0, stdout: responses[cmd] || 'working', stderr: '', @@ -1080,7 +1106,7 @@ describe('doctor command', () => { } const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', 'claude': '1.0.0', @@ -1176,7 +1202,7 @@ describe('doctor command', () => { }); vi.mocked(spawnSync).mockImplementation((cmd: string) => ({ status: 0, - stdout: cmd === 'node' ? 'v20.0.0' : cmd === 'git' ? 'git version 2.40.0' : 'working', + stdout: cmd === 'node' ? 'v22.0.0' : cmd === 'git' ? 'git version 2.40.0' : 'working', stderr: '', signal: null, output: [null, 'working', ''], @@ -1228,7 +1254,7 @@ describe('doctor command', () => { } const responses: Record = { - 'node': 'v20.0.0', + 'node': 'v22.0.0', 'tmux': 'tmux 3.4', 'git': 'git version 2.40.0', 'claude': '1.0.0', @@ -1324,7 +1350,7 @@ describe('doctor command', () => { }); vi.mocked(spawnSync).mockImplementation((cmd: string) => { const responses: Record = { - node: 'v20.0.0', tmux: 'tmux 3.4', git: 'git version 2.40.0', codex: '0.60.0', + node: 'v22.0.0', tmux: 'tmux 3.4', git: 'git version 2.40.0', codex: '0.60.0', }; const stdout = responses[cmd] || 'working'; return { status: 0, stdout, stderr: '', signal: null, output: [null, stdout, ''], pid: 0 }; diff --git a/packages/codev/src/__tests__/native-deps-guard.test.ts b/packages/codev/src/__tests__/native-deps-guard.test.ts index 5c0ca4448..83b64bf55 100644 --- a/packages/codev/src/__tests__/native-deps-guard.test.ts +++ b/packages/codev/src/__tests__/native-deps-guard.test.ts @@ -1,8 +1,9 @@ /** * Spec 1658 Phase 10: the native-dependency install guard. The guard logic - * (scripts/native-deps-guard.mjs) is pure and tested here on any host; the - * real install on Windows (Node 20 refused before node-gyp, Node 22 installs) - * is the `install-guard` job of windows.yml. + * (scripts/native-deps-guard.mjs) is pure and tested here on any host, + * including its refusal of an unsupported Node; the real install on Windows + * (Node 22 installs from prebuilds, node-gyp never runs) is the + * `install-guard` job of windows.yml. */ import { describe, expect, it } from 'vitest'; @@ -45,7 +46,7 @@ describe('checkWindowsNodeForPrebuilds', () => { it('refuses Node 20 (no better-sqlite3 prebuild: the source-build fallback) with the supported versions', () => { const message = checkWindowsNodeForPrebuilds({ platform: 'win32', arch: 'x64', abi: '115', nodeVersion: 'v20.18.0' }); - expect(message).toContain('native Windows needs Node.js 22 or 24'); + expect(message).toContain('native Windows needs Node.js 22 (LTS)'); expect(message).toContain('v20.18.0 (win32-x64)'); expect(message).toContain('does not compile them from source'); }); @@ -72,7 +73,7 @@ describe('runtime twin of the message', () => { forceHostPlatform('win32'); const explained = explainNativeLoadFailure(loadFailure) as Error; - expect(explained.message).toContain('native Windows needs Node.js 22 or 24'); + expect(explained.message).toContain('native Windows needs Node.js 22 (LTS)'); expect(explained.message).toContain('NODE_MODULE_VERSION 115'); expect(explained.cause).toBe(loadFailure); const other = new Error('SQLITE_BUSY: database is locked'); @@ -90,7 +91,7 @@ describe('node-pty binding load failures', () => { it('withNativeLoadExplanation rethrows a load failure explained on Windows, anything else as is', () => { forceHostPlatform('win32'); expect(() => withNativeLoadExplanation(() => { throw new Error('Failed to load native module: conpty.node'); })) - .toThrow('native Windows needs Node.js 22 or 24'); + .toThrow('native Windows needs Node.js 22 (LTS)'); expect(() => withNativeLoadExplanation(() => { throw new Error('boom'); })).toThrow(/^boom$/); expect(withNativeLoadExplanation(() => 42)).toBe(42); }); @@ -120,8 +121,8 @@ describe('package wiring', () => { expect(pkg.files).toEqual(expect.arrayContaining(['scripts/preinstall.mjs', 'scripts/native-deps-guard.mjs', 'scripts/postinstall.mjs'])); }); - it('keeps engines.node at >=20 so POSIX installs are unaffected', () => { - expect(pkg.engines.node).toBe('>=20.0.0'); + it('declares the Node 22 floor in engines.node (#1944)', () => { + expect(pkg.engines.node).toBe('>=22.0.0'); }); it('preinstall is a no-op off Windows and on a supported Windows Node', () => { diff --git a/packages/codev/src/agent-farm/__tests__/spec-1658-native-load-commands.test.ts b/packages/codev/src/agent-farm/__tests__/spec-1658-native-load-commands.test.ts index 5811ad3dc..5aa952bf0 100644 --- a/packages/codev/src/agent-farm/__tests__/spec-1658-native-load-commands.test.ts +++ b/packages/codev/src/agent-farm/__tests__/spec-1658-native-load-commands.test.ts @@ -47,13 +47,13 @@ describe('a better-sqlite3 binding that cannot load', () => { } catch (err) { caught = err as Error; } - expect(caught?.message).toContain('native Windows needs Node.js 22 or 24'); + expect(caught?.message).toContain('native Windows needs Node.js 22 (LTS)'); expect((caught?.cause as Error).message).toBe(LOAD_ERROR); }); it('Windows: afx whoami fails with the supported-versions message instead of degrading', () => { forceHostPlatform('win32'); - expect(() => resolveIdentity({ CODEV_ARCHITECT_NAME: 'main' })).toThrow('native Windows needs Node.js 22 or 24'); + expect(() => resolveIdentity({ CODEV_ARCHITECT_NAME: 'main' })).toThrow('native Windows needs Node.js 22 (LTS)'); }); it('POSIX: afx whoami keeps its degrade path (no database, identity from the env)', () => { diff --git a/packages/codev/src/commands/doctor.ts b/packages/codev/src/commands/doctor.ts index 94931c0a3..3df1c0d13 100644 --- a/packages/codev/src/commands/doctor.ts +++ b/packages/codev/src/commands/doctor.ts @@ -743,7 +743,7 @@ const CORE_DEPENDENCIES: Dependency[] = [ command: 'node', versionArg: '--version', versionExtract: (output) => output.replace(/^v/, ''), - minVersion: '18.0.0', + minVersion: '22.0.0', required: true, installHint: { macos: 'brew install node', diff --git a/packages/codev/src/lib/native-deps.ts b/packages/codev/src/lib/native-deps.ts index 1a6000768..8d6b9f71d 100644 --- a/packages/codev/src/lib/native-deps.ts +++ b/packages/codev/src/lib/native-deps.ts @@ -13,14 +13,14 @@ import { isWindows } from './platform.js'; /** The Node versions Codev documents and tests on native Windows. */ -export const SUPPORTED_WINDOWS_NODE = 'Node.js 22 or 24 (LTS), x64 or arm64'; +export const SUPPORTED_WINDOWS_NODE = 'Node.js 22 (LTS), x64 or arm64'; /** The supported-versions message, as printed by the install guard. */ export function unsupportedWindowsNodeMessage(nodeVersion: string, arch: string): string { return [ `@cluesmith/codev: native Windows needs ${SUPPORTED_WINDOWS_NODE}.`, `This is Node.js ${nodeVersion} (win32-${arch}), which has no prebuilt binary for Codev's native dependencies, and Codev does not compile them from source.`, - 'Install Node.js 22 or 24 (for example: winget install OpenJS.NodeJS.LTS), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', + 'Install Node.js 22 (for example: winget install OpenJS.NodeJS.LTS), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', ].join('\n'); } diff --git a/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts b/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts index c9888764b..b7932308c 100644 --- a/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts +++ b/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts @@ -42,7 +42,7 @@ describe('PtySession.spawn with a binding that cannot load', () => { forceHostPlatform('win32'); spawnImpl.fn = () => { throw new Error(CONPTY_LOAD_ERROR); }; const err = await session().spawn().then(() => null, (e: Error) => e); - expect(err?.message).toContain('native Windows needs Node.js 22 or 24'); + expect(err?.message).toContain('native Windows needs Node.js 22 (LTS)'); expect(err?.message).toContain('conpty.node'); expect((err?.cause as Error).message).toBe(CONPTY_LOAD_ERROR); }); diff --git a/scripts/windows-install-guard-check.mjs b/scripts/windows-install-guard-check.mjs index 0a0ca8bb5..2aa6b8f55 100644 --- a/scripts/windows-install-guard-check.mjs +++ b/scripts/windows-install-guard-check.mjs @@ -34,7 +34,7 @@ import { fileURLToPath } from 'node:url'; const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const [mode, packDir] = process.argv.slice(2); -const SUPPORTED_MESSAGE = 'native Windows needs Node.js 22 or 24'; +const SUPPORTED_MESSAGE = 'native Windows needs Node.js 22 (LTS)'; function fail(reason, output) { console.error(`FAIL (${mode}, Node ${process.version}): ${reason}`); From cbc7f37505cc6f522377f36add97ecdca785d901 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:04:51 +1100 Subject: [PATCH 03/14] chore(porch): 1944 pr phase-transition --- .../projects/1944-raise-the-node-js-floor-to-22-/status.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml index fd3b92dfb..2c229c115 100644 --- a/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml +++ b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml @@ -1,7 +1,7 @@ id: '1944' title: raise-the-node-js-floor-to-22- protocol: air -phase: implement +phase: pr plan_phases: [] current_plan_phase: null gates: @@ -11,4 +11,4 @@ iteration: 1 build_complete: false history: [] started_at: '2026-11-24T01:00:19.199Z' -updated_at: '2026-11-24T01:00:19.200Z' +updated_at: '2026-11-24T01:04:51.009Z' From e594ab6444660dcf9361116a869d5f23514d0782 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:08:43 +1100 Subject: [PATCH 04/14] [Air #1944] fix: Remaining Node floor references and a Node 22 winget id (CMAP) --- INSTALL.md | 2 +- apps/vscode/walkthroughs/install.md | 2 +- codev-skeleton/resources/commands/codev.md | 4 ++-- codev/resources/arch.md | 4 ++-- codev/resources/commands/codev.md | 4 ++-- codev/resources/lessons-learned.md | 2 +- packages/codev/scripts/native-deps-guard.mjs | 2 +- packages/codev/src/agent-farm/lib/keep-files.ts | 3 +-- packages/codev/src/lib/native-deps.ts | 2 +- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 6d7a3a7e0..80f25f6f9 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -398,7 +398,7 @@ For projects with parallelizable components, Codev includes the Architect-Builde After installing `@cluesmith/codev` via npm, ensure these dependencies are installed: -- **Node.js** 18+ (includes node-pty for terminal sessions) +- **Node.js** 22+ (includes node-pty for terminal sessions) - **git** 2.5+ (with worktree support) Check with: diff --git a/apps/vscode/walkthroughs/install.md b/apps/vscode/walkthroughs/install.md index ca618c6d7..fe66f6677 100644 --- a/apps/vscode/walkthroughs/install.md +++ b/apps/vscode/walkthroughs/install.md @@ -1,6 +1,6 @@ ## Install the Codev CLI -> **Prerequisite:** Node.js **20 or newer** must be on your `PATH` +> **Prerequisite:** Node.js **22 or newer** must be on your `PATH` > (VS Code's own bundled Node doesn't count). Get it from > [nodejs.org](https://nodejs.org). Check with `node --version`. diff --git a/codev-skeleton/resources/commands/codev.md b/codev-skeleton/resources/commands/codev.md index 9d7a99b47..9cfb81472 100644 --- a/codev-skeleton/resources/commands/codev.md +++ b/codev-skeleton/resources/commands/codev.md @@ -136,7 +136,7 @@ codev doctor Verifies that all required dependencies are installed and properly configured: **Core Dependencies (required):** -- Node.js (>= 18.0.0) +- Node.js (>= 22.0.0) - git (>= 2.5.0) - gh (GitHub CLI, authenticated) @@ -167,7 +167,7 @@ Codev Doctor - Checking your environment Core Dependencies (required for Agent Farm) - ✓ Node.js 20.10.0 + ✓ Node.js 22.12.0 ✓ git 2.42.0 ✓ gh authenticated ✓ @cluesmith/codev 1.0.0 diff --git a/codev/resources/arch.md b/codev/resources/arch.md index 7e6ea780b..4a5178b67 100644 --- a/codev/resources/arch.md +++ b/codev/resources/arch.md @@ -1099,8 +1099,8 @@ branches are testable on macOS/Linux. `lib/host-executable.ts` (host `which` and shell-free spawn form), `windows/msys-path.ts` (path translation across the Git Bash boundary), `lib/host-paths.ts`, and `agent-farm/lib/worktree-links.ts` (symlink, else junction / hard link / copy). -- **Install**: Windows Node 22/24 only (better-sqlite3 prebuilds); a preinstall gate fails other - versions with that message instead of a node-gyp build. `engines.node` stays `>=20` for POSIX. +- **Install**: Windows Node needs a better-sqlite3 prebuild (Node 22 is the supported, tested version); a + preinstall gate fails other versions with that message instead of a node-gyp build. `engines.node` is `>=22` (#1944). - **Workspace keys** (finding M6): Windows paths are case-insensitive but every workspace key (Tower's registry, `workspace_path` in global.db) is an exact string, and VS Code (`c:\`) and Git Bash (`C:\`) spell one directory differently. Invariant: every raw workspace path that diff --git a/codev/resources/commands/codev.md b/codev/resources/commands/codev.md index 22be5e267..97b270a3c 100644 --- a/codev/resources/commands/codev.md +++ b/codev/resources/commands/codev.md @@ -136,7 +136,7 @@ codev doctor Verifies that all required dependencies are installed and properly configured: **Core Dependencies (required):** -- Node.js (>= 18.0.0) +- Node.js (>= 22.0.0) - git (>= 2.5.0) - gh (GitHub CLI, authenticated) @@ -167,7 +167,7 @@ Codev Doctor - Checking your environment Core Dependencies (required for Agent Farm) - ✓ Node.js 20.10.0 + ✓ Node.js 22.12.0 ✓ git 2.42.0 ✓ gh authenticated ✓ @cluesmith/codev 1.0.0 diff --git a/codev/resources/lessons-learned.md b/codev/resources/lessons-learned.md index 0c3bc3b7d..5463a4657 100644 --- a/codev/resources/lessons-learned.md +++ b/codev/resources/lessons-learned.md @@ -593,7 +593,7 @@ Generalizable wisdom extracted from review documents, ordered by impact. Updated - [From 1144] VS Code evaluates **unset** context keys as false, and views render before the owning extension activates. Any `when`/`viewsWelcome` clause built from negated keys (`!codev.hasWorkspace`) is therefore TRUE during the workbench-restore-to-activation gap and asserts a wrong state (we flashed "Open a folder to use Codev" inside a codev workspace for ~2s). Fix pattern: a `stateKnown` key set first-thing in `activate()`, required by every such clause, plus a `!stateKnown` "Loading…" welcome entry to replace VS Code's raw "no data provider registered" placeholder (welcome content also renders pre-provider-registration). - [From 799] VSCode's built-in Git `FileDecorationProvider` matches resources by repository **path**, not by URI scheme, and every extension-provided decoration shares a fixed `weight: 10` — so an extension cannot outrank Git in the decoration color merge. To stop Git from tinting a custom TreeView row's label (e.g. grey "ignored" on gitignored worktree paths), the row's `resourceUri` must use a **synthetic path that resolves into no open repository**; a non-`file` scheme alone is insufficient because Git never checks the scheme. The file-type icon still resolves off the basename at the path tail. - [From #791] VSCode walkthrough steps without explicit `completionEvents` fall back to `onStepSelected` — they auto-tick the moment the step is *viewed*, which reads as false "done" progress (and the first step auto-selects on open, so it looks pre-completed). For a step with a real success condition, wire `completionEvents` to an observable signal — `onContext:`, `onCommand:`, `onSettingChanged:` — so the checkmark means "achieved", not "seen". Tie completion to *outcome* (`onContext:codev.cliReady`), not to the *attempt* (`onCommand:recheck`), or a failed retry still ticks the step. Pure "read-and-do" steps (run a command in your own terminal) have no observable signal and are fine left on the view-default. -- [From #791] A running VSCode extension does **not** imply a usable system Node/npm: VSCode ships its own bundled Node for the extension host, never exposed on the user's shell `PATH`. Any "run this CLI / `npm install -g`" guidance must state the Node prerequisite explicitly (codev needs ≥20) and resolve CLI binaries from the workspace/`PATH`, not assume the extension's runtime. +- [From #791] A running VSCode extension does **not** imply a usable system Node/npm: VSCode ships its own bundled Node for the extension host, never exposed on the user's shell `PATH`. Any "run this CLI / `npm install -g`" guidance must state the Node prerequisite explicitly (codev needs ≥22) and resolve CLI binaries from the workspace/`PATH`, not assume the extension's runtime. - [From #952] When grouping a UI by an **open/growing enum**, map the raw values onto a **closed canonical set** instead of minting one group per distinct value. Grouping the Builders tree by raw `protocolPhase` would yield ~19 group headers across the 9 protocols (and grow with every new protocol); folding all phase ids into 6 fixed lifecycle stages via a `PHASE_TO_STAGE` map caps the tree at a constant 7 groups forever — an unmapped future phase falls into a bounded `unknown` bucket rather than expanding the set. Bound the axis, don't enumerate it. - [From #952] For a view control that switches between **two equal modes** (not on/off), the idiomatic VSCode pattern is **two commands with mutually-exclusive `when`-clauses** on a context key (only one renders at a time) — this is what built-in list/tree toggles use and it allows a distinct icon per target. VSCode *also* supports a single-button `toggled` menu property (renders pressed/highlighted when a `when`-expr is true), but that shows one icon only and reads as on/off, so it fits genuine binary toggles (e.g. a "show all" eye) better than a two-equal-modes axis swap. - [From #952] When several behaviors vary together per mode (here: bucketing fn, expansion store, row prefix, flatten rule all switch on stage-vs-area), bundle them behind **one strategy object per mode** rather than scattering `if (mode === …)` across the consumer. The provider holds `Record` + an `active()` accessor and delegates; adding a mode becomes one new object, and the correlated decisions can't drift out of sync. diff --git a/packages/codev/scripts/native-deps-guard.mjs b/packages/codev/scripts/native-deps-guard.mjs index 297cbbdc1..d70e372df 100644 --- a/packages/codev/scripts/native-deps-guard.mjs +++ b/packages/codev/scripts/native-deps-guard.mjs @@ -30,7 +30,7 @@ export function unsupportedWindowsNodeMessage(nodeVersion, arch) { return [ `@cluesmith/codev: native Windows needs ${SUPPORTED_WINDOWS_NODE}.`, `This is Node.js ${nodeVersion} (win32-${arch}), which has no prebuilt binary for Codev's native dependencies, and Codev does not compile them from source.`, - 'Install Node.js 22 (for example: winget install OpenJS.NodeJS.LTS), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', + 'Install Node.js 22 (for example: winget install OpenJS.NodeJS.22), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', ].join('\n'); } diff --git a/packages/codev/src/agent-farm/lib/keep-files.ts b/packages/codev/src/agent-farm/lib/keep-files.ts index b0cef21b1..0db514434 100644 --- a/packages/codev/src/agent-farm/lib/keep-files.ts +++ b/packages/codev/src/agent-farm/lib/keep-files.ts @@ -52,8 +52,7 @@ function gitList(worktree: string, args: string[]): string[] { } /** - * A directory entry (`dir/`, e.g. a nested repository) expands to the files under it. Walked by - * hand: `readdirSync`'s `recursive` option needs Node 20.1, and `engines` allows 20.0. + * A directory entry (`dir/`, e.g. a nested repository) expands to the files under it. */ function expand(worktree: string, rel: string): string[] { if (!rel.endsWith('/')) return [rel]; diff --git a/packages/codev/src/lib/native-deps.ts b/packages/codev/src/lib/native-deps.ts index 8d6b9f71d..a4dd024cb 100644 --- a/packages/codev/src/lib/native-deps.ts +++ b/packages/codev/src/lib/native-deps.ts @@ -20,7 +20,7 @@ export function unsupportedWindowsNodeMessage(nodeVersion: string, arch: string) return [ `@cluesmith/codev: native Windows needs ${SUPPORTED_WINDOWS_NODE}.`, `This is Node.js ${nodeVersion} (win32-${arch}), which has no prebuilt binary for Codev's native dependencies, and Codev does not compile them from source.`, - 'Install Node.js 22 (for example: winget install OpenJS.NodeJS.LTS), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', + 'Install Node.js 22 (for example: winget install OpenJS.NodeJS.22), then run the install again. WSL 2 is the other supported way to run Codev on Windows.', ].join('\n'); } From eb1d38735f0f845f398b4f3bb543e6742da5994e Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:11:56 +1100 Subject: [PATCH 05/14] [Air #1944] fix: codev skill doctor floor, regenerated skill hashes, guard comments (CMAP) --- .claude/skills/codev/SKILL.md | 2 +- .codex/skills/codev/SKILL.md | 2 +- codev-skeleton/.claude/skills/codev/SKILL.md | 2 +- codev-skeleton/.codex/skills/codev/SKILL.md | 2 +- packages/codev/scripts/native-deps-guard.mjs | 3 ++- packages/codev/src/lib/shipped-skill-hashes.ts | 2 ++ scripts/windows-install-guard-check.mjs | 4 +++- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.claude/skills/codev/SKILL.md b/.claude/skills/codev/SKILL.md index 5e9639330..fb27e3230 100644 --- a/.claude/skills/codev/SKILL.md +++ b/.claude/skills/codev/SKILL.md @@ -57,7 +57,7 @@ codev update --agent # Agent mode: JSON stdout, no interactive merge ## codev doctor -Checks dependencies: Node.js (>=18), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). +Checks dependencies: Node.js (>=22), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). ```bash codev doctor diff --git a/.codex/skills/codev/SKILL.md b/.codex/skills/codev/SKILL.md index 5e9639330..fb27e3230 100644 --- a/.codex/skills/codev/SKILL.md +++ b/.codex/skills/codev/SKILL.md @@ -57,7 +57,7 @@ codev update --agent # Agent mode: JSON stdout, no interactive merge ## codev doctor -Checks dependencies: Node.js (>=18), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). +Checks dependencies: Node.js (>=22), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). ```bash codev doctor diff --git a/codev-skeleton/.claude/skills/codev/SKILL.md b/codev-skeleton/.claude/skills/codev/SKILL.md index 5e9639330..fb27e3230 100644 --- a/codev-skeleton/.claude/skills/codev/SKILL.md +++ b/codev-skeleton/.claude/skills/codev/SKILL.md @@ -57,7 +57,7 @@ codev update --agent # Agent mode: JSON stdout, no interactive merge ## codev doctor -Checks dependencies: Node.js (>=18), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). +Checks dependencies: Node.js (>=22), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). ```bash codev doctor diff --git a/codev-skeleton/.codex/skills/codev/SKILL.md b/codev-skeleton/.codex/skills/codev/SKILL.md index 5e9639330..fb27e3230 100644 --- a/codev-skeleton/.codex/skills/codev/SKILL.md +++ b/codev-skeleton/.codex/skills/codev/SKILL.md @@ -57,7 +57,7 @@ codev update --agent # Agent mode: JSON stdout, no interactive merge ## codev doctor -Checks dependencies: Node.js (>=18), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). +Checks dependencies: Node.js (>=22), git (>=2.5), your forge's CLI and its auth (`gh` on GitHub), and at least one working AI model — Claude (the installed `claude` CLI: version and login), Codex, OpenCode, or Gemini (via the Antigravity CLI, `agy`). ```bash codev doctor diff --git a/packages/codev/scripts/native-deps-guard.mjs b/packages/codev/scripts/native-deps-guard.mjs index d70e372df..ec028099f 100644 --- a/packages/codev/scripts/native-deps-guard.mjs +++ b/packages/codev/scripts/native-deps-guard.mjs @@ -15,7 +15,8 @@ * Node ABIs (`process.versions.modules`) for which better-sqlite3 ships a * win32 prebuilt binary: Node 22 (127), 24 (137), 25 (141) and 26 (147), as * measured for better-sqlite3 12.10 (Spec 1658 audit, fact 1.1). Update this - * list when the dependency adds prebuilds. + * list when the dependency adds prebuilds. Broader than the tested set: CI + * tests Node 22 only (#1944). */ export const WINDOWS_PREBUILD_NODE_ABIS = ['127', '137', '141', '147']; diff --git a/packages/codev/src/lib/shipped-skill-hashes.ts b/packages/codev/src/lib/shipped-skill-hashes.ts index fbaceffe8..1aca8ff13 100644 --- a/packages/codev/src/lib/shipped-skill-hashes.ts +++ b/packages/codev/src/lib/shipped-skill-hashes.ts @@ -84,6 +84,7 @@ export const SHIPPED_SKILL_HASHES: Record = { '696740d1171eef744642094a33751680cc3bb45adda4a3ffd0f0477decc07082', '74162f6225f2e33a6236b7f79accaee5b3a4d51f15aa2c0c16bedd3ce1019914', '9039170e6dae4b3041ad573695dedbb0cad3aa55a2ff4086e5916bb6e7f88800', + 'c08caa8c7a56023a67d52f7859bff3faa34f1a8c17eccd7bd2e4a580223aa830', 'ccc9e06b0524da29c71cff4c1b175bed02cce3525b5c544a6d4186d9b9612053', 'e77f9ad767b7eb2f174839498851097950db72c467490b23d0bfadb0bb64a57a', 'eaaa1e9342d76df19841ece0e093631b13b7b817d78377130a4728efe67627db', @@ -193,6 +194,7 @@ export const SHIPPED_SKILL_HASHES: Record = { '60c64eb94401c1e89c3b48f7e7f809c269c0e7cda534177127c5db3d59f3487f', '74162f6225f2e33a6236b7f79accaee5b3a4d51f15aa2c0c16bedd3ce1019914', '9039170e6dae4b3041ad573695dedbb0cad3aa55a2ff4086e5916bb6e7f88800', + 'c08caa8c7a56023a67d52f7859bff3faa34f1a8c17eccd7bd2e4a580223aa830', 'ccc9e06b0524da29c71cff4c1b175bed02cce3525b5c544a6d4186d9b9612053', 'e77f9ad767b7eb2f174839498851097950db72c467490b23d0bfadb0bb64a57a', ], diff --git a/scripts/windows-install-guard-check.mjs b/scripts/windows-install-guard-check.mjs index 2aa6b8f55..de6946b57 100644 --- a/scripts/windows-install-guard-check.mjs +++ b/scripts/windows-install-guard-check.mjs @@ -12,7 +12,9 @@ * npm's own node-gyp shim. So the stub is placed in `/node_modules/.bin`, * and the control project and the install prefix both live under ``. * - * Usage (from the repo root, with the four packed tarballs in ): + * Usage (from the repo root, with the four packed tarballs in ). The + * workflow runs only --supported (Node 22, #1944); --control and --unsupported + * are for manual runs on a Node with no prebuild: * node scripts/windows-install-guard-check.mjs --control * better-sqlite3 alone, with no guard in front of it: the stub MUST be * invoked on this Node (proves the stub intercepts the fallback). From eb95d3b044b2c7419862ffbfbebd4bb7f4f6ab3c Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:12:49 +1100 Subject: [PATCH 06/14] chore(porch): 1944 record PR #1962 --- .../1944-raise-the-node-js-floor-to-22-/status.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml index 2c229c115..b0a03358b 100644 --- a/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml +++ b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml @@ -11,4 +11,9 @@ iteration: 1 build_complete: false history: [] started_at: '2026-11-24T01:00:19.199Z' -updated_at: '2026-11-24T01:04:51.009Z' +updated_at: '2026-11-24T01:12:49.389Z' +pr_history: + - phase: pr + pr_number: 1962 + branch: builder/air-1944 + created_at: '2026-11-24T01:12:49.389Z' From 77bc8d7dadb754954b08050266aef38216c606d4 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:12:57 +1100 Subject: [PATCH 07/14] chore(porch): 1944 pr gate-requested --- .../projects/1944-raise-the-node-js-floor-to-22-/status.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml index b0a03358b..481aff409 100644 --- a/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml +++ b/codev/projects/1944-raise-the-node-js-floor-to-22-/status.yaml @@ -7,13 +7,15 @@ current_plan_phase: null gates: pr: status: pending + requested_at: '2026-11-24T01:12:57.453Z' iteration: 1 build_complete: false history: [] started_at: '2026-11-24T01:00:19.199Z' -updated_at: '2026-11-24T01:12:49.389Z' +updated_at: '2026-11-24T01:12:57.454Z' pr_history: - phase: pr pr_number: 1962 branch: builder/air-1944 created_at: '2026-11-24T01:12:49.389Z' +pr_ready_for_human: true From 0427bb3c25af71a96fa3f9f776dca378842e53f8 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:20:37 +1100 Subject: [PATCH 08/14] [Air #1944] fix: Integration review items 1-5 (doctor Linux hint, v22.x or newer, cloud-instances, keep-files comment, test title) --- codev-skeleton/DEPENDENCIES.md | 7 +++++-- codev/DEPENDENCIES.md | 7 +++++-- codev/resources/cloud-instances.md | 2 +- packages/codev/src/__tests__/native-deps-guard.test.ts | 2 +- packages/codev/src/agent-farm/lib/keep-files.ts | 4 +++- packages/codev/src/commands/doctor.ts | 2 +- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/codev-skeleton/DEPENDENCIES.md b/codev-skeleton/DEPENDENCIES.md index 63d68ba1a..3b774c481 100644 --- a/codev-skeleton/DEPENDENCIES.md +++ b/codev-skeleton/DEPENDENCIES.md @@ -47,7 +47,7 @@ sudo apt install -y nodejs build-essential python3 # Windows: the Node.js 22 installer from https://nodejs.org # Verify -node --version # Should show v22.x +node --version # Should show v22.x or newer ``` ### git @@ -202,8 +202,11 @@ xcode-select --install Most dependencies are available via apt: ```bash +# Node.js 22 from NodeSource (the distribution's nodejs package is older than 22) +curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - + # Core dependencies (build-essential and python3 build node-pty) -sudo apt install nodejs npm git build-essential python3 +sudo apt install nodejs git build-essential python3 # gh requires adding GitHub's apt repository (see above) ``` diff --git a/codev/DEPENDENCIES.md b/codev/DEPENDENCIES.md index 63d68ba1a..3b774c481 100644 --- a/codev/DEPENDENCIES.md +++ b/codev/DEPENDENCIES.md @@ -47,7 +47,7 @@ sudo apt install -y nodejs build-essential python3 # Windows: the Node.js 22 installer from https://nodejs.org # Verify -node --version # Should show v22.x +node --version # Should show v22.x or newer ``` ### git @@ -202,8 +202,11 @@ xcode-select --install Most dependencies are available via apt: ```bash +# Node.js 22 from NodeSource (the distribution's nodejs package is older than 22) +curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - + # Core dependencies (build-essential and python3 build node-pty) -sudo apt install nodejs npm git build-essential python3 +sudo apt install nodejs git build-essential python3 # gh requires adding GitHub's apt repository (see above) ``` diff --git a/codev/resources/cloud-instances.md b/codev/resources/cloud-instances.md index 68e6c7858..1086ac094 100644 --- a/codev/resources/cloud-instances.md +++ b/codev/resources/cloud-instances.md @@ -16,7 +16,7 @@ Example configuration for a GCP dev instance: ### Installed Tools -- Node.js v20.x +- Node.js v22.x - npm 10.x - Claude Code - Codex CLI diff --git a/packages/codev/src/__tests__/native-deps-guard.test.ts b/packages/codev/src/__tests__/native-deps-guard.test.ts index 83b64bf55..8f344e46f 100644 --- a/packages/codev/src/__tests__/native-deps-guard.test.ts +++ b/packages/codev/src/__tests__/native-deps-guard.test.ts @@ -36,7 +36,7 @@ describe('checkWindowsNodeForPrebuilds', () => { } }); - it('passes Node 22 and 24 on x64 and arm64 (the audited prebuild set)', () => { + it('passes Node 22 and 24 on x64 and arm64 (the audited prebuild set, broader than the tested Node 22)', () => { for (const arch of ['x64', 'arm64']) { expect(checkWindowsNodeForPrebuilds({ platform: 'win32', arch, abi: '127', nodeVersion: 'v22.11.0' })).toBeNull(); expect(checkWindowsNodeForPrebuilds({ platform: 'win32', arch, abi: '137', nodeVersion: 'v24.13.0' })).toBeNull(); diff --git a/packages/codev/src/agent-farm/lib/keep-files.ts b/packages/codev/src/agent-farm/lib/keep-files.ts index 0db514434..94a0b2bcc 100644 --- a/packages/codev/src/agent-farm/lib/keep-files.ts +++ b/packages/codev/src/agent-farm/lib/keep-files.ts @@ -52,7 +52,9 @@ function gitList(worktree: string, args: string[]): string[] { } /** - * A directory entry (`dir/`, e.g. a nested repository) expands to the files under it. + * A directory entry (`dir/`, e.g. a nested repository) expands to the files under it. Walked by + * hand on purpose: `readdirSync({ recursive: true })` also returns directories and joins names + * with `path.sep`, while this keeps regular files only and builds `/`-separated paths. */ function expand(worktree: string, rel: string): string[] { if (!rel.endsWith('/')) return [rel]; diff --git a/packages/codev/src/commands/doctor.ts b/packages/codev/src/commands/doctor.ts index 3df1c0d13..6ff03d0f4 100644 --- a/packages/codev/src/commands/doctor.ts +++ b/packages/codev/src/commands/doctor.ts @@ -747,7 +747,7 @@ const CORE_DEPENDENCIES: Dependency[] = [ required: true, installHint: { macos: 'brew install node', - linux: 'apt install nodejs npm', + linux: 'curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt install -y nodejs', }, }, { From f6b865192356e98171c2fc77646bf0240ad6e782 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:24:06 +1100 Subject: [PATCH 09/14] [Air #1944] fix: Say the install abort is no longer host-checked (owner ruling, item 6) --- .github/workflows/windows.yml | 5 +++-- codev/state/air-1944_thread.md | 2 ++ packages/codev/src/__tests__/native-deps-guard.test.ts | 10 ++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ddd1e3dbe..8f330ce6d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -18,8 +18,9 @@ run-name: "Windows: ${{ inputs.purpose || 'unlabelled' }}" # targeted runs the packages/codev vitest files matching `filter` (skipped when empty). # install-guard (install_guard=true) packs the branch packages, then installs them globally # with node-gyp replaced by a failing stub: the install must succeed from prebuilds -# and never reach the stub. (The guard's refusal of an unsupported Node is covered -# by its unit tests.) +# and never reach the stub. No job checks on a real host that an unsupported Node's +# install aborts before node-gyp (owner ruling, #1944): the unit tests cover only the +# guard's decision and message, not preinstall's exit or npm's script order. # unit, cli-e2e, post-release-e2e (suites=true) the full suites on windows-latest: # unit runs the sdk, core and codev unit tests; cli-e2e runs the built CLI tests; # post-release-e2e packs the dispatched ref's packages and installs those tarballs diff --git a/codev/state/air-1944_thread.md b/codev/state/air-1944_thread.md index e86fdf514..956fa3982 100644 --- a/codev/state/air-1944_thread.md +++ b/codev/state/air-1944_thread.md @@ -5,3 +5,5 @@ - Guard message: "Node.js 22 (LTS), x64 or arm64" in both twins; ABI allow list unchanged (24/25/26 still install). - No tracked `.npmrc` sets `engine-strict`, so a below-floor install on POSIX warns (EBADENGINE) and proceeds; on native Windows the preinstall guard still refuses an ABI with no prebuild. - Adjacent fix: `codev doctor` checked Node >= 18.0.0; now 22.0.0, with a Node 20 failure test. Doctor test fixtures moved from v20 to v22. +- PR #1962. CMAP (codex, claude) and the architect's integration review found more stale floor references and doc nits; all fixed. Doctor's Linux hint and the DEPENDENCIES.md apt block now use NodeSource setup_22.x. +- Item 6, owner ruling: the Node 20 install-guard refusal leg stays dropped. Comments now say the real install abort is no longer checked on a Windows host (the unit tests cover the decision and message only). diff --git a/packages/codev/src/__tests__/native-deps-guard.test.ts b/packages/codev/src/__tests__/native-deps-guard.test.ts index 8f344e46f..335b84e03 100644 --- a/packages/codev/src/__tests__/native-deps-guard.test.ts +++ b/packages/codev/src/__tests__/native-deps-guard.test.ts @@ -1,9 +1,11 @@ /** * Spec 1658 Phase 10: the native-dependency install guard. The guard logic - * (scripts/native-deps-guard.mjs) is pure and tested here on any host, - * including its refusal of an unsupported Node; the real install on Windows - * (Node 22 installs from prebuilds, node-gyp never runs) is the - * `install-guard` job of windows.yml. + * (scripts/native-deps-guard.mjs) is pure and tested here on any host: the + * decision to refuse an unsupported Node and the message it prints. These tests + * do not prove the real install aborts (preinstall exiting non-zero before + * npm reaches better-sqlite3's node-gyp fallback); since #1944 no job checks + * that on a host. The `install-guard` job of windows.yml checks only that + * Node 22 installs from prebuilds without node-gyp running. */ import { describe, expect, it } from 'vitest'; From 98946c79e9bc0702b26e1c4a260b820d43ce51aa Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 12:25:34 +1100 Subject: [PATCH 10/14] [Air #1944] docs: Correct stale Windows suite durations (about 7 minutes, not 50) --- .github/workflows/windows.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8f330ce6d..72c1021e3 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -49,7 +49,7 @@ on: required: false default: false suites: - description: 'Run the full unit, cli-e2e and post-release-e2e suites (about an hour)' + description: 'Run the full unit, cli-e2e and post-release-e2e suites (about 10 minutes)' type: boolean required: false default: false @@ -167,7 +167,8 @@ jobs: name: Targeted tests if: ${{ inputs.filter != '' }} runs-on: windows-latest - # The full unit suite (filter `src`) runs about 50 minutes on windows-latest. + # The full unit suite (filter `src`) runs about 7 minutes on windows-latest (measured 2026-11-24); + # the timeout leaves headroom for slow runners. timeout-minutes: 120 steps: - name: Checkout repository @@ -209,7 +210,8 @@ jobs: name: Unit tests if: ${{ inputs.suites }} runs-on: windows-latest - # The codev unit suite alone runs about 50 minutes on windows-latest. + # The sdk, core and codev unit suites run about 7 minutes on windows-latest (measured 2026-11-24); + # the timeout leaves headroom for slow runners. timeout-minutes: 120 steps: - name: Checkout repository From 0966555d5d096e1889449780522cda94547bc9b4 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 13:04:49 +1100 Subject: [PATCH 11/14] [Air #1944] fix: Load node-pty through one createRequire loader (empty import() bindings on Node 22.17+) --- codev/resources/lessons-learned.md | 2 ++ .../__tests__/send-integration.e2e.test.ts | 14 +++++-------- .../__tests__/node-pty-loader.test.ts | 20 +++++++++++++++++++ .../__tests__/pty-session-native-load.test.ts | 2 +- .../__tests__/pty-terminal-type.test.ts | 12 ++++++----- .../codev/src/terminal/node-pty-loader.ts | 20 +++++++++++++++++++ packages/codev/src/terminal/pty-session.ts | 13 ++++-------- packages/codev/src/terminal/shellper-main.ts | 11 +++------- 8 files changed, 62 insertions(+), 32 deletions(-) create mode 100644 packages/codev/src/terminal/__tests__/node-pty-loader.test.ts create mode 100644 packages/codev/src/terminal/node-pty-loader.ts diff --git a/codev/resources/lessons-learned.md b/codev/resources/lessons-learned.md index 5463a4657..4e6ff5b34 100644 --- a/codev/resources/lessons-learned.md +++ b/codev/resources/lessons-learned.md @@ -775,5 +775,7 @@ Generalizable wisdom extracted from review documents, ordered by impact. Updated - [From #1658] Reproduce a hang against the release that was current when it was reported before hunting a mechanism. The 2026-09-09 `afx tower start` hang did not reproduce on that release or the next, and the leading theory was ruled out by direct test. The hunt still paid off: `afx tower stop` printed "not running" and exited 0 on Windows while Tower stayed alive (its `lsof` lookup fails under `cmd.exe`). A command that exits 0 having done nothing is the failure to look for. +- [From #1944] **Load a native CommonJS module (node-pty) with `createRequire`, never a dynamic `import()`.** On Node 22.17+ in the pnpm workspace, Tower's `import('node-pty')` after a workspace activation resolved through the package's pnpm symlink, so node-pty was loaded a second time and `import()` returned that copy's empty bindings (`spawn` undefined, a 500 from `POST /api/terminals`). Node 22.16 and CI on Node 20 never showed it; a published install has no symlinks. All loads now go through `terminal/node-pty-loader.ts`, and tests mock that module rather than `node-pty`. + *Last updated: 2026-04-17 (Maintenance run 0007 — v3.0.0 pre-release)* *Source: codev/reviews/* diff --git a/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts b/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts index bad214d51..14499ea08 100644 --- a/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts +++ b/packages/codev/src/agent-farm/__tests__/send-integration.e2e.test.ts @@ -186,15 +186,11 @@ async function registerTerminal( type, roleId, // Register via the shellper (persistent) backend — the same path Tower - // uses for real builders/architects. The non-persistent fallback spawns - // node-pty directly via `await import('node-pty')`, which resolves the - // module's live named bindings to `undefined` inside Tower's deep ESM - // graph when run from the built `dist/` (a pre-existing Node ESM↔CJS - // interop quirk in `terminal/pty-session.ts`, unrelated to Spec 1313 — - // `terminal/shellper-main.ts` already works around it with createRequire). - // Shellper spawns in its own process, so it is immune. A shellper-backed - // session reports `command: ''` (see pty-manager.createSessionRaw), which - // still resolves to `no-profile` for the held-behavior assertion below. + // uses for real builders/architects. A shellper-backed session reports + // `command: ''` (see pty-manager.createSessionRaw), which still resolves + // to `no-profile` for the held-behavior assertion below. (The + // non-persistent path once failed here because `import('node-pty')` + // returned empty bindings; #1944 replaced it with terminal/node-pty-loader.ts.) persistent: true, }), }); diff --git a/packages/codev/src/terminal/__tests__/node-pty-loader.test.ts b/packages/codev/src/terminal/__tests__/node-pty-loader.test.ts new file mode 100644 index 000000000..a5593ee06 --- /dev/null +++ b/packages/codev/src/terminal/__tests__/node-pty-loader.test.ts @@ -0,0 +1,20 @@ +/** + * #1944: node-pty is loaded with `require` through one loader. A dynamic `import('node-pty')` + * inside Tower on Node 22.17+ (pnpm workspace) could return a second, empty copy of the module + * whose `spawn` was undefined. + */ + +import { describe, expect, it } from 'vitest'; +import { createRequire } from 'node:module'; +import { loadNodePty } from '../node-pty-loader.js'; + +describe('loadNodePty', () => { + it('returns the loaded node-pty module with a callable spawn', () => { + expect(typeof loadNodePty().spawn).toBe('function'); + }); + + it('returns the same module instance require holds, not a second copy', () => { + const require = createRequire(import.meta.url); + expect(loadNodePty()).toBe(require('node-pty')); + }); +}); diff --git a/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts b/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts index b7932308c..9d99f3221 100644 --- a/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts +++ b/packages/codev/src/terminal/__tests__/pty-session-native-load.test.ts @@ -12,7 +12,7 @@ import path from 'node:path'; const CONPTY_LOAD_ERROR = 'Failed to load native module: conpty.node, checked: build/Release, build/Debug, prebuilds/win32-x64/: Error: The specified module could not be found.'; const spawnImpl = vi.hoisted(() => ({ fn: (): unknown => { throw new Error('unset'); } })); -vi.mock('node-pty', () => ({ spawn: () => spawnImpl.fn() })); +vi.mock('../node-pty-loader.js', () => ({ loadNodePty: () => ({ spawn: () => spawnImpl.fn() }) })); vi.mock('../../lib/pty-command.js', () => ({ ptyCommand: (file: string, args: string[]) => ({ file, args }), })); diff --git a/packages/codev/src/terminal/__tests__/pty-terminal-type.test.ts b/packages/codev/src/terminal/__tests__/pty-terminal-type.test.ts index 024267af9..9f2af3caa 100644 --- a/packages/codev/src/terminal/__tests__/pty-terminal-type.test.ts +++ b/packages/codev/src/terminal/__tests__/pty-terminal-type.test.ts @@ -13,11 +13,13 @@ import os from 'node:os'; import path from 'node:path'; const spawned = vi.hoisted(() => ({ calls: [] as Array<{ name: string; env: Record }> })); -vi.mock('node-pty', () => ({ - spawn: (_file: string, _args: string[], opts: { name: string; env: Record }) => { - spawned.calls.push({ name: opts.name, env: opts.env }); - return { pid: 1, onData: () => {}, onExit: () => {}, write: () => {}, resize: () => {}, kill: () => {} }; - }, +vi.mock('../node-pty-loader.js', () => ({ + loadNodePty: () => ({ + spawn: (_file: string, _args: string[], opts: { name: string; env: Record }) => { + spawned.calls.push({ name: opts.name, env: opts.env }); + return { pid: 1, onData: () => {}, onExit: () => {}, write: () => {}, resize: () => {}, kill: () => {} }; + }, + }), })); vi.mock('../../lib/pty-command.js', () => ({ ptyCommand: (file: string, args: string[]) => ({ file, args }), diff --git a/packages/codev/src/terminal/node-pty-loader.ts b/packages/codev/src/terminal/node-pty-loader.ts new file mode 100644 index 000000000..dc8910751 --- /dev/null +++ b/packages/codev/src/terminal/node-pty-loader.ts @@ -0,0 +1,20 @@ +/** + * The one way Codev loads node-pty (used by PtySession and shellper). + * + * node-pty is a native CommonJS module, so it is loaded with `createRequire`, never a dynamic + * `import()`. Inside Tower, on Node 22.17 and later in the pnpm workspace, `import('node-pty')` + * could resolve through the package's pnpm symlink rather than its real path and return a + * second, empty copy of the module whose `spawn` is undefined (#1944). `require` resolves the + * real path and returns the single loaded module. + * + * A binding that cannot load on Windows surfaces with the supported-versions message (Spec 1658). + */ + +import { createRequire } from 'node:module'; +import { withNativeLoadExplanation } from '../lib/native-deps.js'; + +const require = createRequire(import.meta.url); + +export function loadNodePty(): typeof import('node-pty') { + return withNativeLoadExplanation(() => require('node-pty') as typeof import('node-pty')); +} diff --git a/packages/codev/src/terminal/pty-session.ts b/packages/codev/src/terminal/pty-session.ts index b01ff399d..8322d3a0b 100644 --- a/packages/codev/src/terminal/pty-session.ts +++ b/packages/codev/src/terminal/pty-session.ts @@ -40,7 +40,8 @@ import { isDeliberateExit } from './shellper-protocol.js'; import { killSessionTree } from '../lib/process-tree.js'; import { PTY_TERMINAL_TYPE, withPtyTerminalType } from '../lib/agent-env.js'; import { ptyCommand } from '../lib/pty-command.js'; -import { explainNativeLoadFailure, withNativeLoadExplanation } from '../lib/native-deps.js'; +import { withNativeLoadExplanation } from '../lib/native-deps.js'; +import { loadNodePty } from './node-pty-loader.js'; /** * Terminal delivery-signal bus (Spec 1313, Phase 5). @@ -259,14 +260,8 @@ export class PtySession extends EventEmitter { /** Spawn the PTY process. Must be called after construction. */ async spawn(): Promise { - // Dynamic import to avoid hard dependency at module level. A binding that cannot - // load on Windows surfaces with the supported-versions message (Spec 1658). - let nodePty: typeof import('node-pty'); - try { - nodePty = await import('node-pty'); - } catch (err) { - throw explainNativeLoadFailure(err); - } + // Loaded at spawn time through the one node-pty loader (#1944: never a dynamic import). + const nodePty = loadNodePty(); // Ensure log directory exists if (this.diskLogEnabled) { diff --git a/packages/codev/src/terminal/shellper-main.ts b/packages/codev/src/terminal/shellper-main.ts index d4f924107..721a1fa5e 100644 --- a/packages/codev/src/terminal/shellper-main.ts +++ b/packages/codev/src/terminal/shellper-main.ts @@ -27,7 +27,6 @@ import '../lib/process-bootstrap.js'; import fs from 'node:fs'; import path from 'node:path'; -import { createRequire } from 'node:module'; import { DEFER_PTY_DEADLINE_MS, ShellperProcess, type IShellperPty, type PtyOptions, type ShellperAuth } from './shellper-process.js'; import { SHELLPER_SECRET_ENV, isPipeEndpoint, removeStaleEndpoint } from './shellper-endpoint.js'; import { REPLAY_BUFFER_MAX_BYTES } from './shellper-replay-buffer.js'; @@ -35,10 +34,8 @@ import { isWindows } from '../lib/platform.js'; import { ptyCommand } from '../lib/pty-command.js'; import { withNativeLoadExplanation } from '../lib/native-deps.js'; import { killSessionTree } from '../lib/process-tree.js'; +import { loadNodePty } from './node-pty-loader.js'; -// createRequire enables importing native/CJS modules (like node-pty) from ESM. -// The package uses "type": "module", so bare `require()` is not available. -const require = createRequire(import.meta.url); /** EPIPE-safe stderr logger with ISO timestamp. Silently ignores broken pipe errors. */ function logStderr(message: string): void { @@ -96,10 +93,8 @@ function createRealPty(): IShellperPty { return { spawn(command: string, args: string[], options: PtyOptions): void { - // Load node-pty at spawn time via createRequire (defined at module level). - // node-pty is a native CJS module; createRequire handles ESM→CJS interop. - // A binding that cannot load on Windows surfaces with the supported-versions message (Spec 1658). - const nodePty = withNativeLoadExplanation(() => require('node-pty') as typeof import('node-pty')); + // Load node-pty at spawn time through the one node-pty loader (see node-pty-loader.ts). + const nodePty = loadNodePty(); ptyModule = nodePty; // A resize that landed before this spawn wins over the spawn options — it is the more // recent statement of the caller's intent (Issue #1482). From 84bee5fb23c9e949acf1726296abffbf7171db37 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 13:05:25 +1100 Subject: [PATCH 12/14] [Air #1944] chore: Thread note on the node-pty loader fix --- codev/state/air-1944_thread.md | 1 + 1 file changed, 1 insertion(+) diff --git a/codev/state/air-1944_thread.md b/codev/state/air-1944_thread.md index 956fa3982..c1ceb77a7 100644 --- a/codev/state/air-1944_thread.md +++ b/codev/state/air-1944_thread.md @@ -7,3 +7,4 @@ - Adjacent fix: `codev doctor` checked Node >= 18.0.0; now 22.0.0, with a Node 20 failure test. Doctor test fixtures moved from v20 to v22. - PR #1962. CMAP (codex, claude) and the architect's integration review found more stale floor references and doc nits; all fixed. Doctor's Linux hint and the DEPENDENCIES.md apt block now use NodeSource setup_22.x. - Item 6, owner ruling: the Node 20 install-guard refusal leg stays dropped. Comments now say the real install abort is no longer checked on a Windows host (the unit tests cover the decision and message only). +- Node 22 broke Tower Integration (3 tower-api.e2e tests, 500 "nodePty.spawn is not a function"). Root cause: on Node 22.17+ in the pnpm workspace, after a workspace activation, Tower's `import('node-pty')` resolved through the pnpm symlink and returned a second, empty copy of the module. Node 22.16 passes, 22.19/22.23 fail; dev/CI only. Architect chose option A: one `terminal/node-pty-loader.ts` (createRequire) used by pty-session and shellper-main, with tests mocking the loader. Local: tower e2e 175 passed, unit 8446 passed. From b3c16a8f8ec1ea320508acf080872d856a29c0d6 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 13:22:02 +1100 Subject: [PATCH 13/14] [Air #1944] fix: Mock the node-pty loader in the four remaining test files --- .../codev/src/agent-farm/__tests__/pty-last-data-at.test.ts | 4 ++-- .../codev/src/agent-farm/__tests__/typing-awareness.test.ts | 4 ++-- packages/codev/src/terminal/__tests__/pty-manager.test.ts | 4 ++-- .../src/terminal/__tests__/tower-shellper-integration.test.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/codev/src/agent-farm/__tests__/pty-last-data-at.test.ts b/packages/codev/src/agent-farm/__tests__/pty-last-data-at.test.ts index bc8401066..79de79bd1 100644 --- a/packages/codev/src/agent-farm/__tests__/pty-last-data-at.test.ts +++ b/packages/codev/src/agent-farm/__tests__/pty-last-data-at.test.ts @@ -8,7 +8,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; // Mock node-pty to avoid native module dependency -vi.mock('node-pty', () => ({ +vi.mock('../../terminal/node-pty-loader.js', () => ({ loadNodePty: () => ({ spawn: () => ({ onData: () => {}, onExit: () => {}, @@ -17,7 +17,7 @@ vi.mock('node-pty', () => ({ kill: () => {}, pid: 12345, }), -})); +}) })); const { PtySession } = await import('../../terminal/pty-session.js'); diff --git a/packages/codev/src/agent-farm/__tests__/typing-awareness.test.ts b/packages/codev/src/agent-farm/__tests__/typing-awareness.test.ts index a85ef35c2..d98032918 100644 --- a/packages/codev/src/agent-farm/__tests__/typing-awareness.test.ts +++ b/packages/codev/src/agent-farm/__tests__/typing-awareness.test.ts @@ -6,7 +6,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; // Mock node-pty so PtySession can be instantiated without a real PTY -vi.mock('node-pty', () => ({ +vi.mock('../../terminal/node-pty-loader.js', () => ({ loadNodePty: () => ({ default: { spawn: vi.fn(() => ({ onData: vi.fn(), @@ -17,7 +17,7 @@ vi.mock('node-pty', () => ({ kill: vi.fn(), })), }, -})); +}).default })); // Mock fs to avoid disk log creation vi.mock('node:fs', async () => { diff --git a/packages/codev/src/terminal/__tests__/pty-manager.test.ts b/packages/codev/src/terminal/__tests__/pty-manager.test.ts index 26bd940d9..2e41884c6 100644 --- a/packages/codev/src/terminal/__tests__/pty-manager.test.ts +++ b/packages/codev/src/terminal/__tests__/pty-manager.test.ts @@ -12,9 +12,9 @@ const mockPty = { kill: vi.fn(), }; -vi.mock('node-pty', () => ({ +vi.mock('../node-pty-loader.js', () => ({ loadNodePty: () => ({ spawn: vi.fn(() => mockPty), -})); +}) })); describe('TerminalManager', () => { let manager: TerminalManager; diff --git a/packages/codev/src/terminal/__tests__/tower-shellper-integration.test.ts b/packages/codev/src/terminal/__tests__/tower-shellper-integration.test.ts index adfdd7193..7c59c3ec0 100644 --- a/packages/codev/src/terminal/__tests__/tower-shellper-integration.test.ts +++ b/packages/codev/src/terminal/__tests__/tower-shellper-integration.test.ts @@ -82,7 +82,7 @@ class MockShellperClient extends EventEmitter implements IShellperClient { } // Mock node-pty so PtySession doesn't need it -vi.mock('node-pty', () => ({ +vi.mock('../node-pty-loader.js', () => ({ loadNodePty: () => ({ spawn: vi.fn(() => ({ pid: 12345, onData: vi.fn(), @@ -91,7 +91,7 @@ vi.mock('node-pty', () => ({ resize: vi.fn(), kill: vi.fn(), })), -})); +}) })); function makeConfig(overrides?: Partial): PtySessionConfig { return { From bcdfdff9bf305f8d62a2af358d1addcec8cfffb9 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Tue, 24 Nov 2026 13:25:48 +1100 Subject: [PATCH 14/14] [Air #1944] test: Size two CPU-bound tests' timeouts to their measured Node 22 CI cost --- .../codev/src/__tests__/windows-console-spawn-guard.test.ts | 5 ++++- packages/codev/src/agent-farm/__tests__/render-gate.test.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/codev/src/__tests__/windows-console-spawn-guard.test.ts b/packages/codev/src/__tests__/windows-console-spawn-guard.test.ts index 8a7ff3461..57c42d45f 100644 --- a/packages/codev/src/__tests__/windows-console-spawn-guard.test.ts +++ b/packages/codev/src/__tests__/windows-console-spawn-guard.test.ts @@ -207,6 +207,9 @@ describe('Issue #1919: spawns reachable from a console-less process are hidden', expect(modules).toContain('apps/vscode/src/commands/view-diff.ts'); }); + // Sized, not a hang guard (#1944): this parses every reachable module. On Node 22 CI (ubuntu-latest) + // it measured 3.1-6.4 s across ten runs and hit the default 5 s limit on four of them (Node 20 + // CI: 1.7-3.2 s; locally about 0.1 s). It asserts the scan's result, not its speed. it('every child_process call passes windowsHide or explains why not', () => { const violations = reachableModules().flatMap((file) => findUnhiddenSpawns(parse(file), path.relative(REPO_ROOT, file).split(path.sep).join('/'))); @@ -216,7 +219,7 @@ describe('Issue #1919: spawns reachable from a console-less process are hidden', 'Pass `windowsHide: true` in the options (a no-op on POSIX), route through commandLaunch(), or, if', 'the call never runs on Windows, add `// windows-console: ` on its line or the line above.', ].join('\n')).toEqual([]); - }); + }, 20_000); describe('the scanner', () => { const scan = (text: string): string[] => findUnhiddenSpawns(parse('fixture.ts', text), 'fixture.ts'); diff --git a/packages/codev/src/agent-farm/__tests__/render-gate.test.ts b/packages/codev/src/agent-farm/__tests__/render-gate.test.ts index 2fc62fc5c..5f506e6ab 100644 --- a/packages/codev/src/agent-farm/__tests__/render-gate.test.ts +++ b/packages/codev/src/agent-farm/__tests__/render-gate.test.ts @@ -700,6 +700,9 @@ describe('render-gate — deterministic op count: one classify is O(viewport), n } }); + // Sized, not a hang guard (#1944): this parses the ~4 MB ring through xterm twice. On Node 22 CI + // (ubuntu-latest) it measured 2.3-6.4 s across ten runs and hit the default 5 s limit on four of + // them (Node 20 CI: 0.6-1.2 s; locally about 0.4 s). It asserts op counts, not wall-clock time. it('negative control: the retired whole-ring path re-parses the WHOLE ring on EVERY classify', async () => { // Honesty check — the op count above is only meaningful if it can tell the two cost models // apart. Classify the same screen TWICE the pre-round-2 way: a throwaway terminal fed the whole @@ -730,7 +733,7 @@ describe('render-gate — deterministic op count: one classify is O(viewport), n expect(viaMirror.ops.bytesParsed).toBe(0); expect(ops.bytesParsed).toBe(HUGE_HISTORY.length * ROUNDS); expect(ops.bytesParsed).toBeGreaterThan(8 * 1024 * 1024); - }); + }, 20_000); }); describe('render-gate — claude suggested-command ghost (Spec 1313 render-gate hardening)', () => {