Skip to content

refactor(apps): deslop Android, Linux and Apple apps (wave-5 bundle E) - #173117

Merged
steipete merged 9 commits into
mainfrom
deslop/bundle-w5e-native-apps-20261015
Oct 15, 2026
Merged

steipete merged 9 commits into
mainfrom
deslop/bundle-w5e-native-apps-20261015

Conversation

@steipete

@steipete steipete commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Consolidates duplicated native-app work and fixes redundant wide-area DNS requests and repeated identical JPEG encodes on Android. This is the maintainer-requested wave-5 bundle E, combining the retained Android part of y18 and Apple part of y19. All y18 Linux/Tauri runtime hunks are dropped and parked separately after inconclusive native onboarding failure attribution.

User Impact

Android reuses the first SRV response instead of requesting it again, and stops JPEG compression when quality and dimensions cannot shrink further. Existing output budgets, endpoint fallback, bitmap ownership, persisted transcript bytes, permissions, and effect authority remain intact. No config, schema, dependency, signing, or deployment-floor changes.

Rendering is unchanged: the Apple presentation extractions retain the same labels, branded fonts, spacing, styles, binding setters, TLS disabling and video minimum height. Removed iOS availability branches were unreachable below the existing app-only iOS 26.2 floor; shared-package older-platform support stays intact. Notification interruption levels and capture controls are unchanged. No intentional visual change or new notification/capture UI requires before/after media.

Why This Change Was Made

Android uses existing content/JPEG owners and simplifies best-effort Wear peer bookkeeping. Apple shares notification priority mapping and identical presentation rows, removes redundant task bookkeeping, and replaces ReplayKit startup machinery with awaited startup/cancellation/stop settlement. Linux discovery/logind lifecycle, Android chat/cache/swarm owners and the existing iOS/macOS chat RPC adapters remain unchanged from the main base.

Combined reduction after review: 248 runtime production LOC (retained y18 Android: 34; y19 Apple: 214), excluding tests, generated inventory and 87 DEBUG-only Apple test-support lines. Whole tracked diff: 263 fewer lines (+521/-784), 40 files. The Wear pulse-polling and channel-registry simplifications were dropped after review; their production owners and lifecycle tests are byte-identical to the pinned main base. ChatProTab/OpenClawBrand and all Linux/Tauri cleanup were also dropped after inconclusive native failure attribution. The shared chat RPC consolidation and its new tests were dropped after the shared Periphery intersection failed. Android chat model/cache/swarm/controller cleanup and its test deltas were dropped after the third-party completed-work fixture timed out. No changelog edit.

Accepted best-effort tradeoffs: a stale Wear peer send failure may require rediscovery. ReplayKit's documented single-completion callback contract is trusted rather than silently absorbing unsupported duplicate callbacks. Runtime seeding trusts the payload it just validated/published rather than immediately resolving it again; later invocations still validate existing state. Ordinary cancellation, stream draining, FIFO writes, credential/permission authority, atomic publication and durable settlement remain. Swarm roster bookkeeping, transcript cache encoding, Wear claim sequencing and reconnect promotion remain unchanged after dropping those cleanups.

Source credit: y18, deslop/y18-apps-android-linux-20261015 at 7c351f3430e; y19, deslop/y19-apps-apple-20261015 at 80f30cd5f1a (three commits). Both lanes authored by Peter Steinberger. All four commits cherry-picked without code conflicts; current main's native-state changes retained. Review then dropped uncertain Wear lifecycle cleanup and screenshot-adjacent UI hunks rather than add machinery or claim an unproven repair.

Evidence

Source-lane native proof (completed, not bundle-head CI): Android Play/third-party/Wear debug APK builds, 229 focused phone tests and 7 Wear lifecycle tests passed. DNS packet regression failed on the original PTR/SRV/SRV/TXT sequence and passed with PTR/SRV/TXT; JPEG regression failed with 42 encodes and passed with one. Tauri native Cargo proof on macOS passed 325 unit and 7 lifecycle integration tests; this does not cover Linux-only code.

Apple lane: shared native build and 21 sandboxed tests passed; iOS/Watch native build/test passed 381 tests in 8 suites, zero failures/skips, finalized xcresult; both Watch Rust/Swift architectures built. macOS app and tests compiled with build-for-testing, never launched on the operator desktop. Source lint/format, native i18n verification and schema guard passed. Prior local JS tooling timeouts and bounded replays remain recorded as failures, not repairs or green gates.

Bundle input: Android Play/third-party/Wear debug builds passed in 9m54s. Restored Wear pulse owner: main/test ktlint and 7 lifecycle tests passed (27.116s test time, 3m19s command). Final restored phone channel registry: main/test ktlint and 23 lifecycle tests passed, zero failures/errors/skips (3.152s tests; 5m14s command including compilation). Shared Apple native build passed in 1031.13s; 21 tests in 4 suites passed in 0.105s behind the OS sandbox. iOS/Watch passed 381 tests in 8 suites, zero failures/skips, with finalized xcresult (383.716s tests; 2038.096s command including delayed simulator diagnostics). macOS app/test targets compiled successfully in 1207.290s. Current-main native schema guard passes v24. No code conflict occurred. Final correction review is scoped-clean. App-hosted macOS execution is intentionally reserved for disposable CI; no unsigned app launch or saved-Keychain access.

Fresh complete-bundle review produced two P2 findings. The Wear pulse late-error concern was resolved conservatively by dropping that cleanup and restoring its existing owner/test to main. The Live Activity concern was declined against the retained exhaustive shouldHydrate switch, which explicitly returns false for .idle and .disconnected; removing the preceding duplicate check cannot admit those states. Initial correction-only P0–P2 review completed scoped-clean after source verification. Hosted review then identified stale Wear claims displacing newer active Talk owners; the entire registry cleanup and deleted regression tests are restored to the pinned base. Fresh four-file correction-scoped P0–P2 review completed scoped-clean (confidence 0.95), including final source verification. No actionable finding remains. The full review is recorded as findings, not mislabeled clean.

Initial exact-head CI run 38733549616 failed only ios-screenshots-ipad-13 (job 116417752097), plus the downstream aggregate gate. XCUIScreen.main.screenshot() timed out after readiness/focus/dismiss assertions passed; this was not a pixel mismatch. The classifier reported UNKNOWN, with no comparable scheduled-main job. Serial exact-test replay at head passed (34.415s) and at pinned base a929caceb527 passed (36.775s), with the same iPad class, fixture and 180-second test limits. This is inconclusive, not a proven fix or inherited-red attribution: dropped the relevant ChatProTab/OpenClawBrand hunks per maintainer instruction. The initial baseline build failed on a stale generated Swift file list before tests; regenerated through the canonical owners, then native build/test passed. Both actual XCTest PNG attachments were exported and inspected as synthetic-only. Optional Fastlane PNG export could not write its absent operator cache; that cache was not created or modified. No CI reruns or test weakening.

Linux proof: immediate Blacksmith Testbox request was queued and stopped, with no workload run or alternate-provider escalation. Provider reports completed and the same-ID cleanup reconciliation returned exit 0. Linux App PR CI run 38733508109 completed successfully: Ubuntu build/all-target Rust tests and native inline-browser, Gateway-switching and desktop-sharing proof, macOS companion tests, and Windows desktop/installer build. This closes the Linux build gap; opt-in logind runtime cases remain unrun, and compilation is not logind runtime evidence.

Linux onboarding investigation and dropped scope

Previous head 9b62e32df6b had a separate Linux App failure. It was not attributed to main and no inherited-red exception was claimed. The coordinator required applying the drop-hunks rule: both y18 Linux runtime files, discovery.rs and gateway_sleep_logind_listener.rs, are restored byte-for-byte to origin/main ace190874ae. The original Linux-only hunks are preserved on deslop/w5e-linux-onboarding-20261015 (no PR), with the failing test and route trace in the commit note. No causal timeout/navigation repair is claimed. The Android DNS/JPEG fixes and Apple cleanup are unaffected.

Attempt Failed job/step Observed failure Attribution
Linux App 38739841410, job 116438347049, head 9b62e32df6b, tested merge 74a424f3825c with base a5a279840425 Build Linux companion / Test native Gateway switching, onboarding subcommand After clicking Review permissions, expected Native permissions but remained on Connection Settings Unknown; no waiver claimed
Latest available main Linux App run 38716848205, head 912a3e0df69 Test native first-run setup and failed Gateway startup Expected Where should your assistant live? but remained on Connecting to OpenClaw Different signature; not matching inherited proof

On that previous head, Linux Rust tests passed (338 unit tests plus 7 lifecycle and 8 sleep tests; ignored platform cases remained unrun). Native inline browser and the Gateway-switching subcommand passed before the onboarding failure. The fixture calls Review permissions -> native setup permissions panel -> selected-document URL /settings/device/permissions -> navigate_locked/GatewayWindows.navigate_document; Connection Settings is the separate gateway-settings flow. Those owners were unchanged, but discovery restart and logind hooks share the app lifecycle, so the entire Linux cleanup was dropped rather than make a speculative correction. Exact failed-job logs were fetched once. Focused Linux replay capacity was unavailable; queued task allocations were stopped without a workload or provider fallback.

Restored-side local proof: cargo +1.97.1 test --locked --all-targets -j 2 passed on macOS, 326 unit tests (3.73s) plus 7 native lifecycle tests (0.27s), 57.23s compilation. Rust typechecking is included in that native compilation; cargo fmt --check and git diff --check passed. The changed-check planner selects no TypeScript graph check for the Rust-only restoration. Linux-only logind/GTK behavior is not claimed as macOS proof. Fresh P0–P2 restoration review is scoped-clean (0.97). Fresh exact-head PR CI is required after the correction push; no CI reruns or green-only pushes.

Restored-side Rust Clippy also completed successfully on macOS (3m22s); existing warnings in unchanged baseline files remain, not suppressed.

Shared chat RPC consolidation dropped

Head 213ec0cdecd primary CI run 38743250553 passed, including both iOS screenshot shards. The external Shared OpenClawKit Periphery run 38743250124 failed its exact-identity intersection (job 116459717484): OpenClawChatChildSessionPager, collect(fetchPage:), OpenClawChatMetadataCapabilities, swarmEnabled and init(from:) were reported unused in both consumers after their direct iOS/macOS uses moved behind shared extension overloads. No inherited-red attribution or scanner waiver is claimed. Following the coordinator's changed-path drop rule, restored both adapters, the shared transport extension and its added tests to the pinned main base as one coherent removal. Existing route/server-lease authority and macOS no-retry compaction remain intact. No CI rerun or test/scanner weakening.

Correction proof: shared native build passed in 308.80s; the freshly linked native bundle passed 18 retained tests in 4 suites in 0.004s behind the OS sandbox. The first helper invocation selected an older SwiftPM product; that stale result is excluded, and the helper was corrected to the actual native product before the fresh run. Four restored files pass SwiftFormat and Swift syntax parsing; three source files pass SwiftLint with zero violations. Fresh Keychain-route correction review completed scoped-clean (0.98). Both adapters, the shared extension and its tests have no remaining diff against the pinned main base.

Android chat cleanup dropped

Head 0dfa1ecaf658 CI run 38747435947 failed android-test-third-party (job 116465628771): ChatCompletedWorkLayoutTest.completedWorkSummaryKeepsEarlierToolFailureVisible, line 408, timed out after 1000ms waiting for refreshed history to publish the tool-error row. 3697 tests ran with one failure. The native classifier reports new, because the comparable main job passed; no inherited-red exception is claimed. The fixture uses the real ChatController, Room transcript cache and chat models modified by the bundle. Rather than speculate about a timing repair, restored the entire remaining Android chat model/cache/controller/swarm cleanup and both affected test deltas to the pinned main base. No change to the failed test, timeout, assertions or retries. Both Android DNS and JPEG fixes remain. Exact job logs were fetched once and reused for classification.

Restored-side proof: third-party debug main/test ktlint and focused native tests passed in 4m59s: the exact failed completed-work method (1 test, 12.483s), Room cache (25 tests, 16.239s) and swarm progress (10 tests, 0.172s), all zero failures/errors/skips. This is narrow proof after dropping the changes, not causal attribution of the earlier timeout. Fresh Keychain-route P0–P2 cutback review is scoped-clean (0.92). The earlier shared-RPC drop was also confirmed by successful exact-head Shared OpenClawKit intersection run 38747435879, job 116474840471; no scan waiver. New exact-head CI is required after this further correction.

Test cost context: Android platform-backed Robolectric contracts in the source lane took 0.016–81.484 seconds per phone suite under heavy host load (Room persistence, bitmap ownership, Android DNS and lifecycle boundaries); Wear lifecycle 65.979 seconds. Shared 21-test execution took 0.224 seconds; iOS 381-test execution 55.866 seconds. No timeouts, retries, assertions or skips were weakened. Hosted timing and any inherited-red failure table will be added when available; no reruns for green.

Final exact-head CI

Head 638cab25983ba492c7d5bb8d230cd3f97db0c421: CI run 38751794126 and the exact-head all-check watcher completed green, with no current pending or failing checks. Android third-party tests passed after the conservative chat drop; both iOS screenshot lanes and the shared OpenClawKit dead-code intersection cleared. Superseded older-head checks remain historical failures, not current proof. No CI reruns, green-only pushes, scanner/test weakening or inherited-red admin exception. Final native review/preparation binds this exact head; final change is 40 files, +521/-784 (263 net tracked LOC removed), 248 runtime LOC removed. Phase E remains untouched; no changelog edit.

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.
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.
…okkeeping

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.
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.
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.
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 15, 2026 12:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T14:32:58.642326Z 638cab2 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62b4cde0e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +263 to +268
val connection = pendingConnections.remove(key)
if (connection != null) {
val displaced = connections[key.nodeId]
// Reservation is the ordering boundary. Later claims wait for this bounded handoff, then may replace it.
// The active slot also owns startup until the displaced audio owner has stopped.
connection.ready = false
displaced?.ready = false
promotingConnections[key] = connection
active?.ready = false
connections[key.nodeId] = connection

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject superseded Wear channel claims

When attempt A is polling for its channel, attempt B can claim and become active, and then a delayed channel for A can arrive before A's deadline; reserveClaim now removes and promotes A unconditionally, displacing the newer B owner because the per-node claim sequence was removed. The deleted older polling claim cannot replace a newer active attempt test covered this exact ordering, which can stop the current Talk session and reconnect the stale one; retain a latest-attempt check before promotion.

AGENTS.md reference: AGENTS.md:L7-L8

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR consolidates native app helpers and lifecycle bookkeeping while eliminating redundant Android DNS requests and JPEG encoding attempts.

Example: A 128×256 image at quality 20 encodes to 101 bytes against a 100-byte limit.

  • Before: The limiter repeats identical encoding attempts 42 times before rejecting the image.
  • After: The limiter rejects it after one attempt because neither quality nor dimensions can shrink.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, owner-approved consolidation with meaningful boundary coverage and no verified source defect; supplied runtime evidence and unresolved native CI limit validation confidence.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR; supplied evidence consists of native builds and boundary tests, without a claim of live device capture or logind execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: Android discovery repeats DNS work, and oversized images can repeat identical compression attempts before reporting failure.
Reason: The maintainer has approved this consolidation direction and its explicit best-effort tradeoffs, while the Android fixes remove concrete unnecessary work.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-owned refactor includes useful Android efficiency fixes, and source review found no definite introduced bug; native CI failures remain unattributed.

Priority: P2
Reviewed head: 62b4cde0e40a7e1ce27c611020d74049ce24a85b

Before merge

None.

Findings

None.

Provenance

  • Android wide-area DNS: original intent not found (unknown: Scoped symbol history across current and previous package paths reaches carried-forward rename history without establishing the original reason for the repeated SRV lookup.)

Tests

  • Missing end-to-end proof: The reported native builds and boundary tests do not exercise real ReplayKit cancellation or Linux logind runtime behavior.
Agent review details

How this fits together

Native app adapters receive chat requests, device operations, discovery responses, and lifecycle events, then use shared helpers and platform owners to produce Gateway requests, cached transcripts, media, and presentation state.

flowchart TD
  A[Native app interactions] --> B[Platform adapters]
  B --> C[Shared chat and media helpers]
  B --> D[Platform lifecycle owners]
  C --> E[Gateway transport]
  C --> F[Transcript cache]
  D --> G[Device capture and discovery]
Loading

Technical review

Best possible solution:

Land the existing-owner consolidation once the native check failures are understood and required gates are satisfied.

Do we have a high-confidence way to reproduce the issue?

Current-main source shows repeated identical JPEG attempts and a repeated SRV lookup; the PR reports matching before/after regressions, but this read-only review executed no target code.

Is this the best way to solve the issue?

The change generally uses existing owners, preserves platform transport checks, and documents its deliberate simplifications; no definite introduced failure survived caller and history inspection.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 523e1d25370c.

Provenance checked

  • Android JPEG encoding keeps the original intent (022a422: The earlier loop revision ensured the final scaled size was attempted; this PR retains that attempt while stopping unchanged encodes.)
  • Android transcript serialization keeps the original intent (4b05d83: Managed media references must survive offline caching without persisting attachment bytes; the shared serializer retains that boundary and the existing legacy readers.)
  • Android Swarm pagination changes intended behavior with a stated reason (af44cb1: The original native progress feature used repeated passes over moving session offsets; the current maintainer explicitly accepts refresh-on-next-event behavior.)
  • Wear channel ownership changes intended behavior with a stated reason (88876f7: Attempt identities, staged bounds, and serialized retirement protect device work; this PR retains physical generations and FIFO writes while deliberately simplifying serialized startup claims.)
  • Wear peer registration changes intended behavior with a stated reason (87bb99d: The phone owns credential-free watch proxying; removal of registration generations explicitly accepts rediscovery after stale transport failures without transferring credentials.)
  • Linux discovery lifecycle keeps the original intent (b65a2d8: One discovery receiver owns the gateway snapshot; completion of its join handle now follows cleanup and replaces separate liveness and cleanup-generation state.)
  • Shared Apple chat RPCs keeps the original intent (6ab14c0: The shared application layer owns common RPC construction while platform adapters retain routing and dispatch fencing; the new methods continue that division.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduction and current main: Reviewed the merge-base-to-head hunks, rather than endpoint drift; fetched main retains the original native app implementations. (62b4cde0e40a)
  • Deliberately accepted tradeoffs: The maintainer-authored body and consolidation commit explicitly accept best-effort roster refresh, peer rediscovery, bounded channel reservation, single-completion ReplayKit callbacks, and removal of immediate runtime revalidation. (d7e5c8648d7b)
  • Wear review concern checked against production caller: The existing review comment assumes concurrent polling claims, but production requests pass through one awaiting bridge actor before reaching NodeRuntime.startWearRealtimeTalk; the removed concurrency test bypasses that serialization boundary. (apps/android/app/src/main/java/ai/openclaw/app/wear/WearProxyBridge.kt:99, 62b4cde0e40a)
  • Persisted cache compatibility: The replacement serializer preserves field ordering, required type emission, nullable defaults, and legacy readers; base64 and widget remain transient, and the Room test pins independent expected persisted JSON bytes, establishing a no-migration case. (apps/android/app/src/test/java/ai/openclaw/app/chat/RoomChatTranscriptCacheTest.kt:378, 62b4cde0e40a)
  • Capture cancellation settlement: Cancelled ReplayKit startup still awaits its completion, then awaits the matching stop before returning cancellation; sample admission and queued writer settlement remain intact. (apps/ios/Sources/Screen/ScreenRecordService.swift:132, 62b4cde0e40a)
  • Presentation contracts preserved: The app deployment floor is already iOS 26.2; removed availability branches are unreachable there, shared package support remains iOS 18, and Live Activity hydration still explicitly rejects idle and disconnected states. (apps/ios/project.yml:6, 62b4cde0e40a)

Likely related people:

  • Peter Steinberger: Raw commit 6ab14c0 adds apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatGatewayTransport.swift:7 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6ab14c04e1be; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatGatewayTransport.swift)
  • Vincent Koc: Raw commit 88876f7 adds apps/android/app/src/main/java/ai/openclaw/app/wear/WearRealtimeChannelRegistry.kt:126 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 88876f780b81; files: apps/android/app/src/main/java/ai/openclaw/app/wear/WearRealtimeChannelRegistry.kt)
  • Ayaan Zaidi: Raw commit 022a422 adds apps/android/app/src/main/java/ai/openclaw/app/node/JpegSizeLimiter.kt:30 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 022a422755b8; files: apps/android/app/src/main/java/ai/openclaw/app/node/JpegSizeLimiter.kt)

PR surface

Source -586, Tests +14. Total -572 across 56 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 43 397 983 -586
Tests 13 346 332 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 56 743 1315 -572

Labels

Label changes:

  • add P2: The Android efficiency fixes and native lifecycle consolidation have useful but limited user impact, with no established urgent regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: The Android efficiency fixes and native lifecycle consolidation have useful but limited user impact, with no established urgent regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 15, 2026, 8:42 AM ET / 12:42 UTC.

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.
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.
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.
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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 638cab2598

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +424 to +427
private fun markPeerFailed(peer: String) {
synchronized(peerLock) {
// A stale send may fail after a newer request refreshed the same watch.
// Remove only the registration that actually owned this transport attempt.
if (peers[peer.nodeId] == peer.generation) {
peers.remove(peer.nodeId)
missingPeers.add(peer.nodeId)
}
peers.remove(peer)
missingPeers.add(peer)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve refreshed Wear peers after stale send failures

When an event send suspends and a new request from the same watch calls rememberPeer, this unconditional removal can run afterward and delete that freshly confirmed peer. If capability discovery then returns empty—a valid transient result—the retry has no target and later events remain undelivered until another inbound request. Fresh evidence beyond the earlier channel-claim issue is that this revision removes both the per-registration generation check and the staleEventFailureDoesNotRemoveRefreshedPeer regression test; retain an identity/generation check before removing the peer.

AGENTS.md reference: AGENTS.md:L7-L8

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 7845ca0 into main Oct 15, 2026
103 of 105 checks passed
@steipete
steipete deleted the deslop/bundle-w5e-native-apps-20261015 branch October 15, 2026 14:53
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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: ios App: ios app: macos App: macos P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant