Repository navigation
feat(bin): add opt-in Jev triage for stale-escalation wakes - #4896
RooseveltAdvisors wants to merge 1 commit into
Conversation
3661712 to
ebb0331
Compare
|
Love this idea |
[Medium impact] The PR appears safe to merge, with a non-blocking gap in recording later alarms. Reviews (4) · Last reviewed commit: "feat(bin): add opt-in Jev triage for sta..." · Reviewed by Greptile |
Rebase PR 4896 onto current upstream main: port the default-off Jev stale-escalation gate into today's wedge ladder (after wait, write, dead, validating, T3, and guard probes), keep fail-open semantics, and update watcher marker keys in the portable tests for v3 window identity.
66bc4d3 to
f6f35e7
Compare
| { read -r prev count < "$streak"; } 2>/dev/null || true | ||
| case "$count" in ''|*[!0-9]*) count=0 ;; esac | ||
| [ "$prev" = "$fp" ] || count=0 | ||
| [ "$count" -lt "$FM_WEDGE_DEMAND_INSPECT_COUNT" ] || return 1 |
There was a problem hiding this comment.
When an unchanged pane reaches the suppression cap, this return skips the helper. The watcher then escalates, but the calibration outcome stays pending. With the defaults, this happens after three suppressions while the first-20 calibration window is still open, leaving the audit without the later alarm.
Record later_escalated after the wake is queued, without making another model call.
|
Speaking as Kun's firstmate: thanks @RooseveltAdvisors. I read the full diff on
Notes for the decision, not blocking: when it's enabled, the request sends the last five status lines to typesafe.ai without applying Contract class, from my own read: opt-in. Because it sends an API key to an outside service, it won't go through our labelled full suite. Once the two items above are done, it goes to Kun for a decision. |
Intent
Take over upstream PR #4896 (Jev wake-triage opt-in egress and the 0.6 floor suppress-confidence fix, branch fm/fm-jev-wake-triage) from a lane whose terminal died, AND reconcile its split work before anything moves. Facts verified by firstmate: the PR is OPEN but CONFLICTING (mergeable=false) at head ebb0331; the prior lane's local copy ~/.treehouse/firstmate-8bf1b0/29/firstmate sits clean at 907d9cc0 and DIVERGES from the PR head - five local-only commits with patch-id proof that most have NO twin on the PR line: 907d9cc0 (the task's own core fix: opt in Jev wake triage and floor suppress confidence - NOT on the PR), 3268cf71 (classify stale escalations with Jev - the PR carries a same-subject 7da325d whose patch DIFFERS, so both are live inputs), f4574594 (docs - patch-twin of the PR's ebb0331, verify rather than duplicate), plus two commits whose content is already on current main (dee119b #5076, c443d8c #5060). Nothing may be dropped in either direction. The prior lane's waits expired 2026-09-25; the chain is healthy now.
What Changed
bin/fm-jev-wake-triage.sh. It calls typesafe.ai's System One model (Jev) to sort a stale-escalation candidate intopipeline_wait,true_wedge, orhealthy_idle. It suppresses only for a non-wedge answer with Choice confidence of at least 0.6, the same floor asfm-dispatch-resolve.sh. A missing key, timeout, HTTP error, malformed answer, or low confidence makes it fail open toaction=unavailable. It readsTYPESAFE_API_KEYfrom the process environment only and never from.env. It writes class-only telemetry tostate/.jev-triage-telemetryand appends the first 20 decisions to a calibration log atstate/.jev-triage-calibration.jsonl.wedge_jev_triageintobin/fm-watch.sh's at-threshold wedge path, after the wait, worktree-write, and dead-record probes. The gate is off by default.config/jev-wake-triageorFM_JEV_WAKE_TRIAGEturns it on, and any unrecognized value keeps it off. A suppress restarts the idle timer and leaves the escalation counter unchanged. Consecutive suppressions are capped atFM_WEDGE_DEMAND_INSPECT_COUNTper unchanged status line, tracked in a new.jev-suppress-<key>marker. The watcher andfm-supervise-daemon.shclear that marker wherever they clear the other per-window stale markers.docs/configuration.mdanddocs/architecture.md, and addsdocs/verification/jev-wake-triage.mdand the operational-home-layout skill entry. Addstests/fm-jev-wake-triage.test.sh, which is registered infm-test-run.shand uses a new helper intests/lib.sh.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The reconciliation is complete: every Jev-specific file is identical to the prior lane's 907d9cc0 and the Jev hunks in shared files match it, with the configuration.md env-var line additionally corrected to say default-off. The changes keep fail-open behavior, flip the gate to opt-in, and add a well-tested confidence floor; only minor egress-policy and calibration-fidelity notes remain.
Testing
I ran the targeted suite tests/fm-jev-wake-triage.test.sh (22 cases, all passing). I then ran the real watcher and the real triage helper against a real tmux pane in a throwaway lab home. A local curl shim answered in place of typesafe.ai. A crew-state stand-in reported a pipeline run-step, so no live no-mistakes run was needed. - Gate off: with no config, an empty config or a misspelled one, the watcher escalated and made no Jev call. - Gate on, pipeline_wait at 0.9: the wake was suppressed 3 times. Calibration rows and telemetry were written and a streak marker was kept. - Streak cap: the 4th stale cycle paged without a model call. Later cycles climbed to escalation 3 with demand-deep-inspection. - Escalations: pipeline_wait at 0.5 and true_wedge both escalated. - API key: it went in a header read from a file descriptor and never appeared on curl's command line. Two things were not checked live. The streak restarting when the status line changes, and the pending log stopping at the calibration cap, were only covered by the suite. A real call to api.typesafe.ai was not made because it needs a production TYPESAFE_API_KEY. This change has no UI, so the evidence is CLI transcripts, not screenshots.Evidence: Targeted Jev wake-triage suite transcript
Source: Targeted Jev wake-triage suite transcript
Evidence: Live lab drive: default-off, empty/typo config, suppress-until-cap, below-floor, true_wedge
Source: Live lab drive: default-off, empty/typo config, suppress-until-cap, below-floor, true_wedge
Evidence: Live lab drive: capped streak climbs to demand-deep-inspection with no further Jev calls
Source: Live lab drive: capped streak climbs to demand-deep-inspection with no further Jev calls
cycle 2: escalation 2, jev curl calls: 0 cycle 3: stale: fmlab:fm-jevlive (idle 3s, possible wedge, escalation 3, demand-deep-inspection: same pane has wedge-escalated 3 times in a row ...), jev curl calls: 0Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-watch.sh:1526- With the gate now off by default, the config-file branch still ends in a leftover*) return 0from when it was on by default. So an emptyconfig/jev-wake-triage, or any first line other than off/0/false/no (for example a typo likeofordisable), turns on the gate and sends status-log text to typesafe.ai. docs/configuration.md:617 says only that a first line ofonenables it andoffkeeps it off; it does not cover empty or other values. Whether an empty file should act as a presence opt-in, as the other config flags do, or onlyon|1|true|yesshould enable it is an egress-policy choice for the author. The prior lane's 907d9cc0 has the same behavior.bin/fm-jev-wake-triage.sh:270- A pipeline_wait or healthy_idle answer below the confidence floor goes through emit_unavailable. The calibration row and telemetry for that case therefore record action=unavailable with choice and noul set to null, the same as an API outage. The 'first 20 calibration' audit then loses Jev's actual answer for exactly the borderline cases it exists to measure. The fail-open behavior itself is correct and documented. A possible follow-up: pass the choice and noul through on this path so calibration keeps them.🔧 Fix applied.
4 issues (1 warning, 3 infos) still open:
bin/fm-watch.sh:1526- With the gate now off by default, the config-file branch still ends in a leftover*) return 0from when it was on by default. So an emptyconfig/jev-wake-triage, or any first line other than off/0/false/no (for example a typo likeofordisable), turns on the gate and sends status-log text to typesafe.ai. docs/configuration.md:617 says only that a first line ofonenables it andoffkeeps it off; it does not cover empty or other values. Whether an empty file should act as a presence opt-in, as the other config flags do, or onlyon|1|true|yesshould enable it is an egress-policy choice for the author. The prior lane's 907d9cc0 has the same behavior.bin/fm-jev-wake-triage.sh:270- A pipeline_wait or healthy_idle answer below the confidence floor goes through emit_unavailable. The calibration row and telemetry for that case therefore record action=unavailable with choice and noul set to null, the same as an API outage. The 'first 20 calibration' audit then loses Jev's actual answer for exactly the borderline cases it exists to measure. The fail-open behavior itself is correct and documented. A possible follow-up: pass the choice and noul through on this path so calibration keeps them.bin/fm-watch.sh:1544- There is no limit on how many times in a row Jev can suppress the same pane. On suppress, wedge_jev_triage resets since_file and returns before the escalation counter goes up. Example: a ship is really wedged, but its last status line is still 'validating (running)'. Every time it reaches the stall threshold, Jev answers pipeline_wait with confidence of at least 0.6. The timer resets, the counter stays at n, and FM_WEDGE_DEMAND_INSPECT_COUNT is never reached, so the pane never pages. Each cycle also spends one more model call. The gate is opt-in and the docs describe suppression, so this is a product decision, not a source bug. A cap needs new per-task state, for example a suppress count stored next to .wedge-escalations-*, that forces escalation after K suppressions. Adding that state goes beyond what this change was meant to do, so it needs authorization. This behavior was not touched by fix round 1.bin/fm-jev-wake-triage.sh:154- After the calibration cap is reached, write_calibration still adds a task/action line to state/.jev-triage-pending on every decision. That file is only read on the path below the cap, which 907d9cc0 made unreachable once the cap closes. So after the first 20 decisions it only grows and is never read again. Removing the append in the n >= limit branch would make it bounded, and nothing reads that data.🔧 Fix applied.
2 infos still open:
bin/fm-jev-wake-triage.sh:270- A pipeline_wait or healthy_idle answer below the confidence floor goes through emit_unavailable. The calibration row and telemetry for that case therefore record action=unavailable with choice and noul set to null, the same as an API outage. The 'first 20 calibration' audit then loses Jev's actual answer for exactly the borderline cases it exists to measure. The fail-open behavior itself is correct and documented. A possible follow-up: pass the choice and noul through on this path so calibration keeps them..agents/skills/operational-home-layout/SKILL.md:118- Fix round 2 (e03fc56) added a new per-window watcher marker, state/.jev-suppress-<key>. It is cleared alongside .wedge-escalations-* in bin/fm-watch.sh:814, :1670, :1793 and bin/fm-supervise-daemon.sh:572. The home-layout state listing, however, still names only.hash-* .count-* .stale-* ... .wedge-escalations-* ...as watcher internals. An operator reading that list cannot tell the new file is watcher-owned and must not be touched. The fix is to add.jev-suppress-*to that line, next to.wedge-escalations-*.🔧 Fix applied.
1 info still open:
bin/fm-jev-wake-triage.sh:270- A pipeline_wait or healthy_idle answer below the confidence floor goes through emit_unavailable. The calibration row and telemetry for that case therefore record action=unavailable with choice and noul set to null, the same as an API outage. The 'first 20 calibration' audit then loses Jev's actual answer for exactly the borderline cases it exists to measure. The fail-open behavior itself is correct and documented. A possible follow-up: pass the choice and noul through on this path so calibration keeps them.✅ **Test** - passed
✅ No issues found.
bash tests/fm-jev-wake-triage.test.sh(22 cases, all pass)Live lab drive:bin/fm-lab-home.sh create $LAB, real tmux pane on the privatefm-labsocket, realbin/fm-watch.sh+ realbin/fm-jev-wake-triage.sh, with a curl shim on PATH in place of api.typesafe.ai and a stand-in for FM_CREW_STATE_BIN that reports a run-step; scenarios A/B/B2/C/D/ELive lab drive continuation: 4 more watcher cycles on the same capped streak until the demand-deep-inspection page appearedTeardown:tmux -L fm-lab kill-server,rm -rf $LAB, scratch scripts removed, worktree confirmed clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.