timmy-talking-turd/tests/fixtures/slow-hermes.mjs
Timmy 9118b69057
All checks were successful
Quality gates / quality (pull_request) Successful in 1m58s
feat: graceful shutdown, disconnect-driven cancellation, and queue acceptance coverage
- server.mjs tracks in-flight chats: browser disconnects abort the
  queued turn (releasing its slot), and SIGTERM/SIGINT cancels every
  in-flight turn so no Hermes subprocess is orphaned.
- vision-service forwards a per-request AbortSignal combined with the
  provider deadline via AbortSignal.any.
- acceptance suites cover overload fallback, urgent bypass under
  saturation, disconnect cleanup, recovery, and shutdown orphan checks.
- zero-call invariant tests prove urgent text never reaches Hermes or
  the vision provider under load.
2026-08-22 23:01:20 +00:00

21 lines
1016 B
JavaScript
Executable File

#!/usr/bin/env node
// Slow Hermes fixture for bounded-queue acceptance tests. Normal prompts
// answer immediately; prompts containing HOLD block until a release file
// appears inside the agent workdir (the value after `--in`), so tests can
// saturate the queue deterministically without touching shared /tmp state.
import { existsSync } from 'node:fs';
import { appendFileSync } from 'node:fs';
const args = process.argv.slice(2);
const promptIndex = args.indexOf('-q');
const prompt = promptIndex >= 0 ? args[promptIndex + 1] : '';
const workdirIndex = args.indexOf('--in');
const workdir = workdirIndex >= 0 ? args[workdirIndex + 1] : '/tmp';
appendFileSync(`${workdir}/fixture-pids.log`, `${process.pid}\n`);
process.stdout.write('session_id: slow_fixture_2026\n');
if (/HOLD/.test(prompt)) {
const releaseFile = `${workdir}/hermes-release`;
while (!existsSync(releaseFile)) await new Promise(resolve => setTimeout(resolve, 20));
}
process.stdout.write('Hermes fixture answered the bounded request.\n');