fix(P-074c): gateway_state.json updated_at ist ISO-String, nicht Unix-Float

P-074a Pfad-Fix hat gateway_state.json erstmals korrekt gefunden — dadurch
lief der bislang tote Stale-Check (Zeile 622) erstmals. updated_at im realen
Core-Schema ist ISO-String ('2026-08-15T08:09:34.985914+00:00'), nicht
Unix-Float. TypeError: unsupported operand type(s) for -: 'float' and 'str'.

Fix: ISO-String vor Subtraktion via datetime.fromisoformat().timestamp()
parsen, graceful fallback auf 0 bei Parse-Fehler.
This commit is contained in:
Bernd (Hermes)
2026-08-15 10:10:35 +02:00
parent 0700f4024e
commit 8af0c0360f
+11
View File
@@ -619,6 +619,17 @@ async def check_for_predecessor_crash() -> Optional[str]:
gateway_state_stale = False
if gateway_state and heartbeat:
updated_at = gateway_state.get("updated_at", 0)
# P-074c: updated_at ist im realen Core-Schema ein ISO-String
# (z.B. "2026-08-15T08:09:34.985914+00:00"), kein Unix-Float.
# Vor dem Pfad-Fix war gateway_state immer None (Pfad-Mismatch),
# daher lief dieser Code nie — der Typ-Bug war latent.
if isinstance(updated_at, str):
try:
updated_at = datetime.fromisoformat(
updated_at.replace("Z", "+00:00")
).timestamp()
except (ValueError, TypeError):
updated_at = 0
if updated_at and (heartbeat_ts - updated_at) > GATEWAY_STATE_STALE_S:
gateway_state_stale = True
logger.info(