Documentation
¶
Overview ¶
Command modelstub is a scripted, deterministic stand-in for the model endpoint, so that the two-machine harness in internal/e2e/remote_test.go can drive a REAL turn without an API key and without a network.
WHY A STUB AND NOT A REAL MODEL. The thing under test is the wire between two filesystems, not the model's judgment. A real model would make every scenario probabilistic — a path assertion that fails because the model chose to paraphrase instead of quoting is a false red — and it would put a bill and a credential in front of a test whose whole point is that anybody can run it. So this speaks OpenRouter's OpenAI-compatible dialect exactly as internal/provider writes and reads it (client.go's `<base>/chat/completions`, sse.go's chunk shape, catalog.go's `<base>/models?output_modalities=all`) and answers from a script.
THE SCRIPT IS KEYED OFF THE PERSON'S OWN WORDS. Every scenario submits a message carrying one of the markers below, and this server answers the way that scenario needs — including calling a tool, so the engine machine does real work on its own disk and the reply can be checked against it.
PROBE-ECHO one reply, no tools: the handshake and one turn PROBE-PWD calls `bash` with `pwd`, then quotes the answer back PROBE-READ <path> calls `read` on the path, then quotes the answer back PROBE-SLOW a reply spread over seconds, for the link that dies PROBE-NOCHANGE <path> replays the completion-check rejection from #1065
QUOTING THE TOOL OUTPUT BACK IS THE WHOLE TRICK. `--once` prints the model's reply on stdout and the tool's own output nowhere at all, so a scenario that wants to assert on what a tool SAW has to have the reply carry it. A real model would summarize; this one echoes verbatim, which is what makes an assertion about an absolute path possible at all.
STDERR IS THE LOG. Every request is one line, so `docker logs` on the model container answers "did the turn ever reach the model, and what did it ask".