Repository navigation
fix(tandem): harden Mobi connection recovery and prevent workflow lockouts - #220
Open
haarisedhi102 wants to merge 8 commits into
Open
haarisedhi102 wants to merge 8 commits into
haarisedhi102 wants to merge 8 commits into
Conversation
haarisedhi102
marked this pull request as ready for review
September 11, 2026 14:33
Author
Owner
|
I am doing latest integration from dev just now (metro stuff that that was introduced). Could you please check your PR afterwards, I would like to see if we can integrate some (or all) of your changes in, since it seems you have done your homework... If possible can you please contact me on discord so that we can talk this changes through? I hope to do push of changes to branch on sunday or whenever the most obvious problems are fixed.. jwoglom has added some connection fixed in library, problem is that new version it is not yet available with those connection changes... |
Author
|
updated to include your changes, would love your feedback on this |
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.
Tandem Mobi connection hardening, plus the latch/pairing fixes found while testing it.
The matching driver-layer work is jwoglom/pumpX2#153, released in pumpX2 v1.9.3
(this PR pins it).
Scope vs andy_tandem_dev4 (v0.9.7.1)
15 files, +462/−36.
pump/commonis untouched.Connection lifecycle (
TandemPumpCommunicationManager)plannedDisconnect: veto pumpX2 auto-reconnect during a host-initiated teardown,and do not start
TandemConnectionFixerfor it. RF drops still auto-reconnect.CONNECT_TOTAL_TIMEOUT(180 s) hard cap: if the link drops before servicediscovery,
handshakingStartTimestays 0 and neither existing timeout can fire;the connect loop held
inConnectModeforever and swallowed later attempts.pumpConnectedFlowon every handshake (including pumpX2's internalreconnect, which bypasses
connect()), publish disconnected on unplanned drops.preventReconnecton a successful handshake.tryToReconnectToPump()sets it via
forceResetBluetoothHandler(); without this the link recovered butisBusy()/isInPreventConnectMode()stayed true (queue logged "busy" forever).communicationListenersetter: assignfield = valueunconditionally; previouslypassing null left a stale listener attached.
Status/error truth (
TandemPumpConnector,TandemPumpConnectionManager,TandemService,TandemPumpUtil)pumpConnectedFlow(link up, flow false) on connect and on asuccessful status read.
driverStatuslatched at
ErrorCommunicatingWithPump.clearErrorDetails()is a Mobi-only helper: corePumpUtil.clearError()NPEswhen an error is latched (its
errorTypesetter doespumpErrorType!!).pump/commonis out of scope here; the only consumer oferrorTypeisisConnecting(), which ignores a latchedPumpUnreachable.disconnectFromPump()is no longer gated onisConnected(): during a connectattempt the driver is
Connecting, so a force-disconnect was a no-op and left thein-flight connect holding the pumpX2 handler.
Pairing / overview (new since the original branch)
stopBluetoothHandler()does nothing when the pairing manager owns no handler;it used to re-set
preventReconnectafter the wizard'sonFinishcleared it.setPairButtonStatus()is called on init, andmanagementActionsis included in the
pumpRunningState == Unknownoverview state, so the button isreachable exactly when the pump is not connected.
UI workflow latch (
TandemPumpStatus,TandemMobiPumpPlugin,MobiComposeContent)preventQueueExecution(isQueueExecutionPrevented()),so a missed release cannot lock the Loop out (previously ~5.4 h with no SMBs).
not only via the toolbar back arrow.
History download (
HistoryRetriever,TandemUICommunication)the download and the CommandExecutor for the full timeout.
dropping) history responses when the retriever is not initialised.
Diagnostics
preventReconnect,preventQueueExecution,isBusy,isInPreventConnectMode; connect/disconnect lifecycle; pairing start/finish;error-clear payloads. Happy to trim any of this if you prefer.
Not in this PR
separate follow-up PR.
concurrency/PumpAvailabilitySynccode from my original branch: removedby dev_4 already, so it is not part of this diff.
pumpConnectedFlowis keptcurrent as the backend connection signal.
TandemConnectionFixer: still disabled, untouched.Testing
:app:compileFullDebugKotlinand:pump:tandem:compileDebugKotlinpass.e6179c1-2026.10.26): pairing, re-pair, RF drop andreturn without an app restart, the connected-but-busy latch case, and history
download progress.
Known limitation (deliberately not fixed here)
TandemMobiPumpPlugin.connect()is not implemented, so the queue's
pump.connect()is a no-op, andTandemConnectionFixeris disabled. Recovery needs a restart or a re-pair.