fix(executor+engine-tests): preflight premise-stale exit and serialize reliability suite

Root-cause prevention for the FN-5521 failure class where PROMPT.md describes
work that is already done on HEAD and the executor still marches through
plan/review/test/doc, then merger burns hours retrying against unrelated
flakes in @fusion/engine reliability-interactions.

- Executor system prompt: add a Preflight escape hatch. When Step 0
  reproduces and finds HEAD already matches the desired state, the agent
  marks Step 0 done, marks remaining steps skipped, and calls fn_task_done
  with a `PREMISE STALE:` summary. Reuses the existing
  evaluateTaskDoneRefusal/skipped semantics and the merger's
  empty-own-diff fast-path — no new tools or refusal classes needed.

- packages/engine/vitest.config.ts: split into two projects. engine-default
  retains full parallelism; engine-reliability scopes
  src/__tests__/reliability-interactions/** to
  poolOptions.threads.singleThread so event-ordering assertions stop
  flaking under workspace-concurrent merge-gate load (the
  `expected 24 to be less than 19` rowid interleaving in
  merge-reuse-task-worktree).
This commit is contained in:
gsxdsm
2026-05-22 22:26:18 -07:00
parent 23a0c27bd5
commit 8a3afcf9d4
3 changed files with 49 additions and 0 deletions

View File

@@ -35,6 +35,36 @@ export default defineConfig({
// Real-git integration tests need more than the default 5 s under concurrent
// load (other packages run tests at the same time via pnpm recursive).
testTimeout: 30_000,
// Split into two projects so the reliability-interactions suite (real
// worktrees + real git, contention-sensitive event ordering) runs
// single-threaded without throttling the rest of the engine suite.
projects: [
{
extends: true,
test: {
name: "engine-default",
include: ["src/**/*.test.ts"],
exclude: [
"src/__tests__/reliability-interactions/**/*.test.ts",
"node_modules/**",
"dist/**",
],
},
},
{
extends: true,
test: {
name: "engine-reliability",
include: ["src/__tests__/reliability-interactions/**/*.test.ts"],
// These tests assert event ordering across real worktrees. Parallel
// execution under merger load caused subprocess-guard timeouts and
// SQLite rowid interleaving (e.g. FN-5521 hit
// `expected 24 to be less than 19` in merge-reuse-task-worktree).
// Serialize at the file level; within-file order is already linear.
poolOptions: { threads: { singleThread: true } },
},
},
],
coverage: {
enabled: false,
reporter: ["text", "html", "json"],