diff --git a/bin/fm-pending-reply-lib.sh b/bin/fm-pending-reply-lib.sh index 481f55da3ff..014ad064f01 100755 --- a/bin/fm-pending-reply-lib.sh +++ b/bin/fm-pending-reply-lib.sh @@ -64,6 +64,9 @@ # ack_lines= count of correlated working:/paused: lines seen # ack_line_epoch= when the latest of those lines was first seen # escalated_epoch= +# escalation_wake_due_epoch= +# when a quiet missed or unreported escalation becomes +# a wake; empty once woken or when it woke at once # escalation_closed_epoch= # when the durable status decision opened by that # escalation was closed again (see the escalation @@ -108,6 +111,18 @@ # (bin/fm-backlog-handoff.sh's receiver wake) stayed refused forever once the # watcher escalated between the lost transport and the next resume. # +# Quiet escalation: a missed or unreported escalation for a delivered request is +# bookkeeping until proven otherwise - the mate is usually still working or has +# answered where main already saw it, and every wake costs a supervisor turn that +# re-reads the whole conversation. So the keyed blocked decision is published +# with the home's own self-announced append (no wake) and still lists in the next +# drain's OPEN DECISIONS. Only a request still unresolved after +# FM_PENDING_REPLY_WAKE_HOLD_SECS gets one wake: a plain reminder line under the +# same key (escalation_wake_due_epoch holds the due time; the reminder clears it). +# A reply landing in between resolves the record and closes the decision without +# any wake. Delivery-unknown and recovery-delivery escalations report a transport +# fault main must act on, so they wake at once as before. +# # Sourced by bin/fm-send.sh, bin/fm-watch.sh, bin/fm-secondmate-report.sh, and # tests. No side effects on source. set -u / set -e safe. # @@ -119,6 +134,11 @@ # FM_PENDING_REPLY_ACK_SECS default 1800; how long an acknowledged request # may go without a new correlated line before # the pending-reply-unreported escalation +# FM_PENDING_REPLY_WAKE_HOLD_SECS +# default 3600; how long a missed or unreported +# escalation stays a quiet status decision before +# it wakes the supervisor (see the quiet +# escalation note above); 0 wakes at once # FM_PENDING_REPLY_DIR_OVERRIDE override the pending-replies directory (tests) # FM_PENDING_REPLY_SEND_HOOK optional command template for recovery delivery # (tests); receives task_id and full message as args @@ -146,6 +166,7 @@ FM_PENDING_REPLY_SCHEMA='fm-pending-reply.v1' FM_PENDING_REPLY_CORR_RE='corr=[A-Fa-f0-9]{16}' FM_PENDING_REPLY_GRACE_DEFAULT=120 FM_PENDING_REPLY_ACK_DEFAULT=1800 +FM_PENDING_REPLY_WAKE_HOLD_DEFAULT=3600 fm_pending_reply_now() { if [ -n "${FM_PENDING_REPLY_NOW:-}" ]; then @@ -171,6 +192,14 @@ fm_pending_reply_ack_secs() { printf '%s' "$a" } +fm_pending_reply_wake_hold_secs() { + local h=${FM_PENDING_REPLY_WAKE_HOLD_SECS:-$FM_PENDING_REPLY_WAKE_HOLD_DEFAULT} + case "$h" in + ''|*[!0-9]*) h=$FM_PENDING_REPLY_WAKE_HOLD_DEFAULT ;; + esac + printf '%s' "$h" +} + # Directory holding durable pending-reply records for . fm_pending_reply_dir() { # local state=$1 @@ -378,6 +407,7 @@ recovery_delivery_outcome= recovery_turn_seen_busy=0 recovery_turn_completed_epoch= escalated_epoch= +escalation_wake_due_epoch= resolved_epoch= resolved_via= wrong_home_hits=0 @@ -1234,6 +1264,26 @@ fm_pending_reply_escalation_line() { # printf '%s' "$found" } +# True while 's keyed decision is still open with that exact +# note in bin/fm-classify-lib.sh's fold, so nothing reopens or closes a +# decision another writer has since closed or taken over. +_fm_pending_reply_escalation_open() { # + local key note open_line open_key open_note + key=$(_fm_decision_key "$2") || key='' + note=$(status_line_note "$2") + while IFS= read -r open_line; do + [ -n "$open_line" ] || continue + open_key=${open_line%%$'\t'*} + [ "$open_key" = "$key" ] || continue + open_note=${open_line#*$'\t'} + open_note=${open_note#*$'\t'} + [ "$open_note" = "$note" ] && return 0 + done <. # Idempotent, and safe to retry until it succeeds: it appends the closing line # only while that exact keyed decision is still open in @@ -1261,8 +1311,8 @@ fm_pending_reply_close_escalation() { # } _fm_pending_reply_close_escalation_locked() { # - local state=$1 corr=$2 rec escalated closed parent_status escalation key note - local open_line open_key open_note now close_line close_rc _task _via + local state=$1 corr=$2 rec escalated closed parent_status escalation key + local now close_line close_rc _task _via rec=$(fm_pending_reply_path "$state" "$corr") [ -f "$rec" ] || return 1 [ "$(fm_pending_reply_get "$rec" phase)" = resolved ] || return 0 @@ -1273,32 +1323,21 @@ _fm_pending_reply_close_escalation_locked() { # parent_status=$(fm_pending_reply_get "$rec" parent_status) [ -n "$parent_status" ] || return 1 escalation=$(fm_pending_reply_escalation_line "$parent_status" "$rec" "$corr") - if [ -n "$escalation" ]; then + if [ -n "$escalation" ] && _fm_pending_reply_escalation_open "$parent_status" "$escalation"; then key=$(_fm_decision_key "$escalation") || key='' - note=$(status_line_note "$escalation") - while IFS= read -r open_line; do - [ -n "$open_line" ] || continue - open_key=${open_line%%$'\t'*} - [ "$open_key" = "$key" ] || continue - open_note=${open_line#*$'\t'} - open_note=${open_note#*$'\t'} - [ "$open_note" = "$note" ] || continue - # This close is the home's own bookkeeping, written by the same resolve - # or tick that already consumed the reply, so it uses the guarded - # self-announced append (bin/fm-wake-lib.sh, sourced by this function's - # wrappers) and does not wake the home that wrote it; the escalation - # OPEN above stays a plain append because a new blocker must wake. - _task=$(fm_pending_reply_get "$rec" task_id) - _via=$(fm_pending_reply_get "$rec" resolved_via) - close_line="resolved [key=${key}]: $(fm_pending_reply_resolved_note "$_task" "$corr" "$_via")" - close_rc=0 - fm_wake_status_append_self_announced "${parent_status%/*}" "$parent_status" "$close_line" \ - 2>/dev/null || close_rc=$? - [ "$close_rc" -ne 2 ] || return 1 - break - done </dev/null || close_rc=$? + [ "$close_rc" -ne 2 ] || return 1 fi now=$(fm_pending_reply_now) fm_pending_reply_set "$rec" escalation_closed_epoch "$now" @@ -1331,7 +1370,7 @@ fm_pending_reply_maybe_escalate() { # _fm_pending_reply_maybe_escalate_locked() { # local state=$1 corr=$2 local rec phase completed now payload parent_status line kind first display - local delivered task_id meta sm_home remote_host grace age + local delivered task_id meta sm_home remote_host grace age hold quiet append_rc rec=$(fm_pending_reply_path "$state" "$corr") [ -f "$rec" ] || return 1 phase=$(fm_pending_reply_get "$rec" phase) @@ -1403,15 +1442,88 @@ _fm_pending_reply_maybe_escalate_locked() { # [ -n "$parent_status" ] || return 1 mkdir -p "$(dirname "$parent_status")" 2>/dev/null || return 1 line="blocked [key=$(fm_pending_reply_escalation_key "$corr")]: $payload" + hold=$(fm_pending_reply_wake_hold_secs) + quiet=0 + case "$kind" in + missed|unreported) [ "$hold" -gt 0 ] && [ -n "$delivered" ] && quiet=1 ;; + esac if ! status_event_recorded "$parent_status" "$line"; then - printf '%s\n' "$(status_stamp_line "$line")" >> "$parent_status" 2>/dev/null || return 1 + if [ "$quiet" = 1 ]; then + # Rc 1 (appended, marker left alone) still records the owned range that + # keeps the signal gate quiet, and where it cannot the watcher wakes + # as before; either way the reminder is armed, so a miss is never dropped. + append_rc=0 + fm_wake_status_append_self_announced "${parent_status%/*}" "$parent_status" "$line" \ + 2>/dev/null || append_rc=$? + [ "$append_rc" -ne 2 ] || return 1 + else + printf '%s\n' "$(status_stamp_line "$line")" >> "$parent_status" 2>/dev/null || return 1 + fi fi now=$(fm_pending_reply_now) + if [ "$quiet" = 1 ]; then + fm_pending_reply_set "$rec" escalation_wake_due_epoch "$((now + hold))" || return 1 + fi fm_pending_reply_set "$rec" escalated_epoch "$now" || return 1 fm_pending_reply_set "$rec" phase escalated || return 1 return 0 } +# Wake once for a quiet escalation that is still unresolved after the hold. +# Appends a plain reminder under the escalation's own key, so the reserved-key +# fold replaces the open note and a later resolve closes it like any escalation. +# Retryable: the due epoch clears only after the reminder is on disk. +fm_pending_reply_wake_held_escalation() { # + # Serialized per correlation, like the escalation and its close; see + # fm_pending_reply_maybe_escalate for why the wake-lib globals are local. + local state=$1 corr=$2 lock rc=0 + local STATE FM_WAKE_QUEUE FM_WAKE_QUEUE_LOCK + STATE=$state + lock="$state/.pending-reply-$corr.lock" + # Deliberately undirected, as in fm_pending_reply_maybe_escalate. + . "$_FM_PENDING_REPLY_LIB_DIR/fm-wake-lib.sh" + fm_lock_acquire_wait "$lock" || return 1 + _fm_pending_reply_wake_held_escalation_locked "$@" || rc=$? + fm_lock_release "$lock" + return "$rc" +} + +_fm_pending_reply_wake_held_escalation_locked() { # + local state=$1 corr=$2 rec due escalated now parent_status escalation note suffix + rec=$(fm_pending_reply_path "$state" "$corr") + [ -f "$rec" ] || return 1 + [ "$(fm_pending_reply_get "$rec" phase)" = escalated ] || return 0 + due=$(fm_pending_reply_get "$rec" escalation_wake_due_epoch) + escalated=$(fm_pending_reply_get "$rec" escalated_epoch) + case "$due" in ''|*[!0-9]*) return 0 ;; esac + case "$escalated" in ''|*[!0-9]*) return 0 ;; esac + now=$(fm_pending_reply_now) + [ "$now" -ge "$due" ] || return 0 + parent_status=$(fm_pending_reply_get "$rec" parent_status) + [ -n "$parent_status" ] || return 1 + # One fresh read first: a reply that landed during the hold ends it quietly. + if _fm_pending_reply_try_resolve_locked "$state" "$corr" "$parent_status"; then + return 0 + fi + [ "$(fm_pending_reply_get "$rec" phase)" = escalated ] || return 1 + # Only a decision still open as this library left it is reminded; one the + # supervisor already closed (fm-send --resolve-key) or that has left the + # status file needs no further turn. + escalation=$(fm_pending_reply_escalation_line "$parent_status" "$rec" "$corr") + if [ -n "$escalation" ] && _fm_pending_reply_escalation_open "$parent_status" "$escalation"; then + note=$(status_line_note "$escalation") + suffix=" - still unresolved after $(((due - escalated) / 60))m" + case "$note" in + *"$suffix") ;; + *) + printf '%s\n' "$(status_stamp_line "blocked [key=$(fm_pending_reply_escalation_key "$corr")]: $note$suffix")" \ + >> "$parent_status" 2>/dev/null || return 1 + ;; + esac + fi + fm_pending_reply_set "$rec" escalation_wake_due_epoch "" +} + # Detect a correlated report written under the secondmate home (wrong home) # without treating it as acknowledgement. A remote route's # parent-replies.status is its parent channel, not a stranded self-home file. @@ -1664,6 +1776,7 @@ fm_pending_reply_tick() { # if fm_pending_reply_try_resolve "$state" "$corr"; then continue fi + fm_pending_reply_wake_held_escalation "$state" "$corr" 2>/dev/null || true if [ -f "$meta" ]; then sm_home=$(fm_meta_get "$meta" home) if [ -n "$sm_home" ]; then diff --git a/docs/architecture.md b/docs/architecture.md index eafab774866..8f86ae14c6f 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -116,6 +116,7 @@ A third bounded section, RECORD DIVERGENCE, prints on the same drains for the op A failed read, output, or concurrent-replacement check prevents the snapshot cursor from advancing across uncertain bytes, and teardown retires a task's manifest row before that task ID can be reused. The explicit resolution is written by the actor that answers, not the busy worker: `fm-send`'s `--resolve-key` appends the closing `resolved` line to this home's own copy of the ledger at answer time, which covers crewmates, local secondmates, and remote secondmates identically because a remote mate's escalations reach that local copy through the parent-replies ingest and only the answer message itself crosses the transport. This home's answerer close, pending-reply escalation close, and captain-held transfer use the provenance-guarded append owned by `bin/fm-wake-lib.sh`, which records the exact byte range it appended so a later wake scan can tell this home's own growth from a foreign write instead of waking on it. + A quiet pending-reply escalation open uses the same guarded append. The watcher marker advances past those bytes only when every earlier byte was already classified by the watcher or listed as an open decision by the OPEN DECISIONS fold; any other earlier line, including a worker line the fold read but never listed, and any interleaved foreign write, fails toward an ordinary wake. A turn-ended-only queue row omits its historical status annotation when that status file exactly matches the same seen marker. Any direct or remaining historical annotation prints every status line unread at the presentation cursor instead of replaying only the latest line. diff --git a/docs/configuration.md b/docs/configuration.md index 082683908c4..3becf00c685 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -2506,6 +2506,7 @@ FM_SEND_SLEEP=0.4 # seconds between fm-send typed-plane submit checks FM_SEND_SETTLE=1 # seconds fm-send waits after a successful typed-plane submit; 0 disables FM_PENDING_REPLY_GRACE_SECS=120 # seconds after the request turn completes without a correlated parent report before its one recovery repost is eligible, and after the recovery turn completes before the missed-report escalation is eligible; never counted from delivery FM_PENDING_REPLY_ACK_SECS=1800 # seconds a request acknowledged only by a correlated working: or paused: line may go without a new correlated line before its pending-reply-unreported escalation (bin/fm-pending-reply-lib.sh) +FM_PENDING_REPLY_WAKE_HOLD_SECS=3600 # seconds a missed or unreported pending-reply escalation stays a quiet open decision (listed in the next drain, no wake) before it wakes once; 0 wakes at once (bin/fm-pending-reply-lib.sh) # sub-supervisor (bin/fm-supervise-daemon.sh); presence-gated via /afk FM_SUPERVISOR_BACKEND= # optional supervisor pane backend override; tmux/herdr only, otherwise detects $TMUX_PANE then HERDR_ENV/HERDR_PANE_ID before tmux fallback FM_SUPERVISOR_TARGET= # optional supervisor pane target override; tmux target or herdr :, otherwise auto-detected diff --git a/tests/fm-pending-reply.test.sh b/tests/fm-pending-reply.test.sh index 419211d0956..51f9088ed82 100755 --- a/tests/fm-pending-reply.test.sh +++ b/tests/fm-pending-reply.test.sh @@ -47,6 +47,8 @@ TMP_ROOT=$(fm_test_tmproot fm-pending-reply) export FM_PENDING_REPLY_GRACE_SECS=0 export FM_SEND_SETTLE=0 +# Escalations wake at once here; the quiet hold has its own tests below. +export FM_PENDING_REPLY_WAKE_HOLD_SECS=0 # --- fixtures --------------------------------------------------------------- @@ -2007,6 +2009,158 @@ test_escalated_undelivered_correlation_stays_retryable() { pass "an escalated correlation stays retryable only while undelivered" } +# Walks one request: web-perf is steered, acknowledges with working:, then goes +# quiet. The unreported escalation lists as an open decision but does not wake; +# the reply lands inside the hold, so the supervisor never spends a turn on it. +test_quiet_escalation_does_not_wake_and_resolves_without_a_wake() { + local home state corr status open + home=$(setup_parent quiet-escalation) + state="$home/state" + status="$state/hibit.status" + export FM_PENDING_REPLY_NOW=50000 + export FM_PENDING_REPLY_WAKE_HOLD_SECS=3600 + corr=$(fm_pending_reply_create "$home" "$state" hibit "check the PR 367 canvas") + fm_pending_reply_mark_delivered "$state" "$corr" + printf 'working [corr=%s]: on it\n' "$corr" > "$status" + fm_pending_reply_try_resolve "$state" "$corr" && fail "working: must not resolve" + prime_seen "$state" "$status" || fail "could not prime the announced baseline" + FM_PENDING_REPLY_NOW=$((50000 + 1800)) + fm_pending_reply_maybe_escalate "$state" "$corr" || fail "unreported escalation should fire" + [ "$(phase_of "$state" "$corr")" = escalated ] || fail "phase should be escalated" + open=$(status_open_decisions "$status" | cut -f1) + [ "$open" = "pending-reply-$corr" ] || fail "quiet escalation must still list as an open decision" + seen_gate "$state" "$status" || fail "a quiet escalation woke the watcher's signal gate" + # The hold has not run out: a tick adds nothing. + FM_PENDING_REPLY_NOW=$((50000 + 1800 + 600)) + fm_pending_reply_wake_held_escalation "$state" "$corr" || fail "early wake check failed" + [ "$(grep -Fc "blocked [key=pending-reply-$corr]" "$status")" = 1 ] \ + || fail "no reminder is due before the hold ends" + # The mate answers inside the hold: resolve and close, still no wake. + printf 'done [corr=%s]: canvas fixed\n' "$corr" >> "$status" + prime_seen "$state" "$status" || fail "could not mark the reply announced" + fm_pending_reply_try_resolve "$state" "$corr" || fail "correlated reply should resolve" + [ -z "$(status_open_decisions "$status")" ] || fail "resolve must close the quiet escalation" + seen_gate "$state" "$status" || fail "closing a quiet escalation woke the watcher's signal gate" + unset FM_PENDING_REPLY_NOW + export FM_PENDING_REPLY_WAKE_HOLD_SECS=0 + pass "a quiet escalation lists but does not wake, and a reply inside the hold resolves it silently" +} + +test_quiet_escalation_wakes_once_after_the_hold() { + local home state corr status reminders + home=$(setup_parent quiet-escalation-hold) + state="$home/state" + status="$state/hibit.status" + export FM_PENDING_REPLY_NOW=60000 + export FM_PENDING_REPLY_WAKE_HOLD_SECS=3600 + corr=$(fm_pending_reply_create "$home" "$state" hibit "confirm the notarization") + fm_pending_reply_mark_delivered "$state" "$corr" + printf 'working [corr=%s]: relayed\n' "$corr" > "$status" + fm_pending_reply_try_resolve "$state" "$corr" || true + prime_seen "$state" "$status" || fail "could not prime the announced baseline" + FM_PENDING_REPLY_NOW=$((60000 + 1800)) + fm_pending_reply_maybe_escalate "$state" "$corr" || fail "unreported escalation should fire" + # Past the hold with no reply, the tick wakes once, not on every poll. + FM_PENDING_REPLY_NOW=$((60000 + 1800 + 3600)) + fm_pending_reply_tick "$state" + if seen_gate "$state" "$status"; then + fail "an escalation still unresolved after the hold must wake the watcher" + fi + reminders=$(grep -Fc "still unresolved after 60m" "$status") + [ "$reminders" = 1 ] || fail "expected one reminder, got $reminders" + prime_seen "$state" "$status" || fail "could not mark the reminder announced" + fm_pending_reply_tick "$state" + fm_pending_reply_tick "$state" + [ "$(grep -Fc "still unresolved after 60m" "$status")" = 1 ] \ + || fail "later ticks must not repeat the reminder" + seen_gate "$state" "$status" || fail "a repeated tick woke the watcher again" + [ "$(status_open_decisions "$status" | cut -f1)" = "pending-reply-$corr" ] \ + || fail "the reminder must keep one open decision under the same key" + # A reply after the reminder still closes it. + printf 'done [corr=%s]: notarization confirmed\n' "$corr" >> "$status" + fm_pending_reply_try_resolve "$state" "$corr" || fail "correlated reply should resolve" + [ -z "$(status_open_decisions "$status")" ] || fail "resolve must close the reminded escalation" + unset FM_PENDING_REPLY_NOW + export FM_PENDING_REPLY_WAKE_HOLD_SECS=0 + pass "a quiet escalation wakes once after the hold and still closes on a reply" +} + +# Main closes the quiet escalation itself (fm-send --resolve-key) before the +# hold runs out; the reminder must not reopen it or wake anyone. +test_quiet_escalation_closed_by_main_is_not_reminded() { + local home state corr status key + home=$(setup_parent quiet-escalation-main-closed) + state="$home/state" + status="$state/hibit.status" + export FM_PENDING_REPLY_NOW=80000 + export FM_PENDING_REPLY_WAKE_HOLD_SECS=3600 + corr=$(fm_pending_reply_create "$home" "$state" hibit "check the PR 367 canvas") + fm_pending_reply_mark_delivered "$state" "$corr" + printf 'working [corr=%s]: on it\n' "$corr" > "$status" + fm_pending_reply_try_resolve "$state" "$corr" || true + FM_PENDING_REPLY_NOW=$((80000 + 1800)) + fm_pending_reply_maybe_escalate "$state" "$corr" || fail "unreported escalation should fire" + key="pending-reply-$corr" + printf 'resolved [key=%s]: %s\n' "$key" \ + "$(fm_pending_reply_close_note_for_key "$key" hibit operator-resolve-key "handled")" >> "$status" + [ -z "$(status_open_decisions "$status")" ] || fail "main's close should leave nothing open" + prime_seen "$state" "$status" || fail "could not prime the announced baseline" + FM_PENDING_REPLY_NOW=$((80000 + 1800 + 3600)) + fm_pending_reply_tick "$state" + ! grep -Fq "still unresolved" "$status" || fail "a decision main closed must not be reminded" + [ -z "$(status_open_decisions "$status")" ] || fail "the reminder reopened a decision main closed" + seen_gate "$state" "$status" || fail "a closed escalation woke the watcher" + [ -z "$(fm_pending_reply_get "$(fm_pending_reply_path "$state" "$corr")" escalation_wake_due_epoch)" ] \ + || fail "the due reminder should be cleared" + unset FM_PENDING_REPLY_NOW + export FM_PENDING_REPLY_WAKE_HOLD_SECS=0 + pass "a quiet escalation main already closed is not reminded" +} + +# The reminder names the hold that set its due time, not the hold in force now. +test_quiet_escalation_reminder_names_the_recorded_hold() { + local home state corr status + home=$(setup_parent quiet-escalation-recorded-hold) + state="$home/state" + status="$state/hibit.status" + export FM_PENDING_REPLY_NOW=90000 + export FM_PENDING_REPLY_WAKE_HOLD_SECS=1800 + corr=$(fm_pending_reply_create "$home" "$state" hibit "confirm the notarization") + fm_pending_reply_mark_delivered "$state" "$corr" + printf 'working [corr=%s]: relayed\n' "$corr" > "$status" + fm_pending_reply_try_resolve "$state" "$corr" || true + FM_PENDING_REPLY_NOW=$((90000 + 1800)) + fm_pending_reply_maybe_escalate "$state" "$corr" || fail "unreported escalation should fire" + export FM_PENDING_REPLY_WAKE_HOLD_SECS=0 + FM_PENDING_REPLY_NOW=$((90000 + 1800 + 1800)) + fm_pending_reply_tick "$state" + [ "$(grep -Fc "still unresolved after 30m" "$status")" = 1 ] \ + || fail "the reminder should name the 30m hold it was armed with" + unset FM_PENDING_REPLY_NOW + pass "the reminder names the hold recorded at escalation" +} + +test_delivery_unknown_escalation_wakes_at_once_despite_the_hold() { + local home state corr status + home=$(setup_parent delivery-unknown-wakes) + state="$home/state" + status="$state/hibit.status" + export FM_PENDING_REPLY_NOW=70000 + export FM_PENDING_REPLY_WAKE_HOLD_SECS=3600 + corr=$(fm_pending_reply_create "$home" "$state" hibit "lost transport") + fm_pending_reply_prepare_delivery "$state" "$corr" || fail "prepare delivery failed" + fm_pending_reply_mark_delivery_unknown "$state" "$corr" || fail "mark delivery unknown failed" + : > "$status" + prime_seen "$state" "$status" || fail "could not prime the announced baseline" + fm_pending_reply_maybe_escalate "$state" "$corr" || fail "delivery-unknown escalation should fire" + if seen_gate "$state" "$status"; then + fail "a delivery-unknown escalation is a transport fault and must wake at once" + fi + unset FM_PENDING_REPLY_NOW + export FM_PENDING_REPLY_WAKE_HOLD_SECS=0 + pass "delivery-unknown escalations still wake at once" +} + # --- run -------------------------------------------------------------------- test_normal_correlated_reply_resolves_once @@ -2056,5 +2210,10 @@ test_escalated_undelivered_correlation_stays_retryable test_ack_line_keeps_the_reply_open test_ack_escalates_on_age_not_on_an_idle_mate_pane test_resolved_records_keep_upgrade_behaviour +test_quiet_escalation_does_not_wake_and_resolves_without_a_wake +test_quiet_escalation_wakes_once_after_the_hold +test_delivery_unknown_escalation_wakes_at_once_despite_the_hold +test_quiet_escalation_closed_by_main_is_not_reminded +test_quiet_escalation_reminder_names_the_recorded_hold printf 'ok - all pending-reply tests passed\n'