esim: harden AtClient with retry loops and reconnect#37771
Merged
adeebshihadeh merged 11 commits intocommaai:masterfrom Apr 7, 2026
Merged
esim: harden AtClient with retry loops and reconnect#37771adeebshihadeh merged 11 commits intocommaai:masterfrom
adeebshihadeh merged 11 commits intocommaai:masterfrom
Conversation
- AtClient: lazy serial open (deferred to first query), store device/baud for reconnect, add _reconnect_serial for recovery from serial exceptions - open_isdr: extract _open_isdr_once, wrap in 10-attempt retry loop with lte.sh modem reset at attempt 3 for stuck SIM (CME ERROR 13) - send_apdu: add retry loop with max_retries=3, auto-reopen channel on failure with backoff sleep - query: catch SerialException and reconnect before retry - close: wrap CCHC in try/except to handle already-closed channels - Update DEFAULT_DEVICE to /dev/modem_at0, enable DEBUG by default - base.py: add process_notifications() default, is_comma_profile uses provider field instead of ICCID prefix - esim.py: remove post-mutation modem reboot (now handled by LPA internally) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Replace debug print in open_isdr retry with cloudlog.warning - Remove debug param from AtClient, use module-level DEBUG for AT output - AT wire-level prints (SER >>/<<, DBUS >>/<<) stay as print() gated by DEBUG Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
Process replay diff reportReplays driving segments through this PR and compares the behavior to master. ✅ 0 changed, 66 passed, 0 errors |
Channel is opened on demand in send_apdu when needed. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Single method for opening the serial port, used by both query (lazy open) and _reconnect_serial (close + reopen). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Single method with reconnect flag: _ensure_serial() for lazy open, _ensure_serial(reconnect=True) to close and reopen. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
44a6177 to
438e255
Compare
lte.sh already blocks until the modem is online, so no post-reset sleep needed. open_isdr and send_apdu retry loops recover without delays. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
438e255 to
2f39a0d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
split from #37742
Summary
_ensure_serial(reconnect)for recovery, retry inqueryonSerialExceptionopen_isdr: retry loop (10 attempts, 250ms backoff, lte.sh modem reset at attempt 5)send_apdu: retry loop (3 attempts, auto-reopen channel on failure)DEBUGgated by env var instead of hardcodedTrueesim.py: remove redundant modem reboot (handled internally by LPA now)Test plan
Deployed to mici and tizi, ran 30x
list_profilesstress test on both devices.mici (comma mici, 725dfb9b) - 30/30 OK
tizi (comma tizi, bb546e42) - 30/30 OK