From aa79e996c5831eedf4ad4a24ee83389e82cdbfca Mon Sep 17 00:00:00 2001 From: serversdown Date: Wed, 21 Oct 2026 01:45:17 -0400 Subject: [PATCH] fix(sfm): construct the DeviceAccess singleton at import Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44 --- sfm/server.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sfm/server.py b/sfm/server.py index 8c10b27..305d4a5 100644 --- a/sfm/server.py +++ b/sfm/server.py @@ -357,13 +357,11 @@ def _run_with_retry(fn, *, is_tcp: bool): # same contract for Series 3 and 4. Without `serial`, handlers run their # legacy Series-3 path unchanged (spec 2026-10-20). -_device_access_instance: Optional[DeviceAccess] = None +# Constructing it does no I/O and starts no thread until a Series-4 session exists. +_device_access_instance: DeviceAccess = DeviceAccess() def _device_access() -> DeviceAccess: - global _device_access_instance - if _device_access_instance is None: - _device_access_instance = DeviceAccess() return _device_access_instance