Commit Graph
9 Commits
Author SHA1 Message Date
serversdownandClaude Opus 5.5 ca5c401c6f fix(device_access): a start's read-back waits out the sensor check, then wakes the MiniMate with retries
Second start through SFM, BE9441 2026-10-26 23:54:41: acked 0x69, and Brian saw
'starting, performing sensor check, recording' -- but the read-back's single
SESSION_RESET + POLL went out 2.3 s after the ack, inside the ~30 s sensor
check, and was never answered or re-sent (504 after 120 s, audit ca7b5b42).
Brian: every unit is set to sensor-check before monitoring, ~30 s, then
'Recording...'.

- MiniMateProtocol.wake(attempt_s, deadline_s): SESSION_RESET + POLL re-sent
  every attempt_s until the unit answers, then the POLL data step; a named
  timeout at the deadline.  Reads only.  MiniMateClient.wake() wraps it.
- The Series-3 change: after a START, the first read waits S3_SENSOR_CHECK_S
  (30 s) before asking; every read then wakes with retries (every 5 s, up to
  60 s).  A stop is unchanged -- its read-back was confirmed three times tonight.

Tests: a unit deaf for 4 probes is asked a 5th time and answers; a unit that
never answers ends in the named timeout after ~6 probes; a start's first read
waits the sensor check, a stop's does not; every read is preceded by a wake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-27 00:02:10 -04:00
serversdownandClaude Opus 5.5 9886422212 fix(device_access): wake a MiniMate before every state read in a start/stop, so a start's read-back is answered
BE9441, 2026-10-26 23:41:48 (through the bridge): SFM's start (0x96, Blastware's
own bytes) was acked 0x69 and the unit began monitoring -- Brian saw it -- but
the read-back sent one bare 0x1C two seconds later and got nothing for 120 s,
so the change reported 'sent and acknowledged, but reading the state back
failed' (504, audit 0c1cf813).  Nothing was retried.

A monitoring MiniMate ignores a bare request until SESSION_RESET + POLL
(measured 2026-04-08).  The read-back had relied on the connect's wake; a stop's
read-back (18:53, the unit idle by then) never needed it.  Every state read in
the change now goes through _woken_state: client.poll() (41 03, POLL, 41 03,
POLL -- the connect's own sequence), then 0x1C.

Test: after the send, every 0x1C read is preceded by a POLL.  No codec, store or
DB change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-26 23:51:15 -04:00
serversdownandClaude Opus 5.5 d990466407 fix(minimateplus): the 0x1C status reads a histogram run as monitoring, and unescapes before counting from the end
Measured on BE9441 tonight, through the recording bridge:

- Monitoring flag 0x0B while recording a histogram (confirmed at the unit), 0x00
  idle.  Only 0x10 had been measured as monitoring (BE11529, 2026-04-08), so the
  status showed 'not monitoring' and the change path refused the state as
  unknown(0x0B) -- refused, not skipped, which is the design working.  0x0B joins
  S3_RUN_STATES and S3_MONITORING_FLAGS as measured.  The shared status's
  'monitoring' now follows the change path's reading: None for an unmeasured
  flag, never a guessed False.
- Free memory 0x000D0E04 arrived as 0d 0e 10 04.  The parser keeps the 10 of a
  10 02/03/04 escape, so every field counted from the end read one byte off:
  419.84 V and 251,655,168 bytes for 6.76 V and 983,028.  New
  framing.unescape_reply() (also used by parse_strt_end_key) runs first.

Tests: the two recorded replies (idle 16:24, monitoring 18:47) decode to the
unit's own values; each escaped value in the last ten bytes decodes; the status
mapping for 00 / 10 / 0B / unmeasured.  No codec, store or DB change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-26 18:53:11 -04:00
serversdownandClaude Opus 5.5 cdc6360ec0 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
2026-10-23 19:36:00 -04:00
serversdownandClaude Opus 5.5 8f68b09f5e fix(sfm): a change that fails after the send says so; the audit row records sent + states; S3 unknown states refused
Final fix wave for phase 3 (start/stop monitoring), per the whole-phase review.

- I1 + M2: every failure after the send has started is a ChangeUnconfirmed
  (audit_id, sent = "acknowledged" | "unknown", the cause's HTTP status) whose
  message says the frame was sent and names the audit record -- the ring in
  place of the ack, the four lost-ack follow-ups, and the three read-back
  paths.  Series4Session releases the line on it.  Every audit finish goes
  through one helper; a finish that fails is AuditIncomplete (500) and still
  says what happened to the unit.  The line is kept.
- I2: device_commands gains `sent` (1 acknowledged, 0 nothing sent, NULL
  unknown) and `states` (before / seen / after), with an idempotent ADD COLUMN
  in _migrate for a table created earlier on this branch.
- M1: a RADIO RING already buffered is caught before 0x96/0x97 goes out
  (pre_send = read_unsolicited, one 10 ms transport read).  That is a
  CallHomeInProgress with sent=0, not ChangeUnconfirmed.
- M3: Series 3 reads the raw 0x1C flag (new MonitorStatus.state_flag); a byte
  other than 0x00/0x10, or a short section, is unknown(...) and refused.
- M8: even_if_already on a unit already in the state notes that the read-back
  proves nothing.
- M10: a scan pins `.protocol.execute(` to sfm/device_access/s4.py; both
  scans fail closed on a file that does not parse.
- M11: docs corrected (CLAUDE.md phase-2 sentence, phase-3 bullet, REST list;
  micromate/protocol.py scope and the 0x49 read_state docstring; s4.py; route
  docstrings).  "No command has ever been originated" is NOT retracted.
- M12: GET /db/device_commands normalises the serial.
- Minors: unused imports, S3 dry-run frames and 120 s timeout pinned, test
  rename, serial-cache and short-0x49 tests, _RUN_STATES comment.

Schema: two NULLable columns on the branch-new device_commands table, added
by _migrate on open; no backfill.  No codec change, TOOL_VERSION unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-23 19:16:45 -04:00
serversdownandClaude Opus 5.5 ce5d2cb0d6 feat(sfm): start/stop monitoring for Series 3 through the same safety layer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-23 16:48:05 -04:00
serversdownandClaude Opus 5.5 78c3d568d5 test(sfm): pin the ring-on-follow-up and calling-home poll exits; narrow the refusal clause
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-23 16:45:02 -04:00
serversdownandClaude Opus 5.5 14ea80f5a4 fix(sfm): a ring or a refusal is never mistaken for a send; fresh serial pinned; unmeasured states refused
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-23 16:39:55 -04:00
serversdownandClaude Opus 5.5 eada7ba767 feat(sfm): start/stop monitoring for Series 4 -- identity, state, dry run, audit, read-back, never retried
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-23 16:29:03 -04:00