Skip to content

fix(bin): pause Jev only after consecutive timeouts, for a short self-clearing window, and announce every pause - #55

Merged
alandomio merged 4 commits into
mainfrom
fm/jev-pausa-timeout
Oct 4, 2026
Merged

alandomio merged 4 commits into
mainfrom
fm/jev-pausa-timeout

Conversation

@alandomio

Copy link
Copy Markdown
Owner

Intent

Fix the Jev shadow wake-triage self-pause rule in firstmate (bin/fm-jev.sh, its tests, docs/configuration.md). Problem measured on the captain's home 2026-09-27..2026-10-04: one request timeout wrote state/jev/disabled for the rest of the day (7 of 9 days), so only 254 of 4755 presented wakes were classified. Captain-approved behaviour (2026-10-04): (1) pause only after several CONSECUTIVE timeouts (default 3, config/jev-timeout-streak); a successful classification resets the streak. (2) The pause is short and self-clearing (default 60 minutes, config/jev-timeout-pause), after which Jev tries again; repeated pause episodes back off (doubling) but never beyond the end of the day. (3) The daily spend-cap pause is unchanged and still holds until tomorrow (other day pauses - API error, missing cost, invalid endpoint - also unchanged); shadow mode never acts on a wake. (4) Thresholds are configurable like the other Jev settings and documented in docs/configuration.md Jev shadow wake triage; status and report show the pause state truthfully (streak, pause-until time, reason) and report keeps counting skipped wakes by reason. (5) Works for both backends (OpenRouter and local loopback; the local backend, which never paused before, now also gets the timed timeout pause, counted once per drain). (6) A legacy state/jev/disabled file 'timeout' from the old format is read safely as already over; other legacy day pauses still hold. Tests: a failing-first test showing one timeout used to disable the day; tests for single timeout does not pause, N consecutive timeouts pause, success resets the streak, pause expires on its own and backs off, spend-cap pause unchanged, legacy disabled file read safely. Do not change gated absorption rules or go-live criteria; do not touch live state/jev or config. Captain addition (2026-10-04): Jev must never pause silently. Whenever Jev enters a pause for any reason (consecutive timeouts, spend cap, or anything else) it makes that visible to the supervising firstmate once per pause episode through the existing wake path (a check-style wake carrying the reason and the pause-until time); resuming after a pause is reported the same way only if the pause was announced; an active pause is also surfaced in the session-start digest. Both covered by tests and documented. Deliberate decisions: tests/fm-jev.test.sh unsets FM_CONFIG_OVERRIDE so cases read their own config; Jev's own jev-pause/jev-resume wakes are never sent to the classifier.

What Changed

  • bin/fm-jev.sh: a request timeout no longer pauses Jev shadow wake triage for the rest of the day. A pause now starts only after several consecutive timeouts (config/jev-timeout-streak, default 3; any successful classification resets the count), lasts a short self-clearing window (config/jev-timeout-pause, default 60 minutes), doubles on repeated episodes with no success in between, and never outlasts the local day. This applies to both backends: the local loopback backend now gets the timed timeout pause too, with a timeout counted once per drain. The spend-cap, API-error, missing-cost and invalid-endpoint pauses still hold until the next day, and a legacy <day><TAB>timeout disabled file is read as already over.
  • Pauses are no longer silent: entering any pause appends one check: jev-pause: ... wake per episode with the reason and end time, and the first successful classification after an announced pause appends one check: jev-resume: ... wake. Neither wake is sent to the classifier. status and report show the pause reason, its end time and the current timeout streak against its limit, and a new pause-state command lets bin/fm-session-start.sh print an active pause in the digest under "Jev classifier" (silent when nothing is paused).
  • Docs and tests: docs/configuration.md and AGENTS.md document the two new config files and the pause/announce behaviour. tests/fm-jev.test.sh adds cases for single timeout not pausing, consecutive timeouts pausing, configurable thresholds, streak reset on success, expiry with back-off, legacy disabled file, pause/resume announcements, pause-state, and the local backend; tests/fm-session-start.test.sh covers the digest line.

Risk Assessment

✅ Low: The fix round moved the resume notice to the success path of jev_classify_row exactly as decided, and tracing expiry-then-fail, expiry-then-success, success-that-hits-the-cap, legacy records and both backends found no wrong result or contradiction with the intent.

Testing

Ran tests/fm-jev.test.sh at the target commit (all 48 cases pass) and the same test file against the base commit's code, where it stops at "a single timeout paused Jev" — the failing-first proof. tests/fm-session-start.test.sh exits 1 at "MISSING diagnostic did not appear at all", which fails identically on the base commit, so I ran the new digest test on its own and it passes. I then drove the real fm-wake-drain.sh, fm-jev.sh and fm-session-start.sh against a fake curl in throwaway homes and saved the transcripts: one timeout does not pause, a success resets the streak, three consecutive timeouts pause for 60 minutes, the pause is announced once as a check wake with reason and until-time, a repeat episode doubles to 120 minutes and is capped at midnight, the resume wake appears only after the first successful classification, spend-cap and API-error pauses still hold until tomorrow and are announced, the local backend counts a drain once and pauses after three, legacy timeout files read as over while legacy api-error still holds, Jev's own wakes are never classified, and the session-start digest shows an active pause and is silent otherwise. No visual artifact: the change is CLI and text only. No live state/jev or config was touched and the worktree is clean.

Evidence: End-to-end Jev pause transcript (both backends, pause, back-off, announce, resume, legacy)

Source: End-to-end Jev pause transcript (both backends, pause, back-off, announce, resume, legacy)


\### 1. OpenRouter backend: ONE timeout does not pause
$ cat state/jev/disabled
(no such file)
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-or/.env)
timeout streak: 1 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-or/state/jev/shadow.jsonl
$ jev wakes in state/.wake-queue
(none)

\### 2. A success resets the streak
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-or/.env)
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-or/state/jev/shadow.jsonl

\### 3. Three CONSECUTIVE timeouts start a ~60 minute pause, announced once
now: 2026-10-04 20:04   network calls so far: 5 (1 timeout + 1 ok + 3 timeouts; 4th wake skipped)
$ cat state/jev/disabled
2026-10-04^Itimeout^I1791140667$
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-or/.env)
paused until 21:04: timeout
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 1)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-or/state/jev/shadow.jsonl
$ jev wakes in state/.wake-queue
check	jev-pause:1791137067:2407271	check: jev-pause: Jev shadow classification paused (timeout), until 21:04; wakes still surface unchanged, only the classifier is off
$ fm-jev.sh pause-state
Jev shadow classification is paused until 21:04 (timeout); wakes still surface unchanged, only the classifier is off.
$ fm-jev.sh report | grep -i -E 'paus|skipped|disabled|timeout'
paused until 21:04: timeout
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 1)
wakes presented: 6; classified: 1; skipped: 5 (disabled 1, timeout 4); not sent: 0; actual handling known: 0
  skipped: 0/0/0/5

\### 4. What the supervising firstmate sees on its next drain (the pause wake is presented, never classified)
$ fm-wake-drain.sh
1791137067	1	check	jev-pause:1791137067:2407271	check: jev-pause: Jev shadow classification paused (timeout), until 21:04; wakes still surface unchanged, only the classifier is off
network calls: before=5 after=5

\### 5. Pause runs out by itself; a failed retry sends NO resume; the first success does, once
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-or/.env)
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 1)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-or/state/jev/shadow.jsonl
after one failed retry:
$ jev wakes in state/.wake-queue
check	jev-pause:1791137067:2407271	check: jev-pause: Jev shadow classification paused (timeout), until 21:04; wakes still surface unchanged, only the classifier is off
after first successful classification:
$ jev wakes in state/.wake-queue
check	jev-pause:1791137067:2407271	check: jev-pause: Jev shadow classification paused (timeout), until 21:04; wakes still surface unchanged, only the classifier is off
check	jev-resume:1791137069:2409655	check: jev-resume: Jev shadow classification resumed after its timeout pause
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-or/.env)
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-or/state/jev/shadow.jsonl
resume wakes after another success: 1

\### 6. Repeat episode with no success in between backs off (doubling)
first pause:  60 min
second pause: 120 min
$ jev wakes in state/.wake-queue
check	jev-pause:1791137071:2410912	check: jev-pause: Jev shadow classification paused (timeout), until 21:04; wakes still surface unchanged, only the classifier is off
check	jev-pause:1791137071:2411434	check: jev-pause: Jev shadow classification paused (timeout), until 22:04; wakes still surface unchanged, only the classifier is off
config/jev-timeout-pause=99999 -> pause until 2026-10-05 00:00:00 (today is 2026-10-04)

\### 7. Configurable thresholds: config/jev-timeout-streak=2, config/jev-timeout-pause=10
pause after 2 timeouts: 10 min
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-cfg/.env)
paused until 20:14: timeout
timeout streak: 0 of 2 (that many in a row pause classification for 10 minutes, doubling per repeat, never past midnight; pause episodes today: 1)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-cfg/state/jev/shadow.jsonl

\### 8. Spend cap is unchanged: holds until tomorrow, and is announced
$ cat state/jev/disabled
2026-10-04^Icap$
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-cap/.env)
paused until tomorrow: cap
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-cap/state/jev/shadow.jsonl
$ jev wakes in state/.wake-queue
check	jev-pause:1791137073:2414112	check: jev-pause: Jev shadow classification paused (cap), until tomorrow; wakes still surface unchanged, only the classifier is off

\### 9. API error still pauses for the day (OpenRouter)
$ cat state/jev/disabled
2026-10-04^Iapi-error$
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-500/.env)
paused until tomorrow: api-error
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-500/state/jev/shadow.jsonl
$ jev wakes in state/.wake-queue
check	jev-pause:1791137074:2415472	check: jev-pause: Jev shadow classification paused (api-error), until tomorrow; wakes still surface unchanged, only the classifier is off

\### 10. Local loopback backend: a drain with 3 timed-out wakes counts ONCE; 3 such drains pause
$ fm-jev.sh status
Jev shadow triage: on, local backend (config/jev-endpoint = http://127.0.0.1:8017)
timeout streak: 1 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-local/state/jev/shadow.jsonl
$ cat state/jev/disabled
(no such file)
$ cat state/jev/disabled
2026-10-04^Itimeout^I1791140676$
$ fm-jev.sh status
Jev shadow triage: on, local backend (config/jev-endpoint = http://127.0.0.1:8017)
paused until 21:04: timeout
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 1)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-local/state/jev/shadow.jsonl
$ jev wakes in state/.wake-queue
check	jev-pause:1791137076:2418291	check: jev-pause: Jev shadow classification paused (timeout), until 21:04; wakes still surface unchanged, only the classifier is off

\### 11. Legacy state/jev/disabled files
$ cat state/jev/disabled
2026-10-04^Itimeout$
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-legacy/.env)
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-legacy/state/jev/shadow.jsonl
$ fm-jev.sh pause-state
[]
$ cat state/jev/disabled
2026-10-04^Iapi-error$
$ fm-jev.sh status
Jev shadow triage: on, OpenRouter backend (OPENROUTER_API_KEY present in /tmp/fm-jev-tests.rRyxJv/demo-legacy/.env)
paused until tomorrow: api-error
timeout streak: 0 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)
shadow log: /tmp/fm-jev-tests.rRyxJv/demo-legacy/state/jev/shadow.jsonl

\### 12. Jev never classifies its own jev-pause / jev-resume wakes
1790000000	1	check	jev-pause:1:1	check: jev-pause: Jev shadow classification paused (timeout), until 21:04
1790000000	2	check	jev-resume:1:2	check: jev-resume: Jev shadow classification resumed after its timeout pause
1790000000	3	check	inbox:3	check: captain inbox note 3 - hi
network calls for 3 presented wakes (2 Jev-own + 1 ordinary), Jev NOT paused: 1
{"ev":"presented","id":"1790000000:1","outcome":null,"why":null}
{"ev":"presented","id":"1790000000:2","outcome":null,"why":null}
{"ev":"presented","id":"1790000000:3","outcome":null,"why":null}
{"ev":"jev","id":"1790000000:3","outcome":"classified","why":null}
Evidence: Session-start digest with an active Jev pause

Source: Session-start digest with an active Jev pause

ok - the session-start digest names an active Jev pause and stays silent otherwise --- session-start digest excerpt, active timeout pause --- Jev classifier -------------------------------------------------------------------------------- Jev shadow classification is paused until 20:34 (timeout); wakes still surface unchanged, only the classifier is off. --- session-start digest excerpt, spend-cap day pause --- Jev shadow classification is paused until tomorrow (cap); wakes still surface unchanged, only the classifier is off. --- no pause: Jev lines in digest = 0 ---

ok - the session-start digest names an active Jev pause and stays silent otherwise
--- session-start digest excerpt, active timeout pause ---
99-
100-Jev classifier
101---------------------------------------------------------------------------------
102:Jev shadow classification is paused until 20:34 (timeout); wakes still surface unchanged, only the classifier is off.
103-
104-================================================================================
--- session-start digest excerpt, spend-cap day pause ---
99-
100-Jev classifier
101---------------------------------------------------------------------------------
102:Jev shadow classification is paused until tomorrow (cap); wakes still surface unchanged, only the classifier is off.
103-
104-================================================================================
--- no pause: Jev lines in digest = 0 ---
Evidence: Demo script that produced the transcript

Source: Demo script that produced the transcript

#!/usr/bin/env bash
# Manual end-to-end walk through the Jev pause rule, driving the real
# bin/fm-wake-drain.sh and bin/fm-jev.sh against a fake curl (no network).
# Run from the worktree root: bash jev-pause-demo.sh <path-to-stripped-test-lib>
set -u
. "$1"
say() { printf '\n### %s\n' "$*"; }
show() { printf '$ %s\n' "$*"; }
st() { show "fm-jev.sh status"; in_home "$1" "$JEV" status | grep -i -E 'backend|paus|streak|shadow' ; }
dis() { show "cat state/jev/disabled"; if [ -f "$1/state/jev/disabled" ]; then cat -A "$1/state/jev/disabled"; else echo "(no such file)"; fi; }
wk() { show "jev wakes in state/.wake-queue"; local w; w=$(queued_wakes "$1" jev- | cut -f3-); [ -n "$w" ] && printf '%s\n' "$w" || echo "(none)"; }

say "1. OpenRouter backend: ONE timeout does not pause"
h=$(jev_case demo-or with-key)
timeout_drain "$h" 1 1
dis "$h"; st "$h"; wk "$h"

say "2. A success resets the streak"
timeout_drain "$h" 2 1 ok
st "$h"

say "3. Three CONSECUTIVE timeouts start a ~60 minute pause, announced once"
timeout_drain "$h" 3 4
echo "now: $(date '+%F %H:%M')   network calls so far: $(calls "$h") (1 timeout + 1 ok + 3 timeouts; 4th wake skipped)"
dis "$h"; st "$h"; wk "$h"
show "fm-jev.sh pause-state"; in_home "$h" "$JEV" pause-state
show "fm-jev.sh report | grep -i -E 'paus|skipped|disabled|timeout'"; in_home "$h" "$JEV" report | grep -i -E 'paus|skipped|disabled|timeout'

say "4. What the supervising firstmate sees on its next drain (the pause wake is presented, never classified)"
before=$(calls "$h")
show "fm-wake-drain.sh"; in_home "$h" env FM_JEV_FOREGROUND=1 FAKE_CURL_MODE=ok "$DRAIN" 2>/dev/null | grep -i 'jev-pause'
echo "network calls: before=$before after=$(calls "$h")"

say "5. Pause runs out by itself; a failed retry sends NO resume; the first success does, once"
printf '%s\ttimeout\t%s\n' "$(date +%F)" "$(( $(date +%s) - 5 ))" > "$h/state/jev/disabled"
st "$h"
timeout_drain "$h" 7 1
echo "after one failed retry:"; wk "$h"
timeout_drain "$h" 8 1 ok
echo "after first successful classification:"; wk "$h"; st "$h"
timeout_drain "$h" 9 1 ok
echo "resume wakes after another success: $(queued_wakes "$h" jev-resume: | wc -l | tr -d ' ')"

say "6. Repeat episode with no success in between backs off (doubling)"
h=$(jev_case demo-backoff with-key)
timeout_drain "$h" 1 3; echo "first pause:  $(( ($(pause_until "$h") - $(date +%s) + 30) / 60 )) min"
printf '%s\ttimeout\t%s\n' "$(date +%F)" "$(( $(date +%s) - 5 ))" > "$h/state/jev/disabled"
timeout_drain "$h" 4 3; echo "second pause: $(( ($(pause_until "$h") - $(date +%s) + 30) / 60 )) min"
wk "$h"
h=$(jev_case demo-daycap with-key); printf '99999\n' > "$h/config/jev-timeout-pause"
timeout_drain "$h" 1 3
echo "config/jev-timeout-pause=99999 -> pause until $(date -d "@$(pause_until "$h")" '+%F %H:%M:%S') (today is $(date +%F))"

say "7. Configurable thresholds: config/jev-timeout-streak=2, config/jev-timeout-pause=10"
h=$(jev_case demo-cfg with-key); printf '2\n' > "$h/config/jev-timeout-streak"; printf '10\n' > "$h/config/jev-timeout-pause"
timeout_drain "$h" 1 2; echo "pause after 2 timeouts: $(( ($(pause_until "$h") - $(date +%s) + 30) / 60 )) min"; st "$h"

say "8. Spend cap is unchanged: holds until tomorrow, and is announced"
h=$(jev_case demo-cap with-key); printf '0.000015\n' > "$h/config/jev-daily-cap"
queue_row "$h" 1 check inbox:1 'check: captain inbox note 1 - hi'; queue_row "$h" 2 check inbox:2 'check: captain inbox note 2 - hi'
in_home "$h" env FM_JEV_FOREGROUND=1 FAKE_COST=0.00002 "$DRAIN" >/dev/null 2>&1
dis "$h"; st "$h"; wk "$h"

say "9. API error still pauses for the day (OpenRouter)"
h=$(jev_case demo-500 with-key); timeout_drain "$h" 1 2 http500
dis "$h"; st "$h"; wk "$h"

say "10. Local loopback backend: a drain with 3 timed-out wakes counts ONCE; 3 such drains pause"
h=$(jev_local_case demo-local)
timeout_drain "$h" 1 3; st "$h"; dis "$h"
timeout_drain "$h" 4 1; timeout_drain "$h" 5 1
dis "$h"; st "$h"; wk "$h"

say "11. Legacy state/jev/disabled files"
h=$(jev_case demo-legacy with-key); mkdir -p "$h/state/jev"
printf '%s\ttimeout\n' "$(date +%F)" > "$h/state/jev/disabled"; dis "$h"; st "$h"
show "fm-jev.sh pause-state"; echo "[$(in_home "$h" "$JEV" pause-state)]"
printf '%s\tapi-error\n' "$(date +%F)" > "$h/state/jev/disabled"; dis "$h"; st "$h"
Evidence: Pause and resume as the supervising firstmate sees them
$ fm-jev.sh status (after ONE timeout)
timeout streak: 1 of 3 (that many in a row pause classification for 60 minutes, doubling per repeat, never past midnight; pause episodes today: 0)

$ cat state/jev/disabled (after three consecutive timeouts)
2026-10-04<TAB>timeout<TAB>1791140667
$ fm-jev.sh status
paused until 21:04: timeout
$ fm-jev.sh report
wakes presented: 6; classified: 1; skipped: 5 (disabled 1, timeout 4); not sent: 0; actual handling known: 0
$ fm-wake-drain.sh
1791137067 1 check jev-pause:1791137067:2407271 check: jev-pause: Jev shadow classification paused (timeout), until 21:04; wakes still surface unchanged, only the classifier is off

after pause expiry + one failed retry: no jev-resume wake
after first successful classification:
check jev-resume:1791137069:2409655 check: jev-resume: Jev shadow classification resumed after its timeout pause

repeat episode: first pause 60 min, second pause 120 min; jev-timeout-pause=99999 -> until 2026-10-05 00:00:00
spend cap: disabled = 2026-10-04<TAB>cap -> paused until tomorrow: cap (announced)
local backend: 3 timeouts in one drain -> streak 1 of 3; three drains -> paused until 21:04: timeout
legacy '<day><TAB>timeout' -> not paused; legacy '<day><TAB>api-error' -> paused until tomorrow: api-error
Evidence: Failing-first: new test against base commit e133691
not ok - a single timeout paused Jev
- Outcome: ⚠️ 1 warning across 1 run (6m4s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 info
  • ℹ️ bin/fm-jev.sh:645 - The header comment above jev_classify_row still says only the OpenRouter backend ever pauses here "(timeout, API error, or a missing cost)" and that the local backend only skips the row on any of those. After this change a timeout pauses neither backend for the day; it feeds jev_timeout_note, which can start a timed pause on both backends. Update the comment to match the new rule described in the file header.
  • ℹ️ bin/fm-jev.sh:771 - jev_pause_resume_notice runs at the start of the first drain after a pause ends, before any request is tried. For a persistent cause (dead endpoint, invalid config/jev-endpoint, unusable API key) the supervising session gets a "jev-resume" check wake followed shortly by a new "jev-pause" wake: once per back-off episode for timeouts, and once per day for day pauses. This matches the stated intent (resume is reported when the pause ends, once per announced episode), so it is only a product question: should the resume wake wait for the first successful classification instead?
  • ℹ️ bin/fm-jev.sh:440 - If fm_wake_append fails when a pause is entered (queue lock or recovery-marker I/O failure), jev_pause_announce returns without writing state/jev/pause-announced. Later drains see the pause as already active and never announce it, so that episode is visible only in status, report and the session-start digest. This is a narrow failure path; retrying would need a new "announcement pending" state, so the remedy rather than the defect is what needs authorization.

🔧 Fix: announce Jev resume only after first successful classification
1 info still open:

  • ℹ️ bin/fm-jev.sh:796 - Jev's own jev-pause/jev-resume wakes are skipped only in the classification loop; the first loop of cmd_observe_drain (line 768) still logs a "presented" event for them. In report they therefore count under "wakes presented" and "not sent", with no classified or skipped event. That is literally true and consistent with the deliberate decision never to send them to the classifier, and it only adds one or two rows per pause episode, so no action is needed unless the captain wants them excluded from the report totals.
⚠️ **Test** - 1 warning
  • ⚠️ tests/fm-session-start.test.sh:990 - test_output_ordering_diagnostics_lead fails with "MISSING diagnostic did not appear at all" and aborts the file, so the new test_digest_surfaces_an_active_jev_pause and every later case never run in a normal invocation on this machine. The failure is identical on base commit e133691, so this change did not introduce it. I did not diagnose the cause; the test removes the fake node and expects a MISSING: node line that never appears here, which may be a host-environment effect. The new test passes when run in isolation. CI should confirm whether the file is green there.
  • bash tests/fm-jev.test.sh at target 55aa6b9: exit 0, 48 ok, 0 not ok
  • Target tests/fm-jev.test.sh run against a git archive e133691 copy of the base code: stops at not ok - a single timeout paused Jev
  • bash tests/fm-session-start.test.sh at target: exit 1 at not ok - MISSING diagnostic did not appear at all (test_output_ordering_diagnostics_lead)
  • bash tests/fm-session-start.test.sh on the base e133691 copy: the same MISSING diagnostic failure
  • test_digest_surfaces_an_active_jev_pause run in isolation from a temporary copy of the session-start test with the call list stripped: ok
  • Manual run of jev-pause-demo.sh: real bin/fm-wake-drain.sh and bin/fm-jev.sh status|report|pause-state against a fake curl, covering OpenRouter and local backends, streak, pause, back-off, midnight cap, configurable thresholds, spend cap, API error, legacy files, pause and resume wakes
  • Manual drain of queued jev-pause/jev-resume check wakes plus one ordinary wake with Jev not paused: one network call, only the ordinary wake classified
  • Manual bin/fm-session-start.sh run in a test world with an active timeout pause, a spend-cap pause and no pause: digest excerpt captured
  • Checked docs/configuration.md documents config/jev-timeout-streak, config/jev-timeout-pause and the jev-pause/jev-resume wakes (lines 638-646)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Alan Domio and others added 4 commits October 4, 2026 19:31
…ing window instead of the rest of the day

One request timeout wrote state/jev/disabled for the whole day, so Jev classified only 254 of 4755 wakes over nine days.
Now the Nth consecutive timeout (config/jev-timeout-streak, default 3; a successful classification resets it) pauses classification for config/jev-timeout-pause minutes (default 60), doubling on repeat pauses and never past the end of the day, on both backends.
The daily spend-cap pause and the other day pauses are unchanged, a legacy whole-day timeout record is read as already over, and status and report show the pause, its end time and the streak.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ke and show an active pause at session start

Entering any pause, of either kind and for any reason, now appends one check wake naming the reason and the pause-until time, once per pause episode.
The first drain after an announced pause ends appends one resume wake; an unannounced pause is never reported as resumed.
Both announcements skip the classifier, and fm-session-start.sh prints an active pause (silent otherwise) through the new fm-jev.sh pause-state.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@alandomio
alandomio merged commit cfa4ac9 into main Oct 4, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant