fix(sfm): an audit finish that fails on a hang-up path still releases the line

The final fix wave's AuditIncomplete landed in _exchange's `except DeviceError`,
which keeps the line -- so on the nine ring / link-fault paths (and a refusal) a
failed audit write turned a hang-up into a held Series-4 line, blocking a THOR
call-home for up to the 5-minute idle hang-up and making "SFM hung up" false.
AuditIncomplete now carries release_line, set by every finish whose path hangs
up anyway, and _exchange honours it.  Also pins the Series-3 change path's
retry=False again (the rewritten lost-ack test no longer could).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-10-23 19:36:00 -04:00
1 parent 8f68b09f5e
commit cdc6360ec0
4 files changed
+102 -12

No files matched your search

+12 -3
View File
@@ -23,8 +23,8 @@ from micromate.writes import plan_start_monitoring, plan_stop_monitoring
from minimateplus.transport import BaseTransport, SerialTransport, TcpTransport
from .errors import (
CallHomeInProgress, ChangeUnconfirmed, DeviceError, EventNotFound, MalformedReply, StaleEvent,
WrongUnit, translate,
AuditIncomplete, CallHomeInProgress, ChangeUnconfirmed, DeviceError, EventNotFound,
MalformedReply, StaleEvent, WrongUnit, translate,
)
from .change import CALL_HOME_MESSAGE, run_change
from .events import iso_of, make_event_id, stamp_of
@@ -133,7 +133,8 @@ class Series4Session:
The exceptions: `CallHomeInProgress` and `WrongUnit` release the line,
because the line itself is the problem; so does `ChangeUnconfirmed`, which
the change core raises only after a link fault or a ring, once the frame
has gone out. `AuditIncomplete` is an ordinary verdict: the line is kept.
has gone out. `AuditIncomplete` keeps the line unless its `release_line`
says the path would have hung up anyway (a ring, a link fault, a refusal).
"""
def __init__(self, address: UnitAddress, serial: str,
@@ -192,6 +193,14 @@ class Series4Session:
log.warning("%s at %s -- released the line: %s", type(exc).__name__,
self.address.key, exc)
raise
except AuditIncomplete as exc:
# A finish that failed on a path that hangs up anyway (ring, link
# fault, refusal) must still hang up; on a healthy path, keep the line.
if exc.release_line:
self.hang_up()
log.warning("AuditIncomplete at %s -- released the line: %s",
self.address.key, exc)
raise
except DeviceError:
# The operation's own verdict (event not found, stale id): the line
# is healthy, so keep it. Library errors still hang up below.