fix(client-runtime): an offline connection still tries when the offline report is stale #39223
Opencybersader(GitHub profile, opens in a new tab)wants to merge 5 commits into
main fromrefs/pull/39223/headopened View on GitHubtanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
- @@ -1216,4 +1220,4 @@12161220 }12171221 // The platform's offline report can stay wrong after the network is back,12181222 // so an explicit retry still tries instead of waiting for it to change.1219- const ignoreOffline = replacing || retryRequested;1223+ const ignoreOffline = replacing || retryRequested || offlineRecheckDue;
juliusmarminge added labelstakeover:in-progress
Pushed90b80bf
Pushedeff788c
- @@ -1215,12 +1217,14 @@12151217 continue;12161218 }12171219 // The platform's offline report can stay wrong after the network is back,1218- // so an explicit retry still tries instead of waiting for it to change.1219- const ignoreOffline = replacing || retryRequested;1220+ // so an explicit retry, or every OFFLINE_RECHECK_MS, still tries once.1221+ const ignoreOffline =1222+ replacing || retryRequested || (offlineRecheckDue && currentIntent.network === "offline");12201223 if (currentIntent.network === "offline" && !ignoreOffline) {12211224 yield* clearLease;12221225 yield* setState(offlineState(currentIntent, generation, failureCount + 1, latestFailure));1223- const applicationActivated = yield* waitForSignal;1226+ const applicationActivated = yield* waitForRetrySignal(OFFLINE_RECHECK_MS);12241227 if (applicationActivated) {12251228 resetRetryLadder();12261229 }1230+ offlineRecheckDue = true;
Pushedc47976e
juliusmarminge added labelstakeover:needs-julius
juliusmarminge removed labelstakeover:in-progress
- @@ -1252,3 +1258,6 @@12521258 }12531259 continue;12541260 }1261+ // A failed recheck while still reported offline is not a connection failure.1262+ if (recheck && !outcome.established && (yield* Ref.get(intent)).network === "offline") {1263+ continue;
Sign in to join this conversation.
Walkthrough
When the network remains reported offline,
EnvironmentSupervisorwaits 30 seconds before allowing a connection attempt. If the attempt fails before establishing a connection and the network still reports offline, the supervisor returns to the offline loop. A test verifies success after a transient failure.Changes: Offline connection recheck
packages/client-runtime/src/connection/supervisor.ts,packages/client-runtime/src/connection/supervisor.test.tsEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
Possibly related PRs
Suggested reviewers:
only21mil,juliusmarminge,macroscopeappMerge Risk:
Moderate · up to
c4797Remote connections now retry every 30 seconds while the device reports offline. If such a retry fails with an authentication or blocked error, the app stays in the offline state and never shows that error. Repeated connect or network-change signals can also trigger a recheck before the 30-second interval has passed. Fix the blocked-error handling before merging.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the main change: an offline connection now retries when the offline report is stale. It matches the raw summary, which describes a periodic offline recheck in EnvironmentSupervisor after a 30-second wait, and the PR objectives, which describe the same behavior. The title uses the conventional commit form with the client-runtime scope, and it is specific enough for a teammate scanning history.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the stale Android offline report and the resulting stuck state. The Change section names EnvironmentSupervisor, OFFLINE_RECHECK_MS, and the ignoreOffline path. The Scope section calls this a bug fix and explains why no issue is linked. The Verification section names a focused test with observed results, the test command and its outcome, and states what was not checked on a device. It also ends with the model and harness used. One gap: the Scope section does not link the issue that shows the bug, and it says no issue is needed. It refers to
#24932instead of a bug issue. That is acceptable under the template, which allows an explanation for small fixes.Finishing Touches
Generate unit tests (beta)