Repository navigation
fix(android): preserve device work across lifecycle changes - #116593
Conversation
262541e to
c3cbbd9
Compare
|
@clawsweeper re-review Final reviewed head: A fresh aggregate autoreview found one additional lifecycle issue after the prior re-review: permanent-denial Settings dialogs could remain attached to an Activity after it lost top-resumed ownership. Commit The earlier rank-up moves remain resolved: the Play failure was the corrected timing-sensitive assertion, and the negotiated fixed-path fallback is maintainer-confirmed for staggered phone/watch upgrades. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Final reviewed head: The latest branch-wide autoreview findings are addressed:
The prior Play-race explanation and maintainer-confirmed mixed-version fallback remain unchanged. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Final head: Both prior rank-up moves are now applied:
The implementation is unchanged from clean branch-wide autoreview head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Rank-up moves before merge:
The canceled |
…#116593) * fix(android): use configured SDK for screenshot AVDs * fix(android): keep chat jump control clear of messages * fix(wear): ignore stale control completions * fix(android): advertise node permission changes * fix(android): select play flavor for benchmarks * test(android): decouple cron benchmark from copy * fix(android): install play variant in perf scripts * fix(wear): clear gateway control busy state * fix(android): surface voice e2e connection errors * test(android): cover common live node commands * fix(android): retain share parsing across recreation * fix(android): retain permission requests across recreation * fix(wear): bind realtime audio to talk attempts * fix(android): track active permission host * fix(wear): own gateway control busy state * fix(wear): admit realtime channels by attempt * fix(android): refresh permissions on top resume * fix(wear): serialize reconnect retirement with writes * chore(i18n): refresh native source inventory * fix(wear): retain pending audio through start RPC * fix(wear): negotiate realtime channel compatibility * test(wear): assert reconnect outcome without owner churn * fix(android): move settings prompt with active host * fix(wear): reject stale relay starts * chore(changelog): leave notes to release generation
#173117) * refactor(apps): consolidate Android and Linux lifecycle paths Share transcript-content serialization without changing persisted JSON bytes, and move identical camera/chat JPEG resizing and recycling into one owner. Stop re-encoding an oversized JPEG when neither quality nor size can change. Reuse the first wide-area DNS SRV response instead of requesting it again for an address already present in its additional records. Use the discovery receiver handle as its liveness authority and inline the single-caller logind connection wrapper. Best-effort tradeoffs accepted - Swarm pagination no longer rescans a moving roster four times. The feature's #113850 tests synthesize moving offsets, not a human actual-use incident; skipped workers refresh on the next session event. Strictly advancing offsets also make a separate seen-offset set unnecessary. - Synchronous swarm projection now runs inside its existing lock rather than publishing through a second snapshot/revalidation path (#113850). There is no asynchronous gap to defend, and async response ownership checks remain. - Wear startup uses the active connection slot, not a third promotion map and claim-order counters. #116593/#116592 describe a source/emulator timing audit, not an independent human incident. Production requests are actor-serialized; reconnect exactly during prior-owner retirement may keep the reserved channel instead of the newest one. Restarting Talk recovers. Normal reconnect, audio owner settlement, physical generations and FIFO writes remain. - Wear peer registrations no longer carry generations (#109341/#109433). The removed regression forced a deferred send failure after rediscovery; a stale failure can now evict that peer until discovery or its next request. - Read-only Wear Pulse polling no longer has a second request generation or synchronous duplicate route checks (#122123 initial feature/synthetic tests). One canceled poller owns the work; phone/agent/session/route checks remain. - Discovery no longer has an independent alive flag or cleanup generation (#108115 synthetic adversarial review). Cleanup finishes before the receiver handle becomes finished, so a replacement cannot lose its snapshot. No signing, permission, dependency, schema, durability or Gateway protocol changes. The standalone session-memory backend is untouched. Net production reduction: 214 lines, excluding tests and 12 removed inline Rust test lines. The scope pass and two fresh independent passes found no further sound bulk cuts. Below-500 branch handoff for coordinator bundling. Baseline regression proof: the original JPEG algorithm encodes the same input 42 times; original DNS discovery makes PTR/SRV/SRV/TXT requests despite resolving the expected public endpoint. Both new regressions failed on those exact counts. Independent final review: scoped-clean, no actionable P0-P2 findings. Runtime and Madge cycles: zero. Lint-suppressions: 3/3 passed. Check-changed repository invariants and native schema gate passed; corrected Android fixture formatting passed its focused ktlint replay. Tauri all-targets build/tests passed on macOS: 325 unit and 7 native lifecycle tests. Linux-only build/logind proof remains for coordinator CI: the shared Testbox allocation queued and was stopped without executing commands; no active lease. No release gate dispatched, Apple target touched or hosted sandbox test run. Android proof: 229 focused phone tests passed across the complete batch and repaired discovery-class replay, plus 7 Wear lifecycle tests. Phone Play, third-party and Wear debug APK builds passed. Full discovery replay passed 16 tests plus 2 DNS TXT tests, with no errors, failures or skips. The initial full-class failure was a fixture singleton leak, fixed with a shadow-owned factory/reset; endpoint and packet assertions remain unchanged. * refactor(ios): share manual gateway security rows Use one rendering owner for the identical Settings and onboarding TLS picker and helper text. Preserve each original binding setter, transport policy, forced-TLS disabling, typography and row order. Keep security behavior tests; consolidate duplicate typography checks at the shared rendering owner. Regenerate the shrinking native source inventory: six label sites become three with the same IDs and strings. No translation memory or public contract changes. Independent P0-P2 review is scoped-clean. SwiftFormat and canonical source lint pass. Native platform builds and focused tests remain in progress. Best-effort tradeoffs accepted: none; rendering consolidation only. * refactor(apple): share presentation rows and remove duplicate task bookkeeping Use cancellation already owned by Quick Chat reads and hover-card avatar/progress tasks instead of a second request ID or generation comparison. Keep queued subscription generations, route checks and all write-patch settlement. Share media-unavailable rendering and notification priority translation while preserving typography, strings, modifier order, sound policy and authorization. Trust the process-lifetime LiveActivity singleton and the onboarding Candidate already passed by its owning ForEach. The exhaustive hydration switch still rejects idle and disconnected states; only its duplicate early guard is removed. Best-effort tradeoffs accepted: none added by this equivalent-owner batch. The branch's ReplayKit SDK duplicate-completion and seeded-runtime re-read tradeoffs remain documented in the initial consolidation commit. Source lint, formatting, parse, localization verification and lint-suppressions pass. Independent P0-P2 review's hydration finding is declined because the retained exhaustive switch returns false for both cited states. Native builds and focused tests remain in progress; app-hosted macOS execution is excluded. * refactor(apple): consolidate chat transport and capture lifecycle Share common chat RPC application logic while retaining platform route authority and non-retrying macOS compaction. Replace ReplayKit's startup phase machine with awaited start/stop settlement, share speech-resource teardown, and remove redundant identity/observer bookkeeping and DEBUG forwarding fixtures. Best-effort tradeoffs accepted: - ReplayKit duplicate startup completions are unsupported. The introducing lifecycle PR #103072 cites synthetic coverage, not a human duplicate-callback incident; a violated SDK single-completion contract now fails visibly. - A same-user runtime mutation after seed validation is no longer re-read. Feature PR #161709 cites fixture proof, not a report requiring that duplicate validation; the next normal resolution validates concrete state again. No signing, entitlement, bundle ID, permission, protocol, schema, or dependency changes. Phase E session memory is untouched. Native build/test verification is still running; app-hosted macOS execution requires a disposable OS environment. * refactor(wear): retain pulse polling lifecycle guards Drop the wave-5 pulse polling simplification after independent review raised uncertainty around late non-cancellation errors. Restore the production owner and lifecycle test byte-for-byte to the bundle base; keep the rest of the Android/Linux and Apple bundle unchanged. * refactor(apps): retain established Wear and screenshot paths Drop Wear channel claim cleanup after review identified stale claims displacing newer active Talk owners. Restore its complete lifecycle regressions. Drop ChatProTab and OpenClawBrand cleanup after the hosted iPad screenshot timeout did not reproduce in serial exact head/base replays; no claim of a proven timeout repair. Keep independent Android DNS and JPEG performance fixes and the remaining y18/y19 native-app cleanup. * refactor(apps): drop Linux lifecycle cleanup from bundle Apply the coordinator drop-hunks rule after the Linux onboarding Review permissions test reached Connection Settings instead of Native permissions. Routing owners are unchanged; without conclusive Linux replay, restore all y18 Linux runtime files to origin/main ace1908. Preserve Android and Apple cleanup, including the DNS and JPEG fixes. Park the original Linux hunks separately for native investigation; no timeout repair or inherited-red attribution claimed. * refactor(apps): drop shared chat RPC consolidation Restore the existing iOS/macOS adapters, shared extension and tests after the exact-head shared Periphery intersection reported the moved pager and metadata identities unused in both consumers. Apply the coordinator drop-hunks rule rather than suppressing the scanner or rerunning CI for green. Preserve route/server-lease authority and macOS no-retry compaction. * refactor(android): drop chat cleanup after native fixture failure Apply the coordinator changed-path drop rule after ChatCompletedWorkLayoutTest.completedWorkSummaryKeepsEarlierToolFailureVisible timed out waiting for refreshed tool-error history in third-party CI. Restore chat models, cache, controller, swarm and associated test deltas as one conservative unit. No causal timing repair or inherited-main attribution is claimed. Keep both Android DNS and JPEG fixes and retained Apple cleanup.
openclaw#173117) * refactor(apps): consolidate Android and Linux lifecycle paths Share transcript-content serialization without changing persisted JSON bytes, and move identical camera/chat JPEG resizing and recycling into one owner. Stop re-encoding an oversized JPEG when neither quality nor size can change. Reuse the first wide-area DNS SRV response instead of requesting it again for an address already present in its additional records. Use the discovery receiver handle as its liveness authority and inline the single-caller logind connection wrapper. Best-effort tradeoffs accepted - Swarm pagination no longer rescans a moving roster four times. The feature's openclaw#113850 tests synthesize moving offsets, not a human actual-use incident; skipped workers refresh on the next session event. Strictly advancing offsets also make a separate seen-offset set unnecessary. - Synchronous swarm projection now runs inside its existing lock rather than publishing through a second snapshot/revalidation path (openclaw#113850). There is no asynchronous gap to defend, and async response ownership checks remain. - Wear startup uses the active connection slot, not a third promotion map and claim-order counters. openclaw#116593/openclaw#116592 describe a source/emulator timing audit, not an independent human incident. Production requests are actor-serialized; reconnect exactly during prior-owner retirement may keep the reserved channel instead of the newest one. Restarting Talk recovers. Normal reconnect, audio owner settlement, physical generations and FIFO writes remain. - Wear peer registrations no longer carry generations (openclaw#109341/openclaw#109433). The removed regression forced a deferred send failure after rediscovery; a stale failure can now evict that peer until discovery or its next request. - Read-only Wear Pulse polling no longer has a second request generation or synchronous duplicate route checks (openclaw#122123 initial feature/synthetic tests). One canceled poller owns the work; phone/agent/session/route checks remain. - Discovery no longer has an independent alive flag or cleanup generation (openclaw#108115 synthetic adversarial review). Cleanup finishes before the receiver handle becomes finished, so a replacement cannot lose its snapshot. No signing, permission, dependency, schema, durability or Gateway protocol changes. The standalone session-memory backend is untouched. Net production reduction: 214 lines, excluding tests and 12 removed inline Rust test lines. The scope pass and two fresh independent passes found no further sound bulk cuts. Below-500 branch handoff for coordinator bundling. Baseline regression proof: the original JPEG algorithm encodes the same input 42 times; original DNS discovery makes PTR/SRV/SRV/TXT requests despite resolving the expected public endpoint. Both new regressions failed on those exact counts. Independent final review: scoped-clean, no actionable P0-P2 findings. Runtime and Madge cycles: zero. Lint-suppressions: 3/3 passed. Check-changed repository invariants and native schema gate passed; corrected Android fixture formatting passed its focused ktlint replay. Tauri all-targets build/tests passed on macOS: 325 unit and 7 native lifecycle tests. Linux-only build/logind proof remains for coordinator CI: the shared Testbox allocation queued and was stopped without executing commands; no active lease. No release gate dispatched, Apple target touched or hosted sandbox test run. Android proof: 229 focused phone tests passed across the complete batch and repaired discovery-class replay, plus 7 Wear lifecycle tests. Phone Play, third-party and Wear debug APK builds passed. Full discovery replay passed 16 tests plus 2 DNS TXT tests, with no errors, failures or skips. The initial full-class failure was a fixture singleton leak, fixed with a shadow-owned factory/reset; endpoint and packet assertions remain unchanged. * refactor(ios): share manual gateway security rows Use one rendering owner for the identical Settings and onboarding TLS picker and helper text. Preserve each original binding setter, transport policy, forced-TLS disabling, typography and row order. Keep security behavior tests; consolidate duplicate typography checks at the shared rendering owner. Regenerate the shrinking native source inventory: six label sites become three with the same IDs and strings. No translation memory or public contract changes. Independent P0-P2 review is scoped-clean. SwiftFormat and canonical source lint pass. Native platform builds and focused tests remain in progress. Best-effort tradeoffs accepted: none; rendering consolidation only. * refactor(apple): share presentation rows and remove duplicate task bookkeeping Use cancellation already owned by Quick Chat reads and hover-card avatar/progress tasks instead of a second request ID or generation comparison. Keep queued subscription generations, route checks and all write-patch settlement. Share media-unavailable rendering and notification priority translation while preserving typography, strings, modifier order, sound policy and authorization. Trust the process-lifetime LiveActivity singleton and the onboarding Candidate already passed by its owning ForEach. The exhaustive hydration switch still rejects idle and disconnected states; only its duplicate early guard is removed. Best-effort tradeoffs accepted: none added by this equivalent-owner batch. The branch's ReplayKit SDK duplicate-completion and seeded-runtime re-read tradeoffs remain documented in the initial consolidation commit. Source lint, formatting, parse, localization verification and lint-suppressions pass. Independent P0-P2 review's hydration finding is declined because the retained exhaustive switch returns false for both cited states. Native builds and focused tests remain in progress; app-hosted macOS execution is excluded. * refactor(apple): consolidate chat transport and capture lifecycle Share common chat RPC application logic while retaining platform route authority and non-retrying macOS compaction. Replace ReplayKit's startup phase machine with awaited start/stop settlement, share speech-resource teardown, and remove redundant identity/observer bookkeeping and DEBUG forwarding fixtures. Best-effort tradeoffs accepted: - ReplayKit duplicate startup completions are unsupported. The introducing lifecycle PR openclaw#103072 cites synthetic coverage, not a human duplicate-callback incident; a violated SDK single-completion contract now fails visibly. - A same-user runtime mutation after seed validation is no longer re-read. Feature PR openclaw#161709 cites fixture proof, not a report requiring that duplicate validation; the next normal resolution validates concrete state again. No signing, entitlement, bundle ID, permission, protocol, schema, or dependency changes. Phase E session memory is untouched. Native build/test verification is still running; app-hosted macOS execution requires a disposable OS environment. * refactor(wear): retain pulse polling lifecycle guards Drop the wave-5 pulse polling simplification after independent review raised uncertainty around late non-cancellation errors. Restore the production owner and lifecycle test byte-for-byte to the bundle base; keep the rest of the Android/Linux and Apple bundle unchanged. * refactor(apps): retain established Wear and screenshot paths Drop Wear channel claim cleanup after review identified stale claims displacing newer active Talk owners. Restore its complete lifecycle regressions. Drop ChatProTab and OpenClawBrand cleanup after the hosted iPad screenshot timeout did not reproduce in serial exact head/base replays; no claim of a proven timeout repair. Keep independent Android DNS and JPEG performance fixes and the remaining y18/y19 native-app cleanup. * refactor(apps): drop Linux lifecycle cleanup from bundle Apply the coordinator drop-hunks rule after the Linux onboarding Review permissions test reached Connection Settings instead of Native permissions. Routing owners are unchanged; without conclusive Linux replay, restore all y18 Linux runtime files to origin/main c975ae3. Preserve Android and Apple cleanup, including the DNS and JPEG fixes. Park the original Linux hunks separately for native investigation; no timeout repair or inherited-red attribution claimed. * refactor(apps): drop shared chat RPC consolidation Restore the existing iOS/macOS adapters, shared extension and tests after the exact-head shared Periphery intersection reported the moved pager and metadata identities unused in both consumers. Apply the coordinator drop-hunks rule rather than suppressing the scanner or rerunning CI for green. Preserve route/server-lease authority and macOS no-retry compaction. * refactor(android): drop chat cleanup after native fixture failure Apply the coordinator changed-path drop rule after ChatCompletedWorkLayoutTest.completedWorkSummaryKeepsEarlierToolFailureVisible timed out waiting for refreshed tool-error history in third-party CI. Restore chat models, cache, controller, swarm and associated test deltas as one conservative unit. No causal timing repair or inherited-main attribution is claimed. Keep both Android DNS and JPEG fixes and retained Apple cleanup.
Closes #116592
Additional instructions
This is a same-repository branch, so repository maintainers can edit it directly.
What Problem This Solves
Fixes an issue where Android phone and paired Wear users could lose or misroute device work when an Activity, permission host, route, talk attempt, or realtime channel changed while an operation was still active.
The audit also found build and proof-path defects that made these workflows unreliable to validate: benchmark variant selection, stale benchmark copy, SDK tool selection, app variant installation, and delayed gateway failure reporting.
Why This Change Was Made
The fix moves lifecycle-sensitive ownership to retained runtime boundaries, carries explicit generations and attempt identities through Wear operations, and serializes realtime channel retirement with selected writes. Attempt-scoped realtime audio is negotiated through the existing phone capability set; mixed-version phone/watch pairs retain the shipped fixed channel path during staggered updates. Staged channels are bounded per node and globally before streams are opened.
The adjacent tooling changes make the same phone, Wear, benchmark, and live-profile matrix deterministic instead of relying on ambient SDK or flavor selection.
This is AI-assisted work. I reviewed the implementation, ran fresh scoped and aggregate autoreview passes, and addressed every accepted finding before opening the PR.
User Impact
Android share and permission-gated actions now survive Activity recreation and top-resumed host changes. Stale Wear routes and talk attempts cannot displace current work, reconnecting a realtime channel no longer closes beneath an in-flight audio frame, mixed phone/watch app versions keep realtime Talk available, and unclaimed channels cannot grow without bound.
The Android benchmark/performance proof paths also select the intended Play build consistently.
The chat jump-to-latest control also keeps clearance from the final message on compact phone layouts.
Evidence
Exact reviewed head:
d2ab6beffaf7874e3b8fce5c5457c4acebef92ab./gradlew :app:testPlayDebugUnitTest :app:testThirdPartyDebugUnitTest :wear:testDebugUnitTest :wear-shared:testDebugUnitTest :app:assemblePlayDebug :app:assembleThirdPartyDebug :wear:assembleDebug :benchmark:assembleDebug :app:lintPlayDebug :wear:lintDebug :app:ktlintCheck :wear:ktlintCheck :wear-shared:ktlintCheckBUILD SUCCESSFUL./gradlew :app:connectedPlayDebugAndroidTest./gradlew :benchmark:connectedDebugAndroidTestPermissionRequesterTestclass and Android app ktlint passed.node --import tsx scripts/native-app-i18n.ts verifyKnown environment limit: the live Android node profile reached its gateway precondition and stopped on a redacted
gateway token mismatch; it did not execute device commands against another session's gateway. The device instrumentation, benchmark instrumentation, lifecycle races, and Wear transport behavior above were exercised independently.