Repository navigation
fix(android): reduce repeated retries to unreachable gateways - #138732
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 5, 2026, 11:49 AM ET / 15:49 UTC. ClawSweeper reviewWhat this changesAndroid backs off longer during prolonged Gateway outages and wakes eligible sessions when networks attach, while preserving healthy connections. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: current main still needs this focused repair. No introduced correctness or security defect was found, and the captured native evidence supports the stated workload and recovery improvements. Priority: P2 Review scores
Verification
How this fits togetherAndroid maintains authenticated Gateway connections for chat and device capabilities. Its session lifecycle combines connection failures, network notifications, and manual reconnect requests to control subsequent connection attempts. flowchart TD
A[Connection failure] --> B[Session retry loop]
C[Network attachment] --> D[Session eligibility check]
E[Manual reconnect] --> B
D -->|Disconnected and retryable| B
D -->|Ready or auth paused| F[Preserve current state]
B --> G[Gateway connection attempt]
G -->|Failure| A
G -->|Authenticated| H[Chat and device connection]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +390, Other -32. Total +358 across 8 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep retry timing and recovery wakes in the existing session lifecycle, retaining finite passive recovery and explicit Disconnect/auth-pause ownership. Do we have a high-confidence way to reproduce the issue? Yes: current-main source deterministically caps prolonged failed connections at eight seconds, matching the original device measurements; this reviewer did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: the existing session loop is the appropriate owner, and the captured Gateway-only and blackhole recovery observations support retaining the existing transport without adding a server RPC. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d1df83eb30a9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
55c03e8 to
23a57ab
Compare
Keep transient retries fast, then use a finite 30–60s jittered retry timer. Wake the existing ladder on manual or independent LAN/VPN attachment events, without retiring healthy READY sockets or resuming auth-paused sessions. Include desired secondary sessions in the same recovery path. Related: #127872 Prior investigation: #127873 (closed; no prior proof reused). AI-assisted implementation and validation. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
23a57ab to
1e4a8a7
Compare
|
Final maintainer-verification handoff for head No blocking findings. The PR is ready for maintainer review.
Attribution: This implementation substantially builds on @masatohoshino’s original work in #127873. In addition to the existing Credits section, @masatohoshino should be recognized at co-author level for the underlying reconnect-backoff implementation, investigation, and real-device measurements. The landed commit cannot be amended without rewriting Sanitized metrics and the artifact manifest are linked from the PR body’s Evidence section. ClawSweeper reports no actionable patch finding; its remaining checkbox records its isolated worker’s inability to repeat the already documented dependency/artifact inspection. Known limits remain explicit: Recents dismissal and durable unrelated-route preservation were not established in this emulator. No physical-radio, VPN, battery, Play Integrity, release-signing, or merge claim is made. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* commit '3e4becea5e2ce38ede69e8ecf5302805ecbfc09c': refactor: simplify outbound message execution context (openclaw#139107) fix(models): keep ordinary chat selections session-scoped (openclaw#139232) docs: slim root agent instructions and clarify testing scope (openclaw#139236) test(agents): give the sibling-drain completion wait a tolerance on slow runners (openclaw#139176) refactor(workboard): use canonical queries for card-tree writes (openclaw#139106) fix(canvas): recognize versioned macOS nodes (openclaw#138958) fix: load GitHub connections without a default agent (openclaw#139222) fix(memory): explain unsafe legacy host-event path recovery (openclaw#139195) refactor(talk): centralize typed voice session queries (openclaw#139103) fix(cli): preserve command dispatch and structured errors (openclaw#139067) refactor(agents): consolidate reply failure summaries (openclaw#139175) fix(auth): keep an unset default model unchanged during login (openclaw#139218) perf(media): reuse validated attachment read handles (openclaw#139168) refactor(channels): simplify account configuration updates (openclaw#139096) refactor(android): remove unused updater export root (openclaw#139198) fix(gateway): stop admitting post-ready producers during close (openclaw#139092) fix(gateway): expose agent hook completion outcomes (openclaw#139155) fix(config): return the saved configuration after plugin install commits (openclaw#139203) fix(android): reduce repeated retries to unreachable gateways (openclaw#138732)
…aw#138732) Keep transient retries fast, then use a finite 30–60s jittered retry timer. Wake the existing ladder on manual or independent LAN/VPN attachment events, without retiring healthy READY sockets or resuming auth-paused sessions. Include desired secondary sessions in the same recovery path. Related: openclaw#127872 Prior investigation: openclaw#127873 (closed; no prior proof reused). AI-assisted implementation and validation. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
Remove duplicate visibility/cache/startup state and unreachable platform/encoder fallbacks in old iOS and Android files. Share outside-tap recognition and let the node invoke boundary own mirrored-notification normalization. Keep physical-route authorization, permission checks, durable Watch admission and ACKs, FIFO sends, protocol/data shapes, and ordinary concurrency. Net production reduction: 289 LOC, excluding tests, fixtures, and generated files. Proof: iPhone app/Share/embedded Watch builds, final 273 invoke/Watch ingress/delegate/location tests and 74 sidebar/dashboard tests; Watch scheme build and 11 media tests; Android APK and 89 distinct focused unit cases; 18 shared source-resource tests. Changed-file guards, native lint, runtime/Madge cycles (zero), lint-suppressions (3 tests), and final independent P0-P2 review pass. No hosted CI or hardware/provider-audio/battery proof is claimed. Best-effort tradeoffs accepted: - Observer declarations (#113634): synthetic stale-ACK fencing is replaced by FIFO sends and subscription/reconnect replay; failed or obsolete metadata heals on the next declaration. - Dashboard refresh (#111339): the sole SwiftUI refresh task is sequential and cancellation-owned, so a second generation counter is redundant; a future concurrent direct caller must cancel prior work or accept last-completing cosmetic data until refresh. Roster event/mutation overlap still retains its own generation. - Delayed cosmetic actions (#113062): the synthetic post-delay interleaving no longer needs generations; replacing an action does not revoke work that already started. - Delayed gate lifetime (#113062): both real view owners cancel on disappearance, so a second weak-gate lifetime condition is redundant; a future caller omitting cancellation may still perform a harmless cosmetic completion after releasing its gate. - Watch one-shot transport (#135808): cancelled instances cannot restart, so generations add no supported lifetime; cancellation and physical-resource checks remain. - Command advertisements (#136192): the synthetic synchronous preference flip may briefly split a command family until reconnect; live invocation admission remains. - Turn recaps (#112221/#113084): synthetic metadata-only mode and a duplicated pending terminal value are removed; the sole production caller always provides transcript facts, and same-timestamp metadata corrections now use the latest authoritative session row. History/terminal attribution, settlement bounds and all 21 retained tests remain. - Realtime coordinator (#111033): direct concurrent reset/reuse is unsupported by serialized phone/Wear callers; current-session, duplicate-run, and live-submit guards remain. - Network availability (#138732): an unexpected duplicate SDK AVAILABLE may wake offline retry early; the human battery fix (#127872), retry ladder, and current-session admission remain. - iOS resource adapter (#148906): a captured invalidated loader may redundantly reload current metadata; the shared cache owner still cancels stale in-flight results and live authority remains checked. - Watch startup buffer (5e9bc09): synchronous MainActor registration cannot interleave with queued inbound delivery; a future caller yielding before registration may drop ephemeral requests, never ACK uncommitted chat. - Mirror validation (#23636): the sole caller supplies normalized bounded fields; future internal callers must preserve that precondition. - Beacon payload UTF-8 (#73330): Foundation JSONEncoder guarantees the bytes; a framework contract violation is an internal failure, not a recoverable conversion branch. - Beacon envelope UTF-8 (#73330): the same guarantee removes the second conversion fallback; actual encoding errors still throw. - Watch request UTF-8 (#135808): default encoder output cannot fail UTF-8 conversion; actual encoding errors still throw. - Location event UTF-8 (#18260): default encoder output cannot fail UTF-8 conversion; nonfinite-value encoding failures keep their existing handling. - HealthKit identifiers (#105616): fixed supported identifiers use nonfailable SDK constructors; authorization, privacy scope, and queries remain unchanged. - Pre-iOS26 button fallback (#168595): the existing native deployment floor is26.2, so supported rendering is unchanged. - Pre-Android26 priority fallback (#29398): the app minimum is31; notification-channel importance remains the active owner. - WebView task document fences (#139514): existing MainActor cancellation-at-effect already rejects retired callbacks; navigation and document authority remain. (cherry picked from commit 3dd5a00)
…el and native code (#170815) * fix(signal): reserve canonical default transport during legacy cleanup Keep the canonical root transport in managed-port reservations when a nested default account still carries retired transport fields. Otherwise Doctor can allocate the default port to an implicit sibling and produce a collision. Cover synchronous and asynchronous Doctor migration, nested-field cleanup, and resolving both accounts to distinct ports. No new configuration surface or persisted format; existing update/Doctor ownership stays authoritative. * fix(channels): keep message content out of transport diagnostics Remove raw content from IRC line/NOTICE, WhatsApp mention/skip, LINE inbound and postback, Twitch callback, iMessage echo, and Tlon settings diagnostics. Retain metadata and the complete payload in its delivery/history owner. LINE peer routing also consumes already prepared source facts instead of reinspecting the same source through a one-use helper. Extend existing owning-boundary tests, including real IRC sockets, rather than adding a separate logging implementation. IRC, WhatsApp, and Tlon privacy probes failed on the old path and pass with content preserved. * refactor(channels): simplify old transport helpers and lifecycle state Consolidate Matrix send preparation, Zalo account/error traversal onto existing SDK seams, and Google Meet CLI dispatch. Remove pass-through Promise wrappers, duplicate lifecycle facts, and internal clock defenses. Keep transport validation, effect authority, FIFO and durable shutdown. Best-effort tradeoffs accepted: - Internal cache/follow-up clocks are ordinary Date.now plus constant TTLs; synthetic invalid-clock cases are not actual-use incidents. A corrupt clock may distort metadata expiry until repair/restart. - FaceTime does not fence unsupported start-before-stop reentry; its runtime creates a new supervisor after joined shutdown. Initial feature #119291 introduced the generation, without a human reentry incident. - LINE uses timer cancellation and its stop Promise, not a second stopped flag. Synchronous stop reentry is not performed by production callers. - Mattermost uses one stopped fact, recursive polling and native Promise settlement; synchronous callbacks cannot interleave with cancellation. - Teams uses a fresh UUID without reparsing text to reject a theoretical authored-placeholder collision; no human collision report was identified. - FaceTime expects the documented system_profiler JSON output; malformed output reports missing devices instead of parsing old plaintext fixtures. - Feishu serialization rejects cycles before element counting; exotic getter/toJSON objects remain best effort rather than a second graph walk. - Zalo shares SDK error traversal; provider errors with throwing cause getters remain best effort rather than a private short-circuit walker. - ClickClack uses the timeout race winner directly; exact-deadline late microtasks can discard stale ephemeral details, never the durable reply. - Raft's private FIFO settles replay commits before another claim. If that invariant were violated, an unexpected inflight wake is a duplicate hint rather than a second settlement path. #109117 gives synthetic/generic ownership reasoning, not a human actual-use incident. Old-code lane o07: production files checked against the last-seven-day origin/main inventory. No SDK exports, dependencies, schemas or protocols changed. Standalone session memory remains untouched. * refactor(mobile): simplify old native lifecycle bookkeeping Remove duplicate visibility/cache/startup state and unreachable platform/encoder fallbacks in old iOS and Android files. Share outside-tap recognition and let the node invoke boundary own mirrored-notification normalization. Keep physical-route authorization, permission checks, durable Watch admission and ACKs, FIFO sends, protocol/data shapes, and ordinary concurrency. Net production reduction: 289 LOC, excluding tests, fixtures, and generated files. Proof: iPhone app/Share/embedded Watch builds, final 273 invoke/Watch ingress/delegate/location tests and 74 sidebar/dashboard tests; Watch scheme build and 11 media tests; Android APK and 89 distinct focused unit cases; 18 shared source-resource tests. Changed-file guards, native lint, runtime/Madge cycles (zero), lint-suppressions (3 tests), and final independent P0-P2 review pass. No hosted CI or hardware/provider-audio/battery proof is claimed. Best-effort tradeoffs accepted: - Observer declarations (#113634): synthetic stale-ACK fencing is replaced by FIFO sends and subscription/reconnect replay; failed or obsolete metadata heals on the next declaration. - Dashboard refresh (#111339): the sole SwiftUI refresh task is sequential and cancellation-owned, so a second generation counter is redundant; a future concurrent direct caller must cancel prior work or accept last-completing cosmetic data until refresh. Roster event/mutation overlap still retains its own generation. - Delayed cosmetic actions (#113062): the synthetic post-delay interleaving no longer needs generations; replacing an action does not revoke work that already started. - Delayed gate lifetime (#113062): both real view owners cancel on disappearance, so a second weak-gate lifetime condition is redundant; a future caller omitting cancellation may still perform a harmless cosmetic completion after releasing its gate. - Watch one-shot transport (#135808): cancelled instances cannot restart, so generations add no supported lifetime; cancellation and physical-resource checks remain. - Command advertisements (#136192): the synthetic synchronous preference flip may briefly split a command family until reconnect; live invocation admission remains. - Turn recaps (#112221/#113084): synthetic metadata-only mode and a duplicated pending terminal value are removed; the sole production caller always provides transcript facts, and same-timestamp metadata corrections now use the latest authoritative session row. History/terminal attribution, settlement bounds and all 21 retained tests remain. - Realtime coordinator (#111033): direct concurrent reset/reuse is unsupported by serialized phone/Wear callers; current-session, duplicate-run, and live-submit guards remain. - Network availability (#138732): an unexpected duplicate SDK AVAILABLE may wake offline retry early; the human battery fix (#127872), retry ladder, and current-session admission remain. - iOS resource adapter (#148906): a captured invalidated loader may redundantly reload current metadata; the shared cache owner still cancels stale in-flight results and live authority remains checked. - Watch startup buffer (5e9bc09): synchronous MainActor registration cannot interleave with queued inbound delivery; a future caller yielding before registration may drop ephemeral requests, never ACK uncommitted chat. - Mirror validation (#23636): the sole caller supplies normalized bounded fields; future internal callers must preserve that precondition. - Beacon payload UTF-8 (#73330): Foundation JSONEncoder guarantees the bytes; a framework contract violation is an internal failure, not a recoverable conversion branch. - Beacon envelope UTF-8 (#73330): the same guarantee removes the second conversion fallback; actual encoding errors still throw. - Watch request UTF-8 (#135808): default encoder output cannot fail UTF-8 conversion; actual encoding errors still throw. - Location event UTF-8 (#18260): default encoder output cannot fail UTF-8 conversion; nonfinite-value encoding failures keep their existing handling. - HealthKit identifiers (#105616): fixed supported identifiers use nonfailable SDK constructors; authorization, privacy scope, and queries remain unchanged. - Pre-iOS26 button fallback (#168595): the existing native deployment floor is26.2, so supported rendering is unchanged. - Pre-Android26 priority fallback (#29398): the app minimum is31; notification-channel importance remains the active owner. - WebView task document fences (#139514): existing MainActor cancellation-at-effect already rejects retired callbacks; navigation and document authority remain. (cherry picked from commit 3dd5a00) * refactor(ios): keep delayed cosmetic actions synchronous Both production callers update toast or flash state synchronously on MainActor. Remove the unused async action contract and invoke it directly after the existing sleep/cancellation boundary. Keep asynchronous sleeping, cancellation, replacement and the returned task unchanged. Best-effort tradeoffs accepted: - None added by this type narrowing. The helper is internal, both callers and all retained tests already supply synchronous actions. The hypothetical suspending action discussed with #113062 is not a supported caller and is no longer expressible through this API. Earlier guard-removal provenance and campaign proof are recorded in the preceding mobile cleanup commit. This follow-up changes no production LOC total, public protocol, permission, signing, dependency, persistence or visible rendering. Validation: iPhone app/Share/embedded Watch build and61 focused tests in2 suites pass (DelayedActionGateTests and RootTabsPresentationTests),196.654s xcodebuild/0.628s tests. Configured SwiftFormat and strict SwiftLint pass; independent P0-P2 review is scoped-clean. Earlier unchanged-input changed-file, cycle and lint-suppression gates remain valid. (cherry picked from commit c7c9fb6) * fix(mattermost): keep inbound message content out of diagnostics Log conversation, post ID and length instead of a body preview. Keep the complete agent body and attachment order unchanged, and update the existing monitor boundary test to reject content in diagnostics. The regression fails before the repair on the leaked synthetic body prefix after complete-body/ordered-media assertions pass, then passes after repair. Final owner24, sibling25 and lint-suppressions3 tests pass; runtime and Madge cycles are zero. Fresh production/test types, syntax lint, format and line-cap checks pass, with no baseline, suppression or timeout increase. This minimal privacy fix is explicitly authorized outside the old-code eligibility restriction. The combined channel/native patch received a fresh independent review with no actionable P0-P2 findings. * fix(ios): remove retired Watch error from i18n inventory * fix(mattermost): normalize nullable shutdown cleanup before await
…el and native code (openclaw#170815) * fix(signal): reserve canonical default transport during legacy cleanup Keep the canonical root transport in managed-port reservations when a nested default account still carries retired transport fields. Otherwise Doctor can allocate the default port to an implicit sibling and produce a collision. Cover synchronous and asynchronous Doctor migration, nested-field cleanup, and resolving both accounts to distinct ports. No new configuration surface or persisted format; existing update/Doctor ownership stays authoritative. * fix(channels): keep message content out of transport diagnostics Remove raw content from IRC line/NOTICE, WhatsApp mention/skip, LINE inbound and postback, Twitch callback, iMessage echo, and Tlon settings diagnostics. Retain metadata and the complete payload in its delivery/history owner. LINE peer routing also consumes already prepared source facts instead of reinspecting the same source through a one-use helper. Extend existing owning-boundary tests, including real IRC sockets, rather than adding a separate logging implementation. IRC, WhatsApp, and Tlon privacy probes failed on the old path and pass with content preserved. * refactor(channels): simplify old transport helpers and lifecycle state Consolidate Matrix send preparation, Zalo account/error traversal onto existing SDK seams, and Google Meet CLI dispatch. Remove pass-through Promise wrappers, duplicate lifecycle facts, and internal clock defenses. Keep transport validation, effect authority, FIFO and durable shutdown. Best-effort tradeoffs accepted: - Internal cache/follow-up clocks are ordinary Date.now plus constant TTLs; synthetic invalid-clock cases are not actual-use incidents. A corrupt clock may distort metadata expiry until repair/restart. - FaceTime does not fence unsupported start-before-stop reentry; its runtime creates a new supervisor after joined shutdown. Initial feature openclaw#119291 introduced the generation, without a human reentry incident. - LINE uses timer cancellation and its stop Promise, not a second stopped flag. Synchronous stop reentry is not performed by production callers. - Mattermost uses one stopped fact, recursive polling and native Promise settlement; synchronous callbacks cannot interleave with cancellation. - Teams uses a fresh UUID without reparsing text to reject a theoretical authored-placeholder collision; no human collision report was identified. - FaceTime expects the documented system_profiler JSON output; malformed output reports missing devices instead of parsing old plaintext fixtures. - Feishu serialization rejects cycles before element counting; exotic getter/toJSON objects remain best effort rather than a second graph walk. - Zalo shares SDK error traversal; provider errors with throwing cause getters remain best effort rather than a private short-circuit walker. - ClickClack uses the timeout race winner directly; exact-deadline late microtasks can discard stale ephemeral details, never the durable reply. - Raft's private FIFO settles replay commits before another claim. If that invariant were violated, an unexpected inflight wake is a duplicate hint rather than a second settlement path. openclaw#109117 gives synthetic/generic ownership reasoning, not a human actual-use incident. Old-code lane o07: production files checked against the last-seven-day origin/main inventory. No SDK exports, dependencies, schemas or protocols changed. Standalone session memory remains untouched. * refactor(mobile): simplify old native lifecycle bookkeeping Remove duplicate visibility/cache/startup state and unreachable platform/encoder fallbacks in old iOS and Android files. Share outside-tap recognition and let the node invoke boundary own mirrored-notification normalization. Keep physical-route authorization, permission checks, durable Watch admission and ACKs, FIFO sends, protocol/data shapes, and ordinary concurrency. Net production reduction: 289 LOC, excluding tests, fixtures, and generated files. Proof: iPhone app/Share/embedded Watch builds, final 273 invoke/Watch ingress/delegate/location tests and 74 sidebar/dashboard tests; Watch scheme build and 11 media tests; Android APK and 89 distinct focused unit cases; 18 shared source-resource tests. Changed-file guards, native lint, runtime/Madge cycles (zero), lint-suppressions (3 tests), and final independent P0-P2 review pass. No hosted CI or hardware/provider-audio/battery proof is claimed. Best-effort tradeoffs accepted: - Observer declarations (openclaw#113634): synthetic stale-ACK fencing is replaced by FIFO sends and subscription/reconnect replay; failed or obsolete metadata heals on the next declaration. - Dashboard refresh (openclaw#111339): the sole SwiftUI refresh task is sequential and cancellation-owned, so a second generation counter is redundant; a future concurrent direct caller must cancel prior work or accept last-completing cosmetic data until refresh. Roster event/mutation overlap still retains its own generation. - Delayed cosmetic actions (openclaw#113062): the synthetic post-delay interleaving no longer needs generations; replacing an action does not revoke work that already started. - Delayed gate lifetime (openclaw#113062): both real view owners cancel on disappearance, so a second weak-gate lifetime condition is redundant; a future caller omitting cancellation may still perform a harmless cosmetic completion after releasing its gate. - Watch one-shot transport (openclaw#135808): cancelled instances cannot restart, so generations add no supported lifetime; cancellation and physical-resource checks remain. - Command advertisements (openclaw#136192): the synthetic synchronous preference flip may briefly split a command family until reconnect; live invocation admission remains. - Turn recaps (openclaw#112221/openclaw#113084): synthetic metadata-only mode and a duplicated pending terminal value are removed; the sole production caller always provides transcript facts, and same-timestamp metadata corrections now use the latest authoritative session row. History/terminal attribution, settlement bounds and all 21 retained tests remain. - Realtime coordinator (openclaw#111033): direct concurrent reset/reuse is unsupported by serialized phone/Wear callers; current-session, duplicate-run, and live-submit guards remain. - Network availability (openclaw#138732): an unexpected duplicate SDK AVAILABLE may wake offline retry early; the human battery fix (openclaw#127872), retry ladder, and current-session admission remain. - iOS resource adapter (openclaw#148906): a captured invalidated loader may redundantly reload current metadata; the shared cache owner still cancels stale in-flight results and live authority remains checked. - Watch startup buffer (5a652b8): synchronous MainActor registration cannot interleave with queued inbound delivery; a future caller yielding before registration may drop ephemeral requests, never ACK uncommitted chat. - Mirror validation (openclaw#23636): the sole caller supplies normalized bounded fields; future internal callers must preserve that precondition. - Beacon payload UTF-8 (openclaw#73330): Foundation JSONEncoder guarantees the bytes; a framework contract violation is an internal failure, not a recoverable conversion branch. - Beacon envelope UTF-8 (openclaw#73330): the same guarantee removes the second conversion fallback; actual encoding errors still throw. - Watch request UTF-8 (openclaw#135808): default encoder output cannot fail UTF-8 conversion; actual encoding errors still throw. - Location event UTF-8 (openclaw#18260): default encoder output cannot fail UTF-8 conversion; nonfinite-value encoding failures keep their existing handling. - HealthKit identifiers (openclaw#105616): fixed supported identifiers use nonfailable SDK constructors; authorization, privacy scope, and queries remain unchanged. - Pre-iOS26 button fallback (openclaw#168595): the existing native deployment floor is26.2, so supported rendering is unchanged. - Pre-Android26 priority fallback (openclaw#29398): the app minimum is31; notification-channel importance remains the active owner. - WebView task document fences (openclaw#139514): existing MainActor cancellation-at-effect already rejects retired callbacks; navigation and document authority remain. (cherry picked from commit 3dd5a00) * refactor(ios): keep delayed cosmetic actions synchronous Both production callers update toast or flash state synchronously on MainActor. Remove the unused async action contract and invoke it directly after the existing sleep/cancellation boundary. Keep asynchronous sleeping, cancellation, replacement and the returned task unchanged. Best-effort tradeoffs accepted: - None added by this type narrowing. The helper is internal, both callers and all retained tests already supply synchronous actions. The hypothetical suspending action discussed with openclaw#113062 is not a supported caller and is no longer expressible through this API. Earlier guard-removal provenance and campaign proof are recorded in the preceding mobile cleanup commit. This follow-up changes no production LOC total, public protocol, permission, signing, dependency, persistence or visible rendering. Validation: iPhone app/Share/embedded Watch build and61 focused tests in2 suites pass (DelayedActionGateTests and RootTabsPresentationTests),196.654s xcodebuild/0.628s tests. Configured SwiftFormat and strict SwiftLint pass; independent P0-P2 review is scoped-clean. Earlier unchanged-input changed-file, cycle and lint-suppression gates remain valid. (cherry picked from commit c7c9fb6) * fix(mattermost): keep inbound message content out of diagnostics Log conversation, post ID and length instead of a body preview. Keep the complete agent body and attachment order unchanged, and update the existing monitor boundary test to reject content in diagnostics. The regression fails before the repair on the leaked synthetic body prefix after complete-body/ordered-media assertions pass, then passes after repair. Final owner24, sibling25 and lint-suppressions3 tests pass; runtime and Madge cycles are zero. Fresh production/test types, syntax lint, format and line-cap checks pass, with no baseline, suppression or timeout increase. This minimal privacy fix is explicitly authorized outside the old-code eligibility restriction. The combined channel/native patch received a fresh independent review with no actionable P0-P2 findings. * fix(ios): remove retired Watch error from i18n inventory * fix(mattermost): normalize nullable shutdown cleanup before await
Related: #127872 — sustained Android reconnect workload when a Gateway stays unreachable.
Credits
This work builds on @masatohoshino’s original bug report and reconnect-backoff implementation in #127872 and #127873. Their investigation, initial implementation, and real-device measurements established the problem and informed this follow-up.
This PR preserves the core progressive-backoff approach while narrowing the implementation to Android-only changes. Thank you @masatohoshino for the original contribution and the follow-up work.
What Problem This Solves
Addresses an issue where Android users leaving a Gateway's private network keep generating frequent reconnect attempts indefinitely, including while the existing foreground service survives dismissal from Recents. The retry timer previously stopped growing at eight seconds. A returning LAN could also be missed while cellular remained validated, and a network callback could retire an otherwise healthy socket.
Why This Change Was Made
Keep the existing session-owned reconnect loop and early retry slots, then converge to a finite 30–60 second jittered retry timer during persistent failures. Manual reconnect and newly available app-visible networks reset the same ladder, including wake/timeout boundary races. Healthy READY sockets, deliberate Disconnect, authentication pauses, target replacement, and callback ordering retain their ownership boundaries.
The runtime also wakes desired secondary sessions through a snapshot. A shared Android NetworkRequest removes only the default NOT_VPN constraint, preserving the other app-visible defaults; the tiny GatewayDiscovery caller now matches its existing VPN/split-DNS intent.
There are no Gateway server/protocol changes, new RPC or heartbeat, configuration options, foreground-service/Recents lifecycle changes, or LinkProperties topology snapshots. Existing OkHttp 30-second WebSocket pings still detect stale READY transports.
User Impact
Short interruptions keep the existing first six retry waits. Prolonged outages no longer remain at the eight-second timer ceiling, while finite passive retries retain recovery when only the Gateway process returns. Manual/network wakes do not start parallel reconnect loops or close healthy READY sessions.
The timer ceiling is not an end-to-end reconnect SLA: connection/handshake time and scheduling are additional. This PR makes no measured battery-savings claim. DNS/link-properties-only changes rely on passive retries rather than an exhaustive route-change detector.
Evidence
Evidence from #127873 remains attributed to its original revisions; validation of this PR is documented separately below.
Draft: required real Android before/after outage screenshots or video are not complete. Do not treat the socket/unit evidence below as device, radio, VPN, or battery proof.
825463ce1a698b9d945c5653c11d8c847b7249de. Original PlayDebug APK built; 41 original focused tests passed. Taggedv2026.9.1also retains the old eight-second cap.:app:testPlayDebugUnitTestwith--testsfilters for the four gateway suites andGatewayBootstrapAuthTest.networkAttachmentWakesEveryDesiredSecondaryGateway; Kotlin formatting used:app:ktlintFormat.c7a.8xlarge,eu-west-1; leasecbx_214ef7264842. Baseline regression runrun_3f959d785aa1, candidate focused runrun_18c60b42508a, secondary comparisonrun_b785e09a719b. This was not Blacksmith Testbox.cfd9b7a5502d0d8bef2cddf37caead9d36661730; base:cf78dda8e19eceb59a7720806c7c0198a08d071e. Its AWS results remain attributed to that revision.Current head — latest main
Head
1e4a8a7a3485ecfe6dd98eeeccd61df98d95ae08, pinned main6c745b31f1fcb953470390279d5e899d6229a72a. This final rebase remains patch-identical. Main had advanced with Android UI/settings changes and locale repairs, not the retry owner; their affected Android tests were added to the final focused validation.Fresh local results at this final head: 314 selected tests per flavor (628 total, 24 suites per flavor), zero failures/errors/skips. Exact-head PR CI 33972829971 completed successfully with no failed jobs. The prior patch-identical head passed 239 per flavor; both results remain retained. Selection covers the gateway package, GatewayBootstrapAuthTest and ChatControllerProgressCardTest, including the upstream routing addition. Both debug APK builds, both lint variants, ktlint and actual changed-file gates passed (exit 0). Fresh native Codex autoreview through P2 was scoped-clean (exit 0). This is targeted new-head coverage; the earlier 5,659-test runs below retain their original SHAs. JUnit reports, source hashes and build logs are retained.
The final-head candidate PlayDebug original is SHA256
f1921a2ef1d757b564b3b3a2958d36e53cc79490e38210b0b6708371b28f9364; its common-test-signed copy is3f73d2c109d6cf7499d60905c2f6e66ab37cc231ccd7452fa7a01ede8229fbb6. Native behavior observations below used the patch-identical23a57ab93266f718fd986e288d46c879c4108968copy because the subsequent rebase changed unrelated Android UI, not reconnect ownership. All 1,395 ZIP payload entries match the original, and the certificate matches the baseline test copy. Embedded BuildConfig identifies this exact head and PlayDebug flavor. Originals remain unchanged.Native behavior proof: the baseline APK installed and reached Gateway paired through the app’s normal Choose from gallery flow with an official QR from an unmodified, isolated, token-authenticated Gateway 2026.9.1 (
74cd349828fe5341ed370b93fb9fb0671770e26d; executable bytes match the earlier pinned installation). The candidate was installed in place with the same test signer. The Gateway record retained the same Android device ID and public key and both node/operator roles. The app foreground service remained running.Current native metrics: during matched Home-background, powered-awake/no-Doze measurements, the actual APKs produced 40 aggregate Gateway connection attempts in 180 seconds on the old behavior versus 7 on this head. Connection time is included; this is not a per-session timer or battery-saving measurement. The candidate automatically reconnected when only the same Gateway process returned, while Android network IDs/default network were unchanged.
Health controls and current limits: normal UI screenshots exist for welcome, Gallery setup, paired state, overview and Gateway pages. Attempts to isolate a READY socket while attaching an unrelated network are not established because this emulator changes the default route during Wi-Fi cycling; Recents dismissal is also unproven because the non-exported Recents activity and ordinary key/gesture paths did not remove the task. No physical radio, VPN or battery conclusion is inferred. Captured images remain private until inspected and sanitized.
the baseline APK installed and reached Gateway paired through the app’s normal Choose from gallery flow with an official QR from an unmodified, isolated, token-authenticated Gateway 2026.9.1 (
e55f25b15ea61ab26ef9079b9afa279155689b50). The Gateway retained one paired Android device after interruption. Captured PNGs have not yet been visually inspected or published. A host interruption terminated the emulator, Gateway and transport recorder together; that is not Gateway-only recovery evidence. Matched workload and recovery evidence is summarized below; Recents dismissal remains unproven in this emulator.Patch-identical native evidence head —
23a57ab93266The native observations and broker metrics below are bound to
23a57ab93266f718fd986e288d46c879c4108968. The complete reconnect patch is byte-identical to the final head; later main changes do not touchGatewaySession,NetworkMonitor,NodeRuntimeor the shared Gateway request.Earlier local full validation — head
55c03e897943Head
55c03e897943a43fe81e9f41b0d6fa5f80968bde, pinned main60a5fce142374c8f8627157a3b5fcaee94ef01d0. The clean rebase has an identical patch. Fresh validation below ran locally, not on AWS or Testbox:The Android validation command completed in 15m22s; separate ThirdParty APK packaging completed in 28s. Both and the changed-gate command exited 0. The missing local Mermaid dependency layout was repaired with an isolated frozen install, without modifying shared dependencies or product files. A separate broad Gateway build failed its resolution-topology mutation guard during concurrent local artifact generation; it is not counted as passed and no guard was disabled.
The retained baseline PlayDebug APK and newly built candidate PlayDebug APK have clearly labeled, common-test-signed copies for a data-preserving comparison. Each copy was verified against its own original: all 1,395 ZIP payload entries remain identical, including DEX, manifest, resources and native libraries; signatures verify under the same test certificate. Original binaries and hashes are retained. This is not release-signing, Play Integrity, physical-radio or battery evidence. Normal pairing and before/after recovery observations are still pending.
Direct dependency-source review was also refreshed: kotlinx.coroutines 1.11.0 sources,
Select.kt,OnTimeout.ktandChannel.ktestablish atomic selection, first-clause bias, timer disposal and outer-cancellation behavior. OkHttp 5.5.0 sources,RealWebSocket.writePingFrame/failWebSocket, show the missed-pong path invoking the existing failure callback. Android’s NetworkRequest builder, default capabilities and callback contract retain app-UID constraints, distinguish the default NOT_VPN restriction, and document independent network availability plus ordered subsequent callbacks. These source checks do not replace the requested native blackhole/Gateway-restart observations.Maintainer evidence disposition: the direct-source inspection, sanitized artifacts, and tested-head byte equivalence were completed by the acting maintainer workflow and are accepted as the authoritative evidence for this PR. ClawSweeper’s remaining checkbox records that its isolated worker could not independently reopen those sources/artifacts; it reports no actionable patch finding and proof confidence 5/6. That reviewer-environment limitation is not represented as independent reinspection.
Earlier exact-head AWS validation — September 5, 2026
That revision’s validation completed on AWS Crabbox for head
cfd9b7a5502d0d8bef2cddf37caead9d36661730(leasecbx_5cb1c8afdde0):All seven recorded command groups exited with code 0. SHA-256 verification matched all eight changed Kotlin source/test files to the local PR head. Logs, JUnit reports, source checksums, and both APKs were retrieved; the task-owned validation lease was released.
These results establish exact-head automated test and build coverage, not a successful real Android before/after user flow. Hosted PR CI is separate and is not implied by these remote results.
Earlier AWS live attempt, not claimed as passed
No physical Android device was exposed to this runner. AWS lacked KVM. The API36 Google APIs x86_64 software emulator (37.1.11.0) did boot; the actual baseline APK installed, and a real unmodified Gateway built and ran with strong token authentication in isolated state. Normal app launch timed out, and two bounded UI hierarchy captures returned null roots. No fake connection, screenshot fixture, authentication bypass, or synthetic app state was substituted. The image inspection tool also rejected available artifact paths, so uninspected images were not published.
Baseline APK SHA256:
f6ee53bc811f751fe9e9cb0dc71701b5bce852696a610d40b21b51c00f69430b. Compile SDK37, target SDK36; tests use Robolectric SDK34; kotlinx.coroutines1.11.0 and OkHttp5.5.0. The baseline/candidate logs and artifacts were retained privately, and the task-owned AWS lease was released.The local software-emulator route has since booted, but its first APK installation was interrupted by an Android system-server/network-stack crash. No successful normal pairing or matched outage capture is claimed from that attempt.
Outstanding before readiness: inspected shareable media, a maintainer disposition for the explicitly inconclusive Recents/long-lived secondary-route controls, and hosted exact-target CI. Physical radio/private-VPN/battery conclusions must not be inferred from emulator or unit results.
AI-assisted implementation, investigation, and validation.
Worked on by: