Skip to content

refactor(apps): simplify native lifecycle and read paths - #169336

Merged
steipete merged 2 commits into
mainfrom
deslop/w10-apps-native-20261011
Oct 11, 2026
Merged

steipete merged 2 commits into
mainfrom
deslop/w10-apps-native-20261011

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Simplifies native app lifecycle and read paths that carried duplicate state, synthetic-race guards, or parallel implementations after several recent native cleanup passes.

User Impact

Normal connection, Talk, media, sidebar, and sleep/wake flows remain supported. Listings, copied transcripts, and presentation-only settings now explicitly use best-effort behavior during concurrent changes. Security checks, transcript flushing, bounded resource protections, and ordinary reconnect behavior remain in place. No schema, dependency, protocol, or persisted-data changes.

Why This Change Was Made

The native clients had more coordination machinery than these read/presentation paths need. This removes redundant generation state and snapshot protocols, uses Compose's maintained drag detector, and gives iOS/macOS media-result handling one shared owner while retaining their separate authorization/TLS adapters.

Net production reduction: 502 release-code lines, excluding test files, embedded Rust test modules, and Swift DEBUG-only test support. File-based production accounting is 537 lines before removing those 35 debug-support lines. This is the campaign's 500–999-line closeout after a recent-additions and largest-owner audit; the coverage ledger is below. Test-only deletion is not counted as production reduction.

Best-effort tradeoffs accepted

Evidence

  • Android: Play debug APK and app ktlint passed; 276 tests in nine suites passed, zero failures/errors/skips. Final run 3m8s. The initially suspected node-event failure was an intentional transport-completion contract; that exploratory change was fully discarded and its existing test preserved.
  • Shared Swift: product and complete test bundle compiled. 65 tests in three suites passed in 7.486s under an environment-scrubbed OS sandbox that denies operator files, network sockets, Keychain/preferences services, and desktop launches. A narrowly allowed read-only UTI database service resolved two environment-only attachment-test failures without source/test changes.
  • macOS: app and complete test bundle compiled. Four focused runtime tests / five cases passed in 1.125s under the strict OS sandbox, covering cold-start budgets, repair ownership, and failed Talk configuration bootstrap. The Talk test now uses existing injected audio doubles during cleanup rather than live audio services; every assertion is retained. Full unsandboxed app suites were not run on the operator desktop.
  • Linux native backend: pinned native build passed on macOS; 11 sleep-owner tests passed. The exact-head Linux companion workflow also passed its Linux build/tests and macOS/Windows companion jobs.
  • iOS: full simulator app and test bundle built; 105 selected tests passed (93 Swift Testing and 12 XCTest), zero failures. Build-discovered formatting, optional-binding, and retained-test-helper issues were fixed before this run.
  • Runtime import cycles: 0. Madge cycles: 0. Lint-suppression suite: 3 passed. Native schema-version guard passed. Final independent review found no actionable P0–P2 issues.
  • check-changed completed with eight unrelated 20-second verifier subprocess timeouts in mac-elevation-artifact.test.ts; 122 tests in its first macOS group and 490 tests in its second group passed. The installer, test, fixtures, and helpers are byte-identical to current main. All eight failed cases passed unchanged in two focused runs with the original timeout/concurrency. This is evidence of contention-sensitive fixtures, not a claimed fix or a hosted main-red exception. The remaining macOS tooling group passed all eight shards separately. Exact-head hosted CI remains the landing gate.

The production commit e8542cf259ebc5a4fac5cfa15be2329a32aac45b passed CI run https://github.com/openclaw/openclaw/actions/runs/38171772163. Follow-up d8f289ae1684fbe0608a28d86318022f1436bae3 only isolates the existing Talk test's audio cleanup; its fresh independent review and sandbox runtime test passed. Its exact-head CI also passed: https://github.com/openclaw/openclaw/actions/runs/38175075478. All 59 active checks completed successfully, including the separate Apple scans.

Merged as 0e998aa0985cc1da088a05a7afe4f12d31faf0f2. Post-merge fetch verified ancestry on origin/main and identical contents to the reviewed head for all changed files. No admin CI exception, CI rerun, or rebase was used.

  • No visual layout or styling changes. Gesture handling is covered by the retained Android fold/reorder/pin tests.

Coverage ledger

Area inspected Removed/consolidated Deliberately retained
Android NodeRuntime, ChatController, Talk, sidebar, wear, storage Cron snapshot retry; Talk fetch fence; custom layout/drag state Durable send queues, FIFO permission writes, ordinary reaction/session concurrency, recorder release, auth/effect checks
iOS NodeAppModel, connection/ingress, Talk, cron Talk cleanup/presentation/prefetch duplication, shared synthesis, cron snapshot identity Browser/account revocation, real recognition/transport generations, transcript drain, current audio-engine fixes
Shared Swift sidebar, media, gateway/realtime owners Catalog revisions; export tail recheck; common media decoder/dispatcher Socket identity, network-path recovery, message/durable outbox state, bounded media/TLS policies, query generations for real typing/session switches
macOS startup/update, migration, onboarding, Talk, media Readiness renewals; duplicate config application/counter; common media owner Human-reported cold-start and relocation behavior, service authority and rollback, credential wizard scopes, child-process settlement
Linux runtime, windows/browser, updater, discovery, sleep Sleep-generation/abandonment custody Verified executable installation, browser-principal boundaries, subprocess cleanup, network-edge validation, logind driver cleanup

Follow-up requiring separate dependency/CI approval: Android's dormant Cloudflare Access foundation (~878 production lines, #147061/#147305) has no active app caller. It is untouched here; removing only part would leave an incomplete cutover.

Remove speculative snapshot and lifecycle coordination, preserve security and durable write boundaries, and consolidate Apple media loading. Accept best-effort presentation, pagination, and cleanup races documented in the lane review.
@clawsweeper

clawsweeper Bot commented Oct 11, 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 11, 2026 20:20
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR simplifies native startup, Talk, pagination, sidebar gestures, and sleep coordination while sharing Apple media decoding.

Example: Android loads 201 cron jobs while the snapshot revision changes between offsets 0 and 200.

  • Before: The client discards the collected pages and restarts the listing.
  • After: The client displays the combined, deduplicated pages; a later refresh picks up concurrent omissions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Source and focused harness coverage support the simplification, with accepted tradeoffs and no actionable finding; current shipped-entry-point evidence is limited.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR. Supplied verification is build and harness evidence; inspected images show historical channel-loading behavior, and historical QR video preparation failed with ffprobe ENOENT, so neither establishes current native runtime behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The existing feature owner explicitly chooses simpler coordination, documents the resulting edge cases, and removes duplicate implementation paths.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. The maintainer-directed simplification has clear maintenance value, and inspection found no actionable introduced defect.

Priority: P3
Reviewed head: d8f289ae1684fbe0608a28d86318022f1436bae3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Reported verification exercises native test harnesses; supplied evidence does not show this refactor running through a shipped native application.
Agent review details

How this fits together

The native clients translate user interactions and operating-system lifecycle events into Gateway requests, then present returned sessions, media, configuration, and readiness state.

flowchart LR
  A[User and operating system] --> B[Native lifecycle owners]
  B --> C[Platform authorization and transport]
  C --> D[Gateway]
  D --> E[Shared decoding and read models]
  E --> F[Native presentation]
Loading

Technical review

Best possible solution:

Retain the simpler native owners, documented best-effort tradeoffs, and existing authorization and durable-write boundaries.

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

This is an intentional refactor rather than a defect report; source inspection confirms the changed behaviors, and no target code was executed.

Is this the best way to solve the issue?

The approach follows repository guidance by replacing speculative coordination with documented best-effort behavior and consolidating decoding without merging platform transport responsibilities.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • macOS startup readiness changes intended behavior with a stated reason (418f22b: Prevent repeated reinstalls during genuine slow cold starts while re-proving process identity at short deadlines.)
  • macOS Talk configuration and reconfiguration changes intended behavior with a stated reason (000db97: Fence stale relay and native-fallback configuration against lifecycle changes; the PR documents accepting stale configuration reads while retaining session-effect checks.)
  • iOS logical voice-session close changes intended behavior with a stated reason (da534dc: Retry failed closes to avoid orphaned bookkeeping and delayed mutation digests until stale recovery.)
  • Linux sleep-cycle generations and abandonment changes intended behavior with a stated reason (4dcf238: Retire terminal listeners without leaking driver ownership or disturbing later cycles; the PR retains driver cleanup and explicitly narrows controller concurrency guarantees.)
  • Mobile cron snapshot consistency changes intended behavior with a stated reason (967bd8a: Reject inconsistent paginated snapshots; the PR deliberately chooses deduplicated best-effort listings with existing limits.)
  • Android Talk configuration reads changes intended behavior with a stated reason (6031d67: Prevent invalidated in-flight responses from becoming current cached configuration.)
  • Android sidebar drag handling changes intended behavior with a stated reason (fd5c985: Retire held gestures when fold layout moves their viewport; the PR explicitly accepts that recoverable gesture edge case and adopts Compose's detector.)
  • Shared catalog and transcript-copy reads changes intended behavior with a stated reason (3a46908: Catalog revisions preserved displayed windows across overlapping reads and mutations; transcript-copy history separately guarded snapshot drift in 79e5273. Both now intentionally use best-effort reads.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit a1615cd adds apps/linux/src-tauri/src/gateway_sleep.rs:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a1615cdfcf4d; files: apps/linux/src-tauri/src/gateway_sleep.rs)
  • Vincent Koc: Raw commit 3731db2 adds apps/linux/src-tauri/src/gateway_sleep.rs:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3731db2cee04; files: apps/linux/src-tauri/src/gateway_sleep.rs)

PR surface

Source -711, Tests -608. Total -1319 across 32 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 21 334 1045 -711
Tests 11 134 742 -608
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 32 468 1787 -1319

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is deliberate native-client maintenance rather than an urgent reported regression.
  • merge-risk: 🚨 availability: Startup can wait longer after process loss, and failed Talk close can await stale recovery; the maintainer explicitly accepts these availability tradeoffs.
  • 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-11T20:26:21.485Z sha e8542cf :: needs maintainer review before merge. :: none

Reviewed October 11, 2026, 5:15 PM ET / 21:15 UTC (Revision 2).

Use the existing runtime dependency injection in the bootstrap-failure fixture so config validation does not initialize live audio players during cleanup. Preserve all behavior assertions.
@steipete
steipete enabled auto-merge (squash) October 11, 2026 21:42
@steipete
steipete merged commit 0e998aa into main Oct 11, 2026
96 checks passed
@steipete
steipete deleted the deslop/w10-apps-native-20261011 branch October 11, 2026 21:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…9336)

* refactor(apps): simplify native lifecycle and read paths

Remove speculative snapshot and lifecycle coordination, preserve security and durable write boundaries, and consolidate Apple media loading. Accept best-effort presentation, pagination, and cleanup races documented in the lane review.

* test(macos): isolate Talk config cleanup from audio services

Use the existing runtime dependency injection in the bootstrap-failure fixture so config validation does not initialize live audio players during cleanup. Preserve all behavior assertions.
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: linux app: macos App: macos merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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