Skip to content

refactor(android): deslop Android app second pass - #159154

Merged
steipete merged 1 commit into
mainfrom
deslop/l90-android-second-pass
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l90-android-second-pass

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Android retains redundant forwarding layers and repeated parsing, projection, and lifecycle code after the first cleanup pass.

Related: #158539. This second pass preserves that PR's changes.

User Impact

No intentional user-visible change. Gateway protocol and pairing/auth flows, permission requests and text, notification channels/IDs, preferences and database migrations, intents/deep links, rendered appearance, signing, and dependencies are preserved.

Why This Change Was Made

  • Remove 28 pure NodeRuntime forwarding methods and 33 flow aliases; MainViewModel consumes the existing ChatController while retaining lazy startup and stable UI flows. Runtime methods that own selection or lifecycle work stay in place.
  • Consolidate background-task RPC admission, outbox claim error handling, Wear control-operation cleanup, onboarding Back-state mapping, and picker construction through their existing owners. Preserve live-authority checks and operation ordering.
  • Reuse canonical JSON/session parsing, SQL LIKE escaping, DNS-label validation, SHA-256/hex primitives, realtime language fallback, and CommonMark sibling traversal.
  • Let camera and call-log records own their JSON encoding, preserving required fields, field order, and explicit nulls. Remove the one-field camera payload wrapper and test-only constructors/Play scaffolding.
  • Simplify duplicate UI projections, avatar loading, reader-state copies, and preference writes; remove unreachable state, unused projections, forwarding helpers, and narrating comments.

Measured reduction: 1,001 production lines, excluding tests and screenshot fixtures. Screenshot fixtures remove another 127 lines; test changes add 13 lines, mostly receiver migration/formatting. The generated native localization inventory removes two unreachable strings without changing active translations.

The full production subtree was read, including every file over 200 lines. No new tests or dependencies were added. The existing tests retain their observable assertions; test-only adapters and duplicate helper expectations were removed.

Evidence

Blacksmith Testbox proof used the repository wrapper and verified hashes of all changed Android files before execution. Provider: blacksmith-testbox; lease: tbx_01m3fdxrye30adn4jmb8ws76rz.

  • Debug builds passed for Play, third-party, Wear, Wear-shared, and benchmark (207 seconds).
  • All 7,511 unit tests passed with zero failures/errors/skips: Play 3,517; third-party 3,650; Wear 331; Wear-shared 13 (451 seconds including test compilation).
  • The five requested import-boundary selections and their runner prerequisite passed (15 seconds), including src/infra/fs-safe-import-boundary.test.ts.
  • Native localization regeneration/verification and changed-file checks passed (changed checks: 27 seconds).
  • Independent Codex review completed; candidate findings were checked against the pinned library API and actual callers, with no accepted findings remaining.

After retaining the toolchain-required API-33 guard, the final candidate passed both phone assemblies and both instrumentation-test Kotlin compilations (36 seconds), 40 notification/routing tests per phone flavor (11 seconds each; 80 total), both phone framework-lint variants plus Kotlin lint (179 seconds), native localization verification, and changed-file checks (22 seconds). Wear framework lint was green in the full pass above. All builds/tests/lint ran on Testbox; no local fallback was used.

Validation caught a Kotlin compiler limitation in an unused default suspend callback; the final API requires the existing store-owner callback, which both production callers already supplied. Framework lint also requires the local API-33 guard around POST_NOTIFICATIONS; that guard is retained with its reason documented.

Exact-head hosted CI run 36269262420 passed for 38025041fddadd789b14ab103ecbd8e43f1209ef, including both 4 KB and 16 KB Android native checks, security, native localization, type/boundary checks, and openclaw/ci-gate. ClawSweeper completed its review of that head with no actionable findings.

CI Android task-step wall time (including each step's compilation/lint work):

Step Wall time
android-test-third-party 369 s
android-test-wear 360 s
android-ktlint 272 s
android-test-play 386 s
Remote Gradle and boundary commands
pnpm install --frozen-lockfile
pnpm native:i18n:baseline
pnpm native:i18n:verify
cd apps/android
./gradlew --no-daemon :app:assemblePlayDebug :app:assembleThirdPartyDebug :wear:assembleDebug :wear-shared:assembleDebug :benchmark:assembleDebug
./gradlew --no-daemon --continue :app:testPlayDebugUnitTest :app:testThirdPartyDebugUnitTest :wear:testDebugUnitTest :wear-shared:testDebugUnitTest
./gradlew --no-daemon --continue :app:lintPlayDebug :app:lintThirdPartyDebug :wear:lintDebug :wear-shared:lintDebug :app:ktlintCheck :benchmark:ktlintCheck :wear:ktlintCheck :wear-shared:ktlintCheck
cd ../..
node scripts/run-vitest.mjs src/infra/fs-safe-import-boundary.test.ts test/plugin-extension-import-boundary.test.ts test/control-ui-import-boundary.test.ts test/test-helper-extension-import-boundary.test.ts test/scripts/extension-import-boundary-checker.test.ts
node scripts/check-changed.mjs --base d9a52238b3813acc7a340dd47539c41ca1dffe2b

Final guard verification additionally ran:

cd apps/android
./gradlew --no-daemon :app:assemblePlayDebug :app:assembleThirdPartyDebug :app:compilePlayDebugAndroidTestKotlin :app:compileThirdPartyDebugAndroidTestKotlin
./gradlew --no-daemon :app:testPlayDebugUnitTest --tests ai.openclaw.app.ConversationNotificationsTest --tests ai.openclaw.app.ConversationNotificationRoutingTest
./gradlew --no-daemon :app:testThirdPartyDebugUnitTest --tests ai.openclaw.app.ConversationNotificationsTest --tests ai.openclaw.app.ConversationNotificationRoutingTest

The Android invocations use one explicit build commit/timestamp per proof run. Existing tests were migrated without adding cases; the full-suite and final focused timings above measure their validation cost.

@clawsweeper

clawsweeper Bot commented Sep 26, 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.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 4:53 PM ET / 20:53 UTC (Revision 3).

ClawSweeper review

What this changes

The branch simplifies Android phone and Wear code by removing forwarding layers and consolidating chat, Gateway, device, and UI helpers.

Merge readiness

✅ Ready for maintainer review

Keep open. The merged first Android cleanup does not cover this distinct follow-up, and current main still contains forwarding layers the branch removes. The pinned merge is clean, exact-head checks passed, and this review found no concrete introduced defect.

Priority: P3
Reviewed head: 38025041fddadd789b14ab103ecbd8e43f1209ef

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a coherent owner-level cleanup and broad exact-head validation, with no actionable defect identified.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, behavior-preserving Android and Wear refactor is exempt from contributor after-fix proof. The supplied Testbox and exact-head CI evidence covers builds, unit tests, lint, and native checks, but contains no live phone or Wear Gateway trace. The inspected preference and credential key shapes remain equivalent, with no stored-data contract change requiring migration proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, behavior-preserving Android and Wear refactor is exempt from contributor after-fix proof. The supplied Testbox and exact-head CI evidence covers builds, unit tests, lint, and native checks, but contains no live phone or Wear Gateway trace. The inspected preference and credential key shapes remain equivalent, with no stored-data contract change requiring migration proof.
Evidence reviewed 7 items Introduced owner cutover: The PR head exposes the existing chat controller through the runtime, and the view model reads its session state and calls its refresh operation directly.
Current main still has the intermediate layer: The fetched main revision retains the private chat controller and a forwarding chat-session flow, so the central cleanup is not already on main.
Credential storage format: The new shared key suffix retains the prior trimmed gateway ID, lowercase device ID, normalized role, and token-versus-metadata prefixes.
Findings None None.
Security None None.

How this fits together

The Android phone and Wear clients receive Gateway sessions and events, then route chat and device actions to their controllers and screens. This change reduces intermediate code along those paths.

flowchart LR
  Gateway[Gateway sessions and events] --> Runtime[Android runtime]
  Preferences[Credentials and preferences] --> Runtime
  Runtime --> Chat[Chat controller]
  Chat --> Phone[Phone chat and settings]
  Runtime --> Device[Phone device actions]
  Runtime --> Wear[Wear controls]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +13, Other -1130. Total -1117 across 72 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 12 227 214 +13
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 60 1104 2234 -1130
Total 72 1331 2448 -1117

Review metrics

Metric Value Why it matters
Production and test footprint production −1,001 lines; tests +13 lines; screenshot fixture −127 lines The measured runtime reduction is the main value of this behavior-preserving cleanup.

Technical review

Best possible solution:

Keep chat state with its controller and preserve credential, preference, and Gateway contracts while completing normal Android review.

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

Not applicable: this PR reports duplicated implementation, not a failing user flow; the redundant forwarding paths are visible in current-main source.

Is this the best way to solve the issue?

Yes: routing callers to the existing chat controller removes duplicate ownership without adding a new subsystem; the inspected credential and session checks retain their prior contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 19c6ef8d9e02.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is maintenance cleanup with no reported user-facing regression or new capability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, behavior-preserving Android and Wear refactor is exempt from contributor after-fix proof. The supplied Testbox and exact-head CI evidence covers builds, unit tests, lint, and native checks, but contains no live phone or Wear Gateway trace. The inspected preference and credential key shapes remain equivalent, with no stored-data contract change requiring migration proof.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Avant: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-26T20:16:37.984Z sha 3802504 :: needs changes before merge. :: none
  • reviewed 2026-09-26T20:27:36.568Z sha 3802504 :: needs maintainer review before merge. :: none

@steipete
steipete marked this pull request as ready for review September 26, 2026 20:21
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 38025041fddadd789b14ab103ecbd8e43f1209ef
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • apps/android/app/src/main/java/ai/openclaw/app/gateway/DeviceAuthStore.kt: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • apps/android/app/src/main/java/ai/openclaw/app/SecurePrefs.kt: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@steipete
steipete merged commit 8e77ea0 into main Sep 26, 2026
152 of 153 checks passed
@steipete
steipete deleted the deslop/l90-android-second-pass branch September 26, 2026 21:10
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed 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