Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

docs: record host vitest and mid-run T2 checkout failure codes

Alfredo Lopez8bb6b7374066
diff --git a/.cursor/rules/minikube-t0-t1-t2.mdc b/.cursor/rules/minikube-t0-t1-t2.mdc
index 40ad9fe99..6fc824a6c 100644
--- a/.cursor/rules/minikube-t0-t1-t2.mdc
+++ b/.cursor/rules/minikube-t0-t1-t2.mdc
@@ -90,5 +90,27 @@ once after an in-run sync, before Health/Playwright (`PortForwards=` evidence).
generation-based wait, so the harness still judges reader readiness.
- Evidence lives under ignored `.local-notes/infra/runs/`; never commit it.
+## Host npm vs cluster Ready
+
+`[real-pg-preflight] PASS ... packages=2` only proves host `vitest`+`pg` in
+`control-api` and `gfs-controller`. It does **not** cover `pre-gate-sync`
+`run_if_changed`. `sh: vitest: command not found` +
+`make[1]: *** [minikube-pre-gate-sync] Error 127` after `T2_PREFLIGHT_PASS`
+and Ready deployments is a host `npm ci` gap in the named directory — not
+GFS, not a new profile, not `REAL_PG_SUITE_FAILED`. Cluster Ready ≠ host
+runner. `run_if_changed` dirs: `packages/workflow-runtime-core`,
+`packages/network-policy-core` (`node --test`), `control-api`,
+`external-rest-api`, `rpc-proxy`, `mcp-host`, `host-context-controller`,
+`workflow-recipes`, `packages/workflow-sdk`,
+`workflow-approval-request-reader`, `control-ui`, `desktop-app` (Node 24 +
+`verify:electron`; no `--ignore-scripts`). `gfs-controller` is not on that
+list. `npm ci` the named dir **and every remaining** package that lacks
+`node_modules/.bin/vitest`, then re-enter `make minikube-t2` on the same
+HEAD/profile. `PROFILE_METADATA_MISSING` surfaces as
+`PROFILE_OWNERSHIP_MISMATCH`: resolve via primary-checkout `branch.mk`,
+never invent ports. Do not edit tracked files while `make minikube-t2`
+is running: T0 fixtures fail with `fixture mutated the host checkout
+working tree`, and T2 refuses a dirty tree (`DEVELOPMENT_SCOPE_REQUIRED`).
+
Full workflow: skill `.cursor/skills/minikube-t0-t1-t2/SKILL.md`.
Deep contract: `docs/testing/minikube-t2-runbook.md`.
diff --git a/.cursor/skills/minikube-t0-t1-t2/SKILL.md b/.cursor/skills/minikube-t0-t1-t2/SKILL.md
index 976e42a6b..42f0976ea 100644
--- a/.cursor/skills/minikube-t0-t1-t2/SKILL.md
+++ b/.cursor/skills/minikube-t0-t1-t2/SKILL.md
@@ -19,7 +19,9 @@ Before running anything, verify ALL of these:
- [ ] Clean development branch descended from current `origin/dev`
(`git status --porcelain` empty of unexpected changes; not a protected
- branch).
+ branch). T2 fails closed on a dirty tree. Do not edit tracked files
+ after `make minikube-t2` starts (T0 fixtures fail
+ `fixture mutated the host checkout working tree`).
- [ ] Identify the branch-owned `MINIKUBE_PROFILE` for THIS worktree. Reuse it.
Do NOT create a new profile because HEAD, gate, or command changed.
Resolve it with the primary checkout `.local-notes/minikube-profiles/branch.mk`;
@@ -34,6 +36,14 @@ Before running anything, verify ALL of these:
- [ ] Docker resolves to a local Unix socket or loopback TCP endpoint. The
harness pins that endpoint into an empty task-local config; do not use a
remote Docker context or copy ambient registry credentials into it.
+- [ ] Host runners exist before `make minikube-t2`. T1 preflight
+ (`packages=2`) only checks `control-api` and `gfs-controller` for
+ `node_modules/.bin/vitest` + `pg`. `pre-gate-sync` later runs host
+ `npm test` in each changed package (see `reference.md` Host npm
+ section). `sh: vitest: command not found` / Error 127 after planner
+ PASS and Ready deployments is a missing `npm ci` in that directory —
+ not GFS and not a new profile. Install every remaining pre-gate
+ package in one pass, then re-enter T2.
- [ ] Mutating image acquisition/builds use the public Make target/orchestrator
and inherit its exact profile lease. Do not call `build-images.sh` or
`pull-images.sh` directly; `--verify-only` is the read-only exception.
@@ -198,8 +208,10 @@ observe a newer same-binding access token but must never refresh/reissue or
consume the Host refresh-token lineage.
Do not widen the command, switch clusters, reset PVCs, or delete locks with a
live owner. A T1 `next:` line is not permission to operate Docker
-(`docker run`, `docker desktop restart`, port probes). Code-by-code
-guidance is in `reference.md`.
+(`docker run`, `docker desktop restart`, port probes).
+`sh: vitest: command not found` / `minikube-pre-gate-sync` Error 127 is a
+host `npm ci` gap (install the named dir and every remaining pre-gate
+package), not a cluster repair. Code-by-code guidance is in `reference.md`.
The active profile lock is `$T2_LOCK_ROOT/<profile>.lock`; stale reclaim uses
the sibling `$T2_LOCK_ROOT/<profile>.reclaim`. A killed reclaimer can leave the
diff --git a/.cursor/skills/minikube-t0-t1-t2/reference.md b/.cursor/skills/minikube-t0-t1-t2/reference.md
index 3eacad1a3..2c8f021dc 100644
--- a/.cursor/skills/minikube-t0-t1-t2/reference.md
+++ b/.cursor/skills/minikube-t0-t1-t2/reference.md
@@ -35,6 +35,15 @@ Companion to `SKILL.md`. Source of truth: `scripts/minikube/t2.sh`,
`scripts/tests/lib/minikube-fixture-repo.sh`, set `T2_PROJECT_DIR` to that
fixture, and prove the host checkout is unchanged. This is mandatory for
detached-head CI runs; restoring a branch in `trap cleanup` is not isolation.
+ Also do not edit tracked files in the live T2 worktree while
+ `make minikube-t2` is running. Fixtures hash host `status --porcelain` at
+ init (`minikube_test_assert_host_unchanged`) and fail with
+ `fixture mutated the host checkout working tree`. Observed collateral:
+ `test-minikube-build-section-headers.sh` then reports
+ `build-images.sh: No such file or directory` (rc=127) because the temp
+ fixture repo was removed. The orchestrator also fails closed on a dirty
+ tree (`DEVELOPMENT_SCOPE_REQUIRED` / `worktree is dirty`). Finish the
+ edit, commit or stash, then re-enter T2.
- **Do not run mutating `build-images.sh` or `pull-images.sh` directly.** Use
the public Make target or T2 orchestrator so the exact
worktree/profile/context lease is inherited. Only `--verify-only` is
@@ -69,17 +78,68 @@ Companion to `SKILL.md`. Source of truth: `scripts/minikube/t2.sh`,
`docker run` probes, `docker desktop restart` (destroys the Minikube
container and the owned profile), published-port experiments, and any
invented networking path between plan and verdict.
+- **Do not treat `sh: vitest: command not found` / `minikube-pre-gate-sync`
+ Error 127 as GFS, `PROFILE_UNHEALTHY`, or a product bug.** Planner PASS
+ plus Ready deployments only prove the cluster. `pre-gate-sync`
+ `run_if_changed` then runs **host** `npm test` in the changed package.
+ `LOCAL_DEPENDENCY_MISSING` / `[real-pg-preflight] PASS packages=2` only
+ checked `control-api` and `gfs-controller`. Install every remaining
+ pre-gate package before re-entering T2; installing only the failing
+ directory dies on the next `run_if_changed`.
- **Do not let NP08 refresh or reissue the Host lineage.** It may observe a
fresher persisted access token only when its Host/recipe binding exactly
matches the mounted token. Refresh tokens remain owned by mcp-host.
+## Host npm vs cluster Ready (observed 2026-09-25)
+
+`[real-pg-preflight] PASS node=24 workers=1 packages=2` is **not** a host-runner
+certificate for `pre-gate-sync`. `scripts/e2e/real-postgres-local-preflight.sh`
+only requires executable `node_modules/.bin/vitest` plus resolvable `vitest`
+and `pg` in `control-api` and `gfs-controller`.
+
+After planner PASS, image inventory OK, and every required Deployment Ready,
+`pre-gate-sync` `run_if_changed` still runs **host** `npm test` in each changed
+directory (`scripts/minikube/pre-gate-sync.sh`):
+
+- `packages/workflow-runtime-core` (`npm test && npm run build`)
+- `packages/network-policy-core` (`node --test`, not vitest)
+- `control-api`
+- `external-rest-api`
+- `rpc-proxy`
+- `mcp-host`
+- `host-context-controller`
+- `workflow-recipes`
+- `packages/workflow-sdk`
+- `workflow-approval-request-reader`
+- `control-ui`
+- `desktop-app` (Node 24 + `npm run verify:electron`; do not `--ignore-scripts`)
+
+`gfs-controller` is **not** on this list. Observed aborts: `external-rest-api`
+then `rpc-proxy` (`sh: vitest: command not found` →
+`make[1]: *** [minikube-pre-gate-sync] Error 127` →
+`make: *** [minikube-t2] Error 2`). That signature has **no** T2 stable code
+and no `next:` line. Cluster Ready ≠ host runner.
+
+Repair on the same HEAD and owned profile: `npm ci` in the named directory
+**and every remaining** package that lacks `node_modules/.bin/vitest`.
+Installing only the failing package dies on the next `run_if_changed`. Then
+re-enter `make minikube-t2`. T1 has not run if this abort is after bootstrap.
+Forbidden: new profile, PVC reset, `docker desktop restart`, `docker run`
+probes, treating Error 127 as GFS/`PROFILE_UNHEALTHY`.
+
+`PROFILE_METADATA_MISSING` (unreadable `profile.env` / ports) is raised as
+`PROFILE_OWNERSHIP_MISMATCH`. Resolve or generate metadata via the primary
+checkout `branch.mk` (`branch-profile-start`). Never invent ports or
+`ls`/`cat` `~/.cache/clerum/minikube-profiles/`.
+
## Stable failure codes
| Code | Meaning | Safe next step |
| --- | --- | --- |
-| `LOCAL_DEPENDENCY_MISSING` | Node/package-local dependencies, Python, Docker, kubectl, Minikube, or another required local tool is unavailable. | Repair the named local prerequisite first. The T1 preflight runs before expensive T0 work and never auto-installs. |
+| `LOCAL_DEPENDENCY_MISSING` | Node/package-local dependencies, Python, Docker, kubectl, Minikube, or another required local tool is unavailable. T1 preflight (`packages=2`) only checks `control-api` and `gfs-controller` for host `vitest`+`pg`. | Repair the named local prerequisite (`npm ci` in that package). Then `npm ci` every remaining pre-gate package in the Host npm section before re-entering T2. The preflight never auto-installs and never covers `external-rest-api` / `rpc-proxy` / `mcp-host` / … |
+| `minikube-pre-gate-sync` Error 127 / `sh: vitest: command not found` | Host `npm test` in a `run_if_changed` package after planner PASS and Ready deployments. **Not** a T2 stable code. | `npm ci` the named dir **and every remaining** pre-gate package, then `make minikube-t2` on the same HEAD/profile. Not GFS, not a new profile. |
| `UNSUPPORTED_T1_CONCURRENCY` | A caller attempted more than one T1 worker. | Remove the override or set `VITEST_MAX_WORKERS=1`; T1 role/fixture mutation is serial by contract. |
-| `PROFILE_OWNERSHIP_MISMATCH` | Profile metadata, context, worktree, or branch does not match this lane. | Resolve through the canonical helper. Never adopt, kill, or mutate a foreign/ambiguous profile. |
+| `PROFILE_OWNERSHIP_MISMATCH` | Profile metadata, context, worktree, or branch does not match this lane. Includes wrapped `PROFILE_METADATA_MISSING` (unreadable `profile.env` / ports). | Resolve through the primary-checkout `branch.mk` helper (`branch-profile-start` when metadata is missing). Never invent ports, adopt a foreign profile, or `ls`/`cat` `~/.cache/clerum/minikube-profiles/`. |
| `PROFILE_LOCK_REQUIRED` | A mutating child did not inherit the exact parent lease. | Invoke the public Make target/orchestrator; do not fabricate or bypass its lock token. |
| `DOCKER_ENDPOINT_REQUIRED` / `DOCKER_ENDPOINT_UNSAFE` / `DOCKER_ENDPOINT_MISMATCH` | Docker did not resolve exactly one approved local endpoint, or isolation selected a different endpoint. | Select a local Docker Desktop/rootless context or set an explicit local `DOCKER_HOST`; do not weaken the endpoint check. |
| `DOCKER_CONFIG_REQUIRED` / `REGISTRY_AUTH_REQUIRED` | A Docker operation lacks its empty task-local config, or a private pull lacks an explicit readable auth config. | Use the canonical Make/orchestrator path; for a genuinely private source, pass only the intended config directory through `MINIKUBE_DOCKER_AUTH_CONFIG`. |
@@ -91,7 +151,7 @@ Companion to `SKILL.md`. Source of truth: `scripts/minikube/t2.sh`,
| `IMAGE_MANIFEST_MISMATCH` | Deployed image provenance or the manifest `generated` stamp does not match the exact marker/worktree state. | Re-run the full target for the same owned profile; do not relabel or hand-edit the manifest. |
| `PORT_FORWARD_CONFLICT` | A port-forward for this profile is owned by a process not recorded for it (or not a real `kubectl`). | Identify the foreign owner; if it belongs to another lane, stop. Do not kill this lane's `branch-profile-pf`. Restore UI PFs with `make -f .local-notes/minikube-profiles/branch.mk branch-profile-pf`. |
| `PROFILE_BUSY` | Profile lock held. Live owner PID → genuinely busy. No valid owner PID → orphaned lock. | Live owner: wait or coordinate; never remove. Orphan: verify no T2 process owns the profile, then remove ONLY `$T2_LOCK_ROOT/<profile>.lock` and retry. Never remove the lock root. |
-| `DEVELOPMENT_SCOPE_REQUIRED` | Preflight/final preflight failed a precondition, or T2-only mode was attempted without `already-synced`. | Repair the first reported condition; if T2-only was refused, run full `make minikube-t2`. |
+| `DEVELOPMENT_SCOPE_REQUIRED` | Preflight/final preflight failed a precondition, T2-only mode was attempted without `already-synced`, or the worktree is dirty (`worktree is dirty`). | Repair the first reported condition. If dirty: commit or stash, do not edit during the run, then re-enter T2. If T2-only was refused, run full `make minikube-t2`. |
| `CERTIFICATION_REQUIRED` | Runtime-only was requested without valid exact-head T0/T1 evidence for the full ownership tuple. | Run the full target once; do not hand-create or copy evidence. |
| `SECRET_MISSING` / `CONFIGMAP_MISSING` | A required named runtime input is absent or unreadable. | Reconcile the same owned profile through the full target; never invent values. |
| `ZERO_TESTS_EXECUTED` | A lane was configured off or executed nothing (including a required-but-missing Playwright journey). | Re-run with the lane enabled, or supply the required `T2_PLAYWRIGHT_COMMAND`. |
diff --git a/AGENTS.md b/AGENTS.md
index cd2c881c6..b36ef53fb 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -216,7 +216,18 @@ silently skipping the suites. The JSON reporter must be complete and green,
must identify the exact selected physical files, and the Vitest process must
also exit zero; a green reporter cannot hide a teardown, worker, OOM, signal,
or partial-selection failure. Run the local Node/package/Docker preflight
-before expensive T0 work. T1 is serial by safety contract
+before expensive T0 work. That preflight (`packages=2`) only checks host
+`vitest`+`pg` in `control-api` and `gfs-controller`. `pre-gate-sync` later
+runs host `npm test` in each changed package (`external-rest-api`,
+`rpc-proxy`, `mcp-host`, `host-context-controller`, `workflow-recipes`,
+`control-ui`, `desktop-app`, and the `packages/*` listed in the
+minikube-t0-t1-t2 skill). `sh: vitest: command not found` /
+`minikube-pre-gate-sync` Error 127 after planner PASS and Ready deployments
+is a missing host `npm ci` in that directory — not GFS and not a license
+for a new profile. Install every remaining pre-gate package, then re-enter
+`make minikube-t2`. Do not edit tracked files while that run is live: T0
+fixtures fail `fixture mutated the host checkout working tree`, and T2
+refuses a dirty tree. T1 is serial by safety contract
(`VITEST_MAX_WORKERS=1`, no file parallelism); do not widen it for speed.
Suites that drop or rewrite cluster-global roles must use the harness throwaway
Postgres 16, never the shared `control-postgres`.
diff --git a/docs/testing/minikube-t2-runbook.md b/docs/testing/minikube-t2-runbook.md
index 5cff480ad..d8bac646c 100644
--- a/docs/testing/minikube-t2-runbook.md
+++ b/docs/testing/minikube-t2-runbook.md
@@ -280,6 +280,16 @@ builds, Minikube image operations, Minikube status/docker-env, Kubernetes node
inventory, and targeted health commands all have validated finite deadlines
and process-group cleanup on timeout or interrupt.
+Host `npm test` is a separate precondition from cluster Ready. The T1
+preflight (`[real-pg-preflight] PASS ... packages=2`) only checks
+`control-api` and `gfs-controller` for host `vitest`+`pg`. After planner PASS
+and Ready deployments, `pre-gate-sync` still runs host `npm test` in each
+changed package listed in `scripts/minikube/pre-gate-sync.sh` (`run_if_changed`).
+`sh: vitest: command not found` / `minikube-pre-gate-sync` Error 127 is a
+missing host `npm ci` in that directory — not GFS and not a new profile.
+Install every remaining pre-gate package, then re-enter `make minikube-t2`.
+See `.cursor/skills/minikube-t0-t1-t2/reference.md` (Host npm vs cluster Ready).
+
The local Real PostgreSQL lane resolves the
`control-postgres` Secret using the explicit context, constructs its admin DSN
only in process memory, and passes it only to the shared-server suites. Suites