fix(qwen38): the calibration window must prove the rig owns the socket
The runner stops frank-archon first, and the dying production process keeps its listener for a moment while the freshly created rig container is still loading. 'podman inspect says running' plus '/health answers' therefore BOTH hold for the wrong process: measured 2026-10-30, the window logged 'health ok waited=0s', the pusher refused on the container name, and a 12M window died at second zero. The gate now asks the kernel who owns :7770 (ss -ltnp) and requires that pid to be one of the rig container's processes (podman top). Two tests, written red first against the old rig_up: a foreign listener must fail the window without a push, and an in-container listener must proceed and bank. Also renames the new test fixture to tap_window_fixture: it had shadowed the existing window_fixture helper, which broke the window dry-run test when the whole file ran.
This commit is contained in:
1 parent
4043798053
commit
167e6d6de3
2 files changed
+98
-4
No files matched your search
@@ -732,3 +732,82 @@ PY
|
||||
[ "$status" -eq 2 ]
|
||||
[[ "$output" == *"Q38_CALIB_MNBT must be a number"* ]]
|
||||
}
|
||||
|
||||
# ---- the window must not mistake a dying production socket for the rig -------
|
||||
# 2026-10-30: the runner stopped frank-archon, the rig container was still loading,
|
||||
# and /health answered 200 from the production process draining its listener. The
|
||||
# window logged `health ok waited=0s`, the pusher refused on the container name, and
|
||||
# a 12M window died at second zero. The gate must prove the LISTENER is in the rig.
|
||||
|
||||
tap_window_fixture() {
|
||||
export W="$BATS_TEST_TMPDIR/window"
|
||||
mkdir -p "$W/scripts" "$W/campaign/calib" "$W/campaign/kld-ref" "$W/models/rad" "$W/corpora" "$W/bin"
|
||||
cp "$BATS_TEST_DIRNAME/../scripts/qwen38-calib-window.sh" "$W/scripts/"
|
||||
: > "$W/campaign/kld-ref/kld.json"
|
||||
: > "$W/models/rad/qwen38-bf16.rad"
|
||||
: > "$W/corpora/calib.jsonl"
|
||||
# a gram so the empty-tap check passes on the positive path
|
||||
: > "$W/campaign/calib/gram.r0.blk.0.ffn_down_exps.0.bin"
|
||||
|
||||
cat > "$W/scripts/run-qwen38-bf16.sh" <<'EOS'
|
||||
#!/usr/bin/env bash
|
||||
[ -n "${STUB_RIG_MARKER:-}" ] && : > "$STUB_RIG_MARKER"
|
||||
sleep "${STUB_RIG_SLEEP:-3}"
|
||||
exit 0
|
||||
EOS
|
||||
cat > "$W/bin/py" <<'EOS'
|
||||
#!/usr/bin/env bash
|
||||
[ -n "${STUB_PUSH_SENTINEL:-}" ] && : > "$STUB_PUSH_SENTINEL"
|
||||
exit 0
|
||||
EOS
|
||||
cat > "$W/bin/podman" <<'EOS'
|
||||
#!/usr/bin/env bash
|
||||
case "${1:-}" in
|
||||
inspect) echo true ;;
|
||||
top) echo PID; echo "${RIG_PID:-424242}" ;;
|
||||
*) : ;;
|
||||
esac
|
||||
EOS
|
||||
cat > "$W/bin/ss" <<'EOS'
|
||||
#!/usr/bin/env bash
|
||||
echo "LISTEN 0 4096 *:7770 *:* users:((\"radiance\",pid=${LISTEN_PID:-424242},fd=9))"
|
||||
EOS
|
||||
cat > "$W/bin/curl" <<'EOS'
|
||||
#!/usr/bin/env bash
|
||||
exit 0
|
||||
EOS
|
||||
chmod +x "$W/scripts/run-qwen38-bf16.sh" "$W/bin/py" "$W/bin/podman" "$W/bin/ss" "$W/bin/curl"
|
||||
}
|
||||
|
||||
tap_window_env() {
|
||||
env PATH="$W/bin:$PATH" \
|
||||
FRANK_QWEN38_CAMPAIGN="$W/campaign" \
|
||||
FRANK_QWEN38_RAD="$W/models/rad/qwen38-bf16.rad" \
|
||||
Q38_WINDOW_CALIB_CORPUS="$W/corpora/calib.jsonl" \
|
||||
Q38_CALIB_MIN_FREE_MIB=1 \
|
||||
Q38_WINDOW_HEALTH_TIMEOUT=1 \
|
||||
PY="$W/bin/py" \
|
||||
STUB_RIG_MARKER="$W/rig.marker" \
|
||||
STUB_RIG_SLEEP=0 \
|
||||
STUB_PUSH_SENTINEL="$W/push.ran" \
|
||||
bash "$W/scripts/qwen38-calib-window.sh"
|
||||
}
|
||||
|
||||
@test "a health answer from a listener outside the rig is not the rig: no push, window fails" {
|
||||
tap_window_fixture
|
||||
# health 200, container "running", but the listener pid belongs to production
|
||||
export LISTEN_PID=999999 RIG_PID=424242
|
||||
run tap_window_env
|
||||
[ "$status" -ne 0 ]
|
||||
[ -z "$(ls "$W/push.ran" 2>/dev/null)" ]
|
||||
[[ "$output" == *"before it ever answered /health"* ]]
|
||||
}
|
||||
|
||||
@test "when the listener is inside the rig the window proceeds and banks the tap" {
|
||||
tap_window_fixture
|
||||
export LISTEN_PID=424242 RIG_PID=424242
|
||||
run tap_window_env
|
||||
[ "$status" -eq 0 ]
|
||||
[ -e "$W/push.ran" ]
|
||||
[[ "$output" == *"TAP BANKED"* ]]
|
||||
}
|
||||
Reference in new issue
Block a user