test: review-army + adversarial test hardening

- Tripwire scans execFileSync too (ceiling 8: two more grep-needle string
  exemptions); merge-introduced timeout-less spawnSync in
  question-preference-hook fixed — the tripwire caught a site that landed
  on main AFTER the sweep, on its first day.
- gstack-detach gains TWO watchdog kill regression tests: TERM-immune
  grandchild (the killpg-after-grace escalation) and the leader-dies
  variant (the pgid-at-spawn fix — the case the first test cannot see).
- eval-flake-rank gets its unit suite (final-attempt accounting, artifact
  exclusion, shard recursion, recency bound).
- Groupkill/startup-grace shim markers are per-run unique (pid-suffixed
  sleep durations): sibling Conductor worktrees run free suites with no
  machine lock, and fixed markers let one run pgrep/pkill the other's
  shims — a cross-run flake inside the anti-flake tests.
- flake-ledger test pins the project-scoped local default; stale empty
  section headers in touchfiles-data deleted (they invited entries under
  deliberately retired categories).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-31 05:38:26 +00:00
co-authored by Claude Fable 5
parent e4954aaebb
commit 5b04f05ba4
8 changed files with 148 additions and 25 deletions
+4 -4
View File
@@ -42,7 +42,7 @@ describe('session-runner two-phase timeout', () => {
'#!/bin/bash',
'sleep 2',
'echo \'{"type":"system","subtype":"init"}\'',
'exec sleep 6071',
`exec sleep 6071.${process.pid}`,
].join('\n') + '\n', { mode: 0o755 });
const realPath = process.env.PATH;
@@ -65,7 +65,7 @@ describe('session-runner two-phase timeout', () => {
expect(wall).toBeLessThan(20_000);
} finally {
process.env.PATH = realPath;
Bun.spawnSync(['pkill', '-f', 'sleep 6071'], { timeout: 5_000 });
Bun.spawnSync(['pkill', '-f', `sleep 6071\\.${process.pid}`], { timeout: 5_000 });
fs.rmSync(dir, { recursive: true, force: true });
}
}, 60_000);
@@ -74,7 +74,7 @@ describe('session-runner two-phase timeout', () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'grace-'));
const shimDir = path.join(dir, 'bin');
fs.mkdirSync(shimDir);
fs.writeFileSync(path.join(shimDir, 'claude'), '#!/bin/bash\nexec sleep 6072\n', { mode: 0o755 });
fs.writeFileSync(path.join(shimDir, 'claude'), `#!/bin/bash\nexec sleep 6072.${process.pid}\n`, { mode: 0o755 });
const realPath = process.env.PATH;
process.env.PATH = `${shimDir}:${realPath}`;
@@ -95,7 +95,7 @@ describe('session-runner two-phase timeout', () => {
expect(result.costEstimate.turnsUsed).toBe(0);
} finally {
process.env.PATH = realPath;
Bun.spawnSync(['pkill', '-f', 'sleep 6072'], { timeout: 5_000 });
Bun.spawnSync(['pkill', '-f', `sleep 6072\\.${process.pid}`], { timeout: 5_000 });
fs.rmSync(dir, { recursive: true, force: true });
}
}, 60_000);