Repository navigation
fix(bin): pause Jev only after consecutive timeouts, for a short self-clearing window, and announce every pause - #55
Merged
Merged
Conversation
…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]>
…ate in inventories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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>timeoutdisabled file is read as already over.check: jev-pause: ...wake per episode with the reason and end time, and the first successful classification after an announced pause appends onecheck: jev-resume: ...wake. Neither wake is sent to the classifier.statusandreportshow the pause reason, its end time and the current timeout streak against its limit, and a newpause-statecommand letsbin/fm-session-start.shprint an active pause in the digest under "Jev classifier" (silent when nothing is paused).docs/configuration.mdandAGENTS.mddocument the two new config files and the pause/announce behaviour.tests/fm-jev.test.shadds 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.shcovers 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)
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 ---Evidence: Demo script that produced the transcript
Source: Demo script that produced the transcript
Evidence: Pause and resume as the supervising firstmate sees them
Evidence: Failing-first: new test against base commit e133691
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
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. Inreportthey 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.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 fakenodeand expects aMISSING: nodeline 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.shat target 55aa6b9: exit 0, 48 ok, 0 not okTargettests/fm-jev.test.shrun against agit archive e133691copy of the base code: stops atnot ok - a single timeout paused Jevbash tests/fm-session-start.test.shat target: exit 1 atnot ok - MISSING diagnostic did not appear at all(test_output_ordering_diagnostics_lead)bash tests/fm-session-start.test.shon the base e133691 copy: the sameMISSING diagnosticfailuretest_digest_surfaces_an_active_jev_pauserun in isolation from a temporary copy of the session-start test with the call list stripped: okManual run ofjev-pause-demo.sh: realbin/fm-wake-drain.shandbin/fm-jev.sh status|report|pause-stateagainst 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 wakesManual drain of queuedjev-pause/jev-resumecheck wakes plus one ordinary wake with Jev not paused: one network call, only the ordinary wake classifiedManualbin/fm-session-start.shrun in a test world with an active timeout pause, a spend-cap pause and no pause: digest excerpt capturedCheckeddocs/configuration.mddocumentsconfig/jev-timeout-streak,config/jev-timeout-pauseand thejev-pause/jev-resumewakes (lines 638-646)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.