Skip to content

feat(android): add Wear OS phone proxy - #109341

Merged
steipete merged 17 commits into
mainfrom
codex/wearos-phone-proxy
Jul 16, 2026
Merged

steipete merged 17 commits into
mainfrom
codex/wearos-phone-proxy

Conversation

@steipete

@steipete steipete commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #108781

What Problem This Solves

Wear OS needs a credential-free path to the authenticated Android Gateway session. Giving the watch Gateway credentials or duplicating the full client runtime would expand the security and lifecycle surface.

Why This Change Was Made

This adds the phone-owned Wear proxy and shared versioned protocol. The phone exposes only bounded session list, history, send, abort, connection, and projected chat-event operations; credentials remain on the phone. Payload depth/size, peers, buffered events, text, attachments, and forwarded fields are bounded, and sequence gaps provide recovery through canonical history.

User Impact

No standalone watch UI ships in this stage. This is the credential-safe transport foundation for the companion app, while Android phone behavior remains unchanged when no watch is registered.

Evidence

  • Exact-tree AutoReview: clean
  • git diff --check
  • Android manifest XML parse
  • Native i18n inventory: changed=false
  • node scripts/run-vitest.mjs test/scripts/native-app-i18n.test.ts: 12/12
  • Exact-head hosted CI at bc19bee04e727f43cbed29df150083f4b895c998: Android play/third-party unit tests, play build, ktlint, native i18n, and test types all passed (run 29537783126, attempt 2)

steipete and others added 13 commits July 16, 2026 01:53
Introduce a bounded, versioned phone/watch RPC contract and wire its test, lint, and build gates before either runtime endpoint lands.

Co-authored-by: Sebastian Schubotz <[email protected]>
Cover every supported RPC method and event discriminator so phone and watch cannot silently drift.

Co-authored-by: Sebastian Schubotz <[email protected]>
Reject excessively nested Data Layer envelopes before kotlinx.serialization can recurse through them.
Keep outbound messages inside the same JSON nesting contract enforced by the decoder.
Traverse arbitrary JSON payloads iteratively before serialization so deeply nested local trees fail safely.
Co-authored-by: Sebastian Schubotz <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added app: android App: android scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Jul 16, 2026
@steipete steipete added the app: wearos App: wearos label Jul 16, 2026
@steipete
steipete merged commit 87bb99d into main Jul 16, 2026
375 of 377 checks passed
@steipete
steipete deleted the codex/wearos-phone-proxy branch July 16, 2026 23:08
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
* feat(android): add Wear proxy protocol

Introduce a bounded, versioned phone/watch RPC contract and wire its test, lint, and build gates before either runtime endpoint lands.

Co-authored-by: Sebastian Schubotz <[email protected]>

* test(android): lock Wear wire names

Cover every supported RPC method and event discriminator so phone and watch cannot silently drift.

Co-authored-by: Sebastian Schubotz <[email protected]>

* fix(android): bound Wear JSON depth

Reject excessively nested Data Layer envelopes before kotlinx.serialization can recurse through them.

* fix(android): enforce Wear depth on encode

Keep outbound messages inside the same JSON nesting contract enforced by the decoder.

* fix(android): preflight Wear payload depth

Traverse arbitrary JSON payloads iteratively before serialization so deeply nested local trees fail safely.

* feat(android): add Wear phone proxy

Co-authored-by: Sebastian Schubotz <[email protected]>

* fix(ci): repair Wear and docs sync checks

---------

Co-authored-by: Sebastian Schubotz <[email protected]>
Co-authored-by: Sebastian Schubotz <[email protected]>
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
* feat(android): add Wear proxy protocol

Introduce a bounded, versioned phone/watch RPC contract and wire its test, lint, and build gates before either runtime endpoint lands.

Co-authored-by: Sebastian Schubotz <[email protected]>

* test(android): lock Wear wire names

Cover every supported RPC method and event discriminator so phone and watch cannot silently drift.

Co-authored-by: Sebastian Schubotz <[email protected]>

* fix(android): bound Wear JSON depth

Reject excessively nested Data Layer envelopes before kotlinx.serialization can recurse through them.

* fix(android): enforce Wear depth on encode

Keep outbound messages inside the same JSON nesting contract enforced by the decoder.

* fix(android): preflight Wear payload depth

Traverse arbitrary JSON payloads iteratively before serialization so deeply nested local trees fail safely.

* feat(android): add Wear phone proxy

Co-authored-by: Sebastian Schubotz <[email protected]>

* fix(ci): repair Wear and docs sync checks

---------

Co-authored-by: Sebastian Schubotz <[email protected]>
Co-authored-by: Sebastian Schubotz <[email protected]>
steipete added a commit that referenced this pull request Oct 15, 2026
#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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: wearos App: wearos maintainer Maintainer-authored PR scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant