Files
leleka/scripts/e2e/run-fake.sh
T
Pavlo RatushnyiandClaude Sonnet 5.5 505f3ee70f fix(runtime): output cap 4096 -> 32768 (one shared constant); /v1/status omits a null prefix_cache
The Codex tic-tac-toe run (job 943) ended after 4 minutes: the model wrote the whole index.html in one tool call, hit the
runtime's 4096-token output cap three times (tool call unterminated -> response.failed 'tool parameter is incomplete', then
'incomplete: max_output_tokens' -> turn.failed -> Codex exit 1). The Original server has no such cap (max_tokens 0 = the rest
of the context). RuntimeServer, the engine request check, strata-next's runtime default, the leleka-deploy generated config
and the examples now use leleka_backend_api::MAX_OUTPUT_TOKENS = 32768. /v1/status keeps the Python server's key set when no
prefix cache exists (http_surface golden regressed with the prefix-cache merge).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-18 04:36:37 +02:00

30 lines
2.5 KiB
Bash

#!/usr/bin/env bash
# Run e2e_client.py against strata-next in front of a scripted fake engine (no GPU, no model): TEST TOOLING for the client itself.
# run-fake.sh STRATA_NEXT FAKE_RUNTIME TOKENIZER_DIR OUT_DIR [client args...]
# fake_runtime = `cargo build --release -p strata-desktop-core --example fake_runtime`; its engine is fake_llm_engine.py.
set -uo pipefail
HERE=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
SN=$1 FAKE=$2 TOK=$3 OUT=$4; shift 4
mkdir -p "$OUT"; chmod 700 "$OUT"; umask 077
export FAKE_RUNTIME_TOKEN="fixture-runtime-credential-$(head -c 12 /dev/urandom | base64 | tr -d '/+=\n')"
KEY="$OUT/api-key"; rm -f "$KEY"; "$SN" api-key init --file "$KEY" >/dev/null || { echo "api-key init failed"; exit 4; }
chmod +x "$HERE/fake_llm_engine.py"
( sleep 3600 | "$FAKE" --listen 127.0.0.1:0 --token-env FAKE_RUNTIME_TOKEN --engine "$HERE/fake_llm_engine.py" --tokenizer "$TOK" \
--engine-arg "$TOK" --engine-arg "$SN" >"$OUT/fake_runtime.out" 2>"$OUT/fake_runtime.err" ) &
for _ in $(seq 1 100); do grep -q LISTENING "$OUT/fake_runtime.out" 2>/dev/null && break; sleep 0.1; done
ADDR=$(awk '/LISTENING/{print $2}' "$OUT/fake_runtime.out")
[ -n "$ADDR" ] || { echo "fake runtime did not start"; cat "$OUT/fake_runtime.err"; exit 4; }
cat >"$OUT/strata.json" <<JSON
{"bind":"127.0.0.1:18081","api_key_file":"$KEY","model":"qwen-iq3","shutdown_grace_s":0,
"runtime":{"address":"$ADDR","token_env":"FAKE_RUNTIME_TOKEN","tokenizer_dir":"$TOK",
"model":{"family":"fixture_family","architecture":"fixture_arch","weight_format":"fixture:stdio","artifact_digest":"sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"},
"mode":{"type":"native"},"max_context":262144,"max_output_tokens":32768,"attach_retry_s":0.1,"health_interval_s":0.5}}
JSON
"$SN" serve --config "$OUT/strata.json" >"$OUT/strata-next.log" 2>&1 &
SPID=$!
trap 'kill -INT $SPID 2>/dev/null; pkill -P $$ 2>/dev/null; sleep 1; pkill -f fake_runtime 2>/dev/null; true' EXIT
"$SN" wait-ready --url http://127.0.0.1:18081 --model qwen-iq3 --key-file "$KEY" --timeout-s 60 >"$OUT/wait-ready.log" 2>&1 || { echo "not ready"; cat "$OUT/wait-ready.log"; tail "$OUT/strata-next.log"; exit 6; }
[ -n "${E2E_FAKE_HOLD:-}" ] && { echo "holding the stack for $E2E_FAKE_HOLD s (manual debugging)"; sleep "$E2E_FAKE_HOLD"; exit 0; }
python3 -I "$HERE/e2e_client.py" --base http://127.0.0.1:18081 --key-file "$KEY" --model qwen-iq3 --out "$OUT/results.json" \
--context-dir "${E2E_CONTEXT:-$HERE/../../control-plane/src}" --pids "strata=$SPID" "$@"