feat(pool): the pool - stacks, admission, the runner and the scheduler

The allowlists and the instrument checks (mcp_connected, db_answered,
exercised), the stack keys, Stacks and Admission, the Runner that runs one
claude or opencode process per pass, and the Scheduler with its retries,
rate-window pauses, the prompt-prefix warm-up, the seats and the board.
One thread per pass; each worker runs on its own copy of the job.

Every pass runs under the supervisor, so a timeout or an abort takes its
whole tree down; a timed-out pass reports exit -9, a SIGKILLed child's
code. The helpers the lenses run are this binary's `sql` and `totp`.
:Process gains an Append stream for the OpenCode meta line.

The tests cover the pool and its share of the commits-mode, seat-pool and
several-drivers checks, a fake claude under the supervisor included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-10-31 08:55:00 +01:00
commit 554a5ddd48
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
8 changed files with 2132 additions and 4 deletions

View file

@ -97,9 +97,12 @@ namespace Crafter::Review::Process {
return -1;
case Stream::Kind::Null:
return open("/dev/null", (reading ? O_RDONLY : O_WRONLY) | O_CLOEXEC);
// Created 0666 less the umask, truncated.
case Stream::Kind::File:
return reading ? open(stream.file.c_str(), O_RDONLY | O_CLOEXEC)
: open(stream.file.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
: open(stream.file.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666);
case Stream::Kind::Append:
return open(stream.file.c_str(), O_WRONLY | O_CREAT | O_APPEND | O_CLOEXEC, 0666);
case Stream::Kind::Pipe: {
std::array<std::int32_t, 2> ends {};
if (pipe2(ends.data(), O_CLOEXEC) != 0) return -2;