From f0e2f4a3e272bcfe23cc7a08ebcdb70e71015406 Mon Sep 17 00:00:00 2001 From: Alan Domio Date: Fri, 16 Oct 2026 09:19:24 +0200 Subject: [PATCH 1/3] fix(bin): count Jev transport failures in the timeout streak instead of a day pause Co-Authored-By: Claude Sonnet 5.5 --- bin/fm-jev.sh | 11 ++++++----- docs/configuration.md | 6 +++--- tests/fm-jev.test.sh | 24 ++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/bin/fm-jev.sh b/bin/fm-jev.sh index 2ff9153b429..62371202698 100755 --- a/bin/fm-jev.sh +++ b/bin/fm-jev.sh @@ -98,13 +98,14 @@ # # Pauses. Two kinds, both in state/jev/disabled ("\t" or, for a timed # pause, "\t\t"). A DAY pause holds until the next local -# calendar day: on OpenRouter an API/transport error, a response without a +# calendar day: on OpenRouter an API error that came back as an HTTP response, a response without a # usage.cost, or reaching the daily spend cap (USD, default 1; override with a # decimal number in config/jev-daily-cap, summed from the usage.cost each # response reports); on either backend an invalid config/jev-endpoint, which is # a configuration mistake to surface, not a transient condition to retry. A -# TIMED pause covers timeouts, on either backend: the Nth consecutive timeout -# (config/jev-timeout-streak, default 3; any successful classification resets +# TIMED pause covers timeouts and transport failures (any curl failure with no +# HTTP response, such as a DNS or connection error), on either backend: the Nth +# consecutive one (config/jev-timeout-streak, default 3; any successful classification resets # the count, kept in state/jev/timeout-streak) pauses classification for # config/jev-timeout-pause minutes (default 60), then Jev tries again by # itself. A further pause with no success in between doubles (60, 120, 240 ... @@ -397,7 +398,7 @@ jev_clock() { # -> HH:MM local time (GNU date, then BSD date) } # state/jev/disabled is "\t" (a pause until the next local day: the -# spend cap, an API/transport error or a missing cost on OpenRouter, an +# spend cap, an HTTP API error or a missing cost on OpenRouter, an # invalid config/jev-endpoint) or "\t\t" (a timed pause # that clears itself). A "\ttimeout" record without an until time was # written when one timeout paused the whole day; that reason no longer pauses, @@ -704,7 +705,7 @@ jev_classify_row() { # Date: Fri, 16 Oct 2026 09:27:34 +0200 Subject: [PATCH 2/3] no-mistakes(review): Test single curl exit 6 DNS failure in Jev --- tests/fm-jev.test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/fm-jev.test.sh b/tests/fm-jev.test.sh index 892edd2a8dd..15a36b19623 100755 --- a/tests/fm-jev.test.sh +++ b/tests/fm-jev.test.sh @@ -62,6 +62,7 @@ case "${FAKE_CURL_MODE:-ok}" in timeout) exit 28 ;; hang) sleep 3; exit 28 ;; refused) exit 7 ;; + dns) exit 6 ;; http500) printf '{"error":{"message":"boom"}}' > "$out"; printf '500' ;; nocost) printf '{"answers":{"handling":{"type":"choice","choice":"absorbable","confidence":0.9}},"usage":{}}' > "$out"; printf '200' ;; ok) @@ -465,7 +466,7 @@ test_api_errors_pause_until_the_next_day() { test_transport_errors_count_toward_the_timed_pause() { local home now until home=$(jev_case transport1 with-key) - timeout_drain "$home" 1 1 refused + timeout_drain "$home" 1 1 dns jev_events "$home" 'select(.why == "api-error")' | grep -q . || fail "a transport error was not logged" assert_absent "$home/state/jev/disabled" "one transport error paused Jev" assert_contains "$(in_home "$home" "$JEV" status)" 'timeout streak: 1 of 3' "the transport error did not count in the streak" From d74b8b10dcfea42c272da2db650f28892838656f Mon Sep 17 00:00:00 2001 From: Alan Domio Date: Fri, 16 Oct 2026 09:31:14 +0200 Subject: [PATCH 3/3] no-mistakes(document): Fix stale local-backend transport error note in Jev header --- bin/fm-jev.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/fm-jev.sh b/bin/fm-jev.sh index 62371202698..30cbdc2652c 100755 --- a/bin/fm-jev.sh +++ b/bin/fm-jev.sh @@ -124,12 +124,12 @@ # skipped by a pause is logged with why=disabled. # # The local backend has no per-request cost and no monotonic quota to protect, -# so apart from the timed timeout pause and an invalid endpoint none of its own -# failure reasons ever pauses it: a 1-minute load average at or above -# config/jev-max-load (default 8; checked before each request) or an -# API/transport error each only skip that one row (why=load/api-error), and the -# very next drain tries again. A timeout also skips the rest of that same -# drain's rows (why=timeout) without dialing, so a stuck server costs one +# so apart from the timed pause (timeouts and transport failures) and an invalid +# endpoint none of its own failure reasons ever pauses it: a 1-minute load +# average at or above config/jev-max-load (default 8; checked before each +# request) or an HTTP API error each only skip that one row +# (why=load/api-error), and the very next drain tries again. A timeout also +# skips the rest of that same drain's rows (why=timeout) without dialing, so a stuck server costs one # timeout per drain rather than one per row (and counts once toward the # streak), and the classify lock is never held long enough for detached drains # to pile up behind it. The wake itself is untouched in every case because