Files
UnbiasedStrata/frontend/child_watch_test.cpp
Robert KarlandClaude Fable 5.1 46c46ecfc1 Front end: image input through the model's vision encoder; engine child supervision; tests
Images: --mmproj PATH loads the Qwen3.8 Flash-Next projector through llama.cpp's mtmd
library and encodes image_url parts on the CPU (frontend/vision.hpp). The embeddings go to
the engine as a GENI request, its existing vision path, with the prompt's <|image_pad|>
runs standing in for each image. --vision-tokens caps the tokens per image. GET /v1/models
lists "image" under input_modalities when the encoder is loaded. Checked on an RTX 4090:
screenshots, photos, several images in one message, and pi's file attachments and
clipboard paste.

Engine process: the engine is started and watched from frontend/engine.hpp; when it exits
or its stall watchdog fires, the front end exits too, for a supervisor to restart. Stall
reports add the current stage and thread wait channels. Reasoning streams; content and
tool calls are sent once the whole message is parsed, so partial JSON never changes
arguments already sent.

Tests: make test-frontend (child exit, protocol, backpressure; no model needed) and
make test-chat-parser MODEL=<gguf> (template and tool-call parsing against the real GGUF).

The image path and the supervision were written by a Codex session; this commit finishes,
documents and checks them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-08 15:54:53 -07:00

32 lines
1015 B
C++

#include "child_watch.hpp"
#include <cassert>
#include <csignal>
#include <cstdio>
#include <sys/resource.h>
#include <unistd.h>
int main() {
for (bool crash : {false, true}) {
pid_t pid = ::fork();
assert(pid >= 0);
if (pid == 0) {
const struct rlimit no_core{0, 0};
::setrlimit(RLIMIT_CORE, &no_core);
::usleep(30000);
if (crash) ::raise(SIGABRT);
::_exit(17);
}
std::string why;
assert(strata_frontend::child_running(pid, why));
bool exited = false;
for (int i = 0; i < 100; ++i) {
if (!strata_frontend::child_running(pid, why)) { exited = true; break; }
::usleep(10000);
}
assert(exited && pid == -1);
assert(why == (crash ? "engine killed by signal " + std::to_string(SIGABRT) : "engine exited with code 17"));
std::puts(why.c_str());
}
std::puts("PASS: normal exit and watchdog-style abort reaped and diagnosed");
}