Repository navigation
refactor(native): deslop native state and lifecycle - #163372
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 4:05 AM ET / 08:05 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR removes redundant native state and lifecycle wrappers across Android, iOS, macOS, and shared chat while adapting existing tests to the surviving interfaces. Merge readiness✅ Ready for maintainer review Keep open: this is useful, distinct native cleanup that current main has not absorbed. The pinned diff introduces no concrete blocking defect, and the author has verified repository admin permission. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s native apps consume Gateway responses, notifications, and user actions to manage pairing, sessions, speech, and local process state. Shared chat code projects Gateway lifecycle events into native conversation state. flowchart TD
A[User actions and notifications] --> B[Native app state owners]
C[Gateway responses and events] --> B
B --> D[Route and lifecycle checks]
D --> E[Pairing and session state]
D --> F[Speech and process cleanup]
E --> G[Native chat presentation]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests -5, Other -131. Total -136 across 19 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep native decisions in their existing owners and remove forwarding layers while preserving observable outcomes and lifecycle guards. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes behavior-preserving cleanup rather than a reported defect; source inspection found no concrete introduced failure. Is this the best way to solve the issue? Yes: the inspected changes remove redundant distinctions and forwarding methods while preserving their callers’ existing conditions and effects. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dbb580aed3e7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Cumulative discovery coverage for the native sweep. Unread and partial entries remain unverified; no exhaustive clean claim is made. mobile production source inventory (over 200 lines)Android native sweep coverageNOT YET READ means not fully read; declaration/references inspection is not full coverage.
Bounded source reconnaissanceWhole-file coverage remains partial. Production Kotlin declaration/reference inventory started with NodeRuntime (10078 lines), ChatController (9293), ChatScreen (4907) and the dense app runtime/UI trees. MainViewModel was read completely after its forwarding API was identified. GatewaySession and SecurePrefs were partially read around aplead dead seams; they remain marked NOT YET READ. Preserved deliberate non-callsite contracts: networkMonitor starts monitoring in its initializer; Compose previews have tool discovery; Room database/entities and Serializable payload fields are generated contracts; Cloudflare native instrumentation is an active staged-capability gate. GatewayStoreMigration was introduced July6 and DeviceIdentity secure migration July18, so deleting either would exceed the July2026+ upgrade policy. Before edits git log --since=12.hours showed no changes to MainViewModel.kt or ClawTheme.kt. Parent checked open l29 overlap; only l297 core helper PR existed. No credentials, resource translations, persisted shapes, protocol or product behavior changed. Final Android diff: +2/-21 production lines, net -19. No tests changed or added. Remote/hosted native proof is lead-owned and pending. Follow-up on 88954a4NodeRuntime and ChatController were read in consecutive bounded chunks with untruncated output. Revalidated selected pairing/approval owner regions and callers on the new base. Twelve-hour file history returned no commits for NodeRuntime.kt and GatewayDevicePairingTest.kt before edits. Follow-up Android patch: NodeRuntime +11/-55 (net -44 production), GatewayDevicePairingTest +5/-10 (net -5 tests). The five existing canonical mutation-result cases are preserved with Boolean assertions. No new tests, dependencies, persisted formats, protocol or visible UI changes. Follow-up source-only candidate: session group rename/dissolve enumerate active and archived sessions and patch each member via unbound requestGateway calls; replacing a Gateway between awaited requests can choose a replacement socket. Existing captureRequestLease owns physical connection dispatch. Regression belongs in ChatControllerCommandControlsTest alongside renameSessionGroupPatchesEveryMemberIncludingArchivedOnlyOnes and dissolveSessionGroupClearsCategoriesBestEffort, using CompletableDeferred between enumeration/patches. Not reproduced, not included in the patch. l300 iOS production Swift coverageThis inventory records first-PR implementation and later read-only discovery while proof runs. Source size ~63.7k lines. Periphery configuration and CI entry point were read, but the available iOS scan artifact failed before producing findings. No local tests/builds/checks were run. READ denotes whole-file inspection; PARTIAL and NOT READ retain the remaining coverage gaps.
Read-only follow-up evidence
Follow-up implementationBranch
|
|
Cumulative discovery coverage for the native sweep. Unread and partial entries remain unverified; no exhaustive clean claim is made. macos production source inventory (over 200 lines)l300 macOS coverageCumulative reading coverage across the first patch (PR #163339) and follow-up branch. READ means the complete source was inspected; the first patch remains separately reviewed. Sizes below reflect the follow-up checkout. No checks/builds/tests were run locally; touched source files were formatted.
|
|
Cumulative discovery coverage for the native sweep. Unread and partial entries remain unverified; no exhaustive clean claim is made. shared production source inventory (over 200 lines)Shared chat sweep coverageScope: apps/shared/OpenClawKit/Sources/OpenClawChatUI. Sorted current production Swift files over 200 lines. This is an honest partial coverage log for the first PR; REFERENCE-SCANNED is not a full read. All Swift identifiers in apps/ were cross-referenced for zero-use declaration candidates. The only unique function names found were platform/framework callbacks. Historical macOS Periphery artifact the macOS Periphery artifact from run 36959763404 was reviewed; it is not an iOS intersection and its warnings are not deletion proof.
Additional complete reads below threshold: ChatModelPickerStore.swift, ChatViewModel+SidebarData.swift, ChatCaptureActivityViews.swift, ChatAttachmentPickerMetadata.swift, ChatPayloadDecoding.swift. Reviewed ChatGatewayTransportTests.swift in full and extended its existing protocol/authority boundary case. Proof requested from lead: shared Swift Read-only follow-up discovery: completed full bounded reads of the above largest chat files while the first patch is frozen. No repository changes made. The next concrete modest patch is lifecycle merge-result collapse plus redundant model-selection branches, guarded by existing ChatViewModelTests lifecycle recap/stale-snapshot and model bootstrap/default/provider-qualified cases. Production reduction remains unmeasured until implementation on a fresh branch. Follow-up implementation frozen on deslop/l300-dead-code-native-followup-20261002, base 88954a4: two production files, 28 additions / 47 deletions, net -19 production LOC; zero test changes. SwiftFormat changed neither file. No local test/check/build run. Existing tests retained: ChatViewModelTests remote lifecycle recap, stale lifecycle snapshot, bootstrap/default/provider-qualified model selection, serialized model mutations and stale-completion ownership; ChatCatalogProjectionTests catalog-to-selection cases. Fresh remote/hosted proof remains lead-owned. Shared Swift kit coverageHonest first-PR coverage, excluding the separately logged shared ChatUI subtree. Native build output is excluded. Periphery macOS artifact was inspected as a lead; iOS artifact failed before findings, so no cross-platform unused verdict is claimed.
|
…claw#163372) Remove redundant native state/lifecycle forwarding and result distinctions while retaining pairing verification, Gateway authority, APNs cleanup, session selection, and speech cancellation behavior. Production Swift/Kotlin is reduced by 130 lines. Existing behavioral tests keep their assertions and call the surviving owners directly. No protocol, schema, dependency, or rendered UI changes.
The cold-start tests introduced in 418f22b (#158954) still referenced setTestingLastFailureReason and the bundlePath argument. Those were intentionally removed by 6cc8e7f (#163372) and 669db5d (#160710). Use the same direct property writes and port-only calls as the sibling tests, preserving all assertions.
The cold-start tests introduced in bac884e (openclaw#158954) still referenced setTestingLastFailureReason and the bundlePath argument. Those were intentionally removed by 9c6018f (openclaw#163372) and 4e79f38 (openclaw#160710). Use the same direct property writes and port-only calls as the sibling tests, preserving all assertions.
What Problem This Solves
Native state and lifecycle code carried forwarding methods and result distinctions that none of its callers needed.
User Impact
No behavior or rendered UI change is intended. Pairing verification, Gateway authority, APNs cleanup, session selection, and speech cancellation keep their existing checks and outcomes.
Why This Change Was Made
Measured production diff: 93 added, 223 removed; 130 net lines removed. This independent follow-up does not duplicate the changes in #163339. Existing behavioral assertions remain; removed assertions only repeated retired aliases or constant return values.
Evidence
pnpm install --frozen-lockfilepassed;check-madge-import-cycles.tsreported 0 cycles andcheck-import-cycles.tsreported 0 runtime value cycles. Remote command phase: 77.6s, including installation and both checks.git diff --checkpassed.6cc8e7fa0fa1ed63634e4808a19bbe885a266a04. AWS focused Android pairing and approval suites passed: 36 tests, 0 failures, using the exact CI JDK archive and pinned Android SDK. Gradle wall time was 194.67s including compilation; the changed pairing test class took 0.012s. AndroidlintPlayDebugandktlintCheckalso passed in 128.66s, with no UnusedResources/UnusedIds entries in the generated report. Apple broker preflight remains unavailable, so no local native build/test was attempted.