Skip to content

refactor(android): unify runtime, chat, and voice ownership - #136934

Merged
steipete merged 1 commit into
mainfrom
codex/android-whole-app-cleanup-20260902
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/android-whole-app-cleanup-20260902

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Related: #112901 (iOS native Talk thinking inheritance). Integrated with #135934.

What Problem This Solves

Android could show empty counts after a failed first settings load, reconnect after the user stopped it, or recognize native Talk speech without sending it. A chat watchdog could also cancel its own coroutine before recording an unresolved send.

This is a broad cleanup of chat, process/service lifetime, settings summaries, and voice—not a rewrite of every app component.

Why This Change Was Made

Use the existing Room outbox, application runtime, loaded-or-unknown summary, and listening coroutine as the respective owners. Delete competing paths and unused projections.

  • Chat: require the branch-aware Room outbox and remove the journal-less mode and duplicate fake policy. Persist unresolved input before clearing the pending run cancels its watchdog. Screenshot fixtures use isolated in-memory Room, never operator databases.
  • Connections: the application owns runtime lifetime; the foreground service observes it. Pending actions retain admission checks through suspension and TLS, while established connections have their own identity. Stop fences queued work and late promotion. Repeated Resume, same-Gateway navigation, and inactive-Gateway removal retain the established connection. Already-admitted Forget preserves its staged removal contract.
  • Settings: unknown is not loaded-empty. First-load errors remain visible; refresh failures preserve successful values and only the newest request publishes.
  • Talk: the listening coroutine owns native silence detection, finalization, and restart. Muting cancels reply audio without canceling capture; Stop and push-to-talk takeover retire the old turn. Config invalidation rejects stale in-flight loads and reloads on next use without stopping capture. Native Talk inherits session thinking instead of forcing low, matching iOS fix(ios): native Talk respects session thinking level #112901 and macOS.

The rebase preserves #135934's recognizer/audio retirement, scoped callbacks, relay admission, physical playout, and transcript-only history/run-snapshot ownership. No replacement compatibility path was added. Compact composer/model controls and six-line drafts remain covered.

No SQLite schema, live database path, migration, protocol, dependency, or configuration-surface changes. Android Talk settings reload is improved; Gateway server restart policy is unchanged.

Handwritten production: +813 / −1,028 = −215 lines. Tests/support: +1,825 / −715 = +1,110. Docs: +4 / −3. Generated native inventory: +3 / −3, source-site references only; translation IDs and strings unchanged.

User Impact

Disconnect remains stopped until intentional reconnect. Native Talk sends recognized phrases and preserves capture ownership. Settings no longer present failed first loads as healthy empty data. Durable chat keeps its existing Room-backed recovery contract.

Evidence

Original failing reproductions use e7951df4578ba3eb5833ea60659799fdfe68616a. Current head is bdd81178af67e7d7e28d0bbf5b3b4f81c53bbe2d, integrated against 3100ba535f1d003d67a6a7536deacf8666367b38.

  • Original RED/GREEN checkpoints cover watchdog persistence, screenshot database isolation, connection ownership, first-load settings failure, and Talk finalization/config invalidation.
  • The original baseline APK receives the synthetic recognition callback but sends nothing. An early candidate exposed unsupported forced thinking; that run is retained as partial, not success.
  • The rebased source-bound APK passed native text and Talk with exact scripted replies, true-cold Channels failure/recovery, both Disconnect paths (app and notification), same-process hot reopen/rotation, explicit reconnect, and a subsequent message. Each send adds exactly one user/assistant pair; previous canonical messages remain unchanged and no run remains active.
  • The first rebased full suite stalled in a test fixture that awaited real IO retirement without driving its test dispatcher. The fixture now drives the scheduler and Android looper to a bounded completion condition and waits for physical retirement before inspecting the replacement. No production workaround or timeout increase. Talk 101/101 and ktlint passed after correction; four completed chat suites passed 180/180 during the interrupted run.
  • Fresh managed independent Codex P0–P2 review: both passes scoped-clean; no accepted/actionable findings.
  • Native source inventory verification passes. The broader locale-artifact checker reproduces 63 pre-existing errors across 21 unchanged locale files (two retired Android IDs and one missing Apple ID). This source-only change does not require generated-locale parity; the existing Native App Locale Refresh workflow owns the baseline drift.

Final exact-head proof: 2,707 Play + 2,838 third-party phone tests, 164 Wear + 10 shared tests = 5,719 passed, all freshly executed with zero failures/errors/skips. Both phone APKs, both phone lint lanes, and app/Wear/shared/benchmark ktlint passed. Source hashes remained unchanged.

The final APK is stamped to bdd81178af67e7d7e28d0bbf5b3b4f81c53bbe2d, build time 2026-09-03T04:51:42.033Z, SHA-256 441ea57430c9d0715fe7b47d1ab9b082487e3e468a96f73cf3c7297ca3ec3cf7. Normal install retained app data. Native text, native Talk, true-cold Channels failure/recovery, both Disconnect paths, same-PID hot reopen/rotation, explicit reconnect, and post-reconnect Send passed. Three sends each produced one exact reply; all prior canonical history remained byte-for-byte preserved (28→34 messages), with no active run. A frozen ledger binds 74 artifacts and 11 lifecycle observations to this APK. This verifies canonical Gateway history, not direct Room rows.

Exact-head CI is green, including all six Android jobs and openclaw/ci-gate. The first run failed only an unchanged web placement-restart test waiting for a lazy-loaded dialog. An unchanged local replay passed 14/14 tests; one unchanged hosted failed-job rerun passed. The test's one-second wait includes cold lazy imports; timing is an evidence-supported inference, not a proven failure cause. No assertion, timeout, or production change was made to get green.

Native testing uses a task-owned API 36 emulator, real Android Binder/SpeechRecognizer with a fixed synthetic recognition result, a real isolated Gateway pinned to 36eb0c1ec3fc1f2ee26152d238be6374b14df41b, and scripted loopback inference. It does not establish physical microphone capture, ASR quality, external-provider inference, or audible playback.

ClawSweeper's latest exact-head pre-merge and Rank-up requests are addressed: packaged text/reconnect/Talk evidence and APK/source binding are attached below, fresh independent review is clean, and exact-head CI is green. Temporary test permissions/configuration were restored and owned test services stopped.

Named follow-ups: web placement-dialog readiness should join lazy imports before its existing DOM wait (separate from the Android change); audit secondary-Gateway fleet snapshot invalidation (no defect claimed here); correct the pre-existing Gateway settings label that says “Not paired” for a disconnected but still paired node (observed in native testing, not changed in this PR).

Packaged screenshots

Same API 36 emulator at 320 dp, font scale 1.0. The cold-start scenario faults the first three real channels.status responses before any success reaches the app. All captures were inspected in full and contain only synthetic test data.

Before: failed load invents zeros and an empty result After: failed load stays unknown
Baseline failed first Channels load Exact-head first Channels load failure

Exact-head recovery after ordinary Refresh shows real loaded-empty data only after a successful response.

Native Talk completed on the exact-head APK

Synthetic speech crosses Android Binder/SpeechRecognizer, sends once, receives the scripted reply, and resumes listening; the test then stops Talk through the normal UI.

Exact-head native Talk result

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: android App: android size: XL maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 1:01 AM ET / 05:01 UTC.

ClawSweeper review

What this changes

The branch consolidates Android gateway runtime ownership, makes pending chat sends durable, distinguishes unloaded settings from empty results, and places Talk capture and finalization under one lifecycle owner.

Merge readiness

⛔ Blocked before merge - 2 items remain

No actionable introduced correctness defect was found, but the maintainer-authored Android refactor remains open pending its stated packaged Android replay evidence and exact-head CI.

Priority: P2
Reviewed head: bdd81178af67e7d7e28d0bbf5b3b4f81c53bbe2d

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The owner-bound implementation and focused regressions are solid, while final packaged Android behavior has not yet been attached.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR, but its stated final packaged Android replays and APK/source binding remain required by repository live-verify policy.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR, but its stated final packaged Android replays and APK/source binding remain required by repository live-verify policy.
Evidence reviewed 7 items Process lifecycle ownership: Service-start intent is replaced atomically and the returned identity claim prevents delayed cleanup from disconnecting a resumed runtime.
Durable send boundary: Chat input is journaled before the composer clears or network dispatch begins; durable rows own recovery and FIFO delivery across process interruption.
Talk lifecycle and policy: One listening turn finalizes, waits for reply/playback, and restarts only while enabled; the chat request no longer sends a hard-coded thinking level.
Findings None None.
Security None None.

How this fits together

The Android app’s application runtime owns gateway connections, Room-backed chat recovery, settings summaries, and Talk capture. The foreground service observes that runtime while the UI and notifications show connection and conversation results.

flowchart LR
A[Android UI and notifications] --> B[Application runtime]
B --> C[Gateway connections]
B --> D[Room chat outbox]
B --> E[Settings summaries]
B --> F[Talk capture]
C --> G[Foreground service and UI status]
D --> G
E --> G
F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Final packaged Android text-chat/reconnect and native Talk reply, history, and listening-restart behavior remain unobserved; the supplied context also shows exact-head CI incomplete.
  • Complete next step (P2) - Attach redacted final packaged Android text-chat/reconnect and native Talk reply, history, and listening-restart evidence with APK/source binding before merge.
Agent review details

Security

None.

PR surface

Tests +1110, Docs +1, Other -215. Total +896 across 50 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 31 1825 715 +1110
Docs 1 4 3 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 18 816 1031 -215
Total 50 2645 1749 +896

Review metrics

Metric Value Why it matters
Production vs test LOC production +813/-1028; tests +1825/-715 Net production reduction accompanies behavior-focused Room, lifecycle, and Talk regressions.

Merge-risk options

Maintainer options:

  1. Complete packaged Android proof (recommended)
    Attach redacted text-chat/reconnect and native Talk reply, history, and listening-restart replays tied to the reviewed APK and source before merge.
  2. Pause for proof
    Keep the PR open if final package-level replay cannot be produced, because lifecycle and recovery behavior remains unobserved on the shipped surface.

Technical review

Best possible solution:

Attach redacted packaged Android replays for text chat/reconnect and native Talk with APK/source binding, confirm exact-head CI, then merge the unified ownership model.

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

Yes for focused source and boundary paths; this read-only review did not execute Android tests or packaged APKs.

Is this the best way to solve the issue?

Yes; the canonical application runtime, Room outbox, nullable loading state, and single listening owner remove the competing ownership paths.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦞 diamond lobster.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is a broad Android behavior repair with no demonstrated urgent outage.
  • merge-risk: 🚨 session-state: The PR changes durable Room-backed chat-outbox recovery and branch coordination for queued sends.
  • merge-risk: 🚨 availability: The PR changes process connection, service observation, and Talk lifecycle sequencing.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this maintainer-authored PR, but its stated final packaged Android replays and APK/source binding remain required by repository live-verify policy.

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)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted packaged text-chat/reconnect and native Talk replay evidence tied to the reviewed APK and source.

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 (1 earlier review cycle)
  • reviewed 2026-09-03T03:30:48.244Z sha 2db5dcf :: blocked before merge. :: none

Keep service observation separate from process connection ownership; fence retired requests without retiring established connections. Require canonical Room chat storage and persist unresolved sends before watchdog cancellation. Distinguish unknown settings summaries from loaded-empty results. Keep native Talk capture, finalization, and config reload under their lifecycle owners, and inherit session thinking policy.

Validation: 5,407 phone tests and 174 Wear/shared tests; both phone APKs and Android lint/ktlint; native source i18n verification; independent P2 review. Native packaged flow evidence follows in the PR.
@steipete
steipete force-pushed the codex/android-whole-app-cleanup-20260902 branch from 2db5dcf to bdd8117 Compare September 3, 2026 04:51
@steipete steipete self-assigned this Sep 3, 2026
@steipete
steipete merged commit 6031d67 into main Sep 3, 2026
286 of 288 checks passed
@steipete
steipete deleted the codex/android-whole-app-cleanup-20260902 branch September 3, 2026 05:33
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 3, 2026
Wait for lazy dialog modules before starting DOM readiness polling. Gate
subprocess timeout fixtures on native readiness and exit events while keeping
their original timeout, signal, pipe-drain, and ownership assertions.

Reproduced four dialog failures with delayed real imports and two subprocess
failures with delayed child startup; all six pass after synchronization.
Normal caller/owner coverage: 672 tests passed, one platform skip. Changed
gates and an independent Codex P0-P2 review passed. No production changes.

Related: #136934
Fixes #136708
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
…#136934)

Keep service observation separate from process connection ownership; fence retired requests without retiring established connections. Require canonical Room chat storage and persist unresolved sends before watchdog cancellation. Distinguish unknown settings summaries from loaded-empty results. Keep native Talk capture, finalization, and config reload under their lifecycle owners, and inherit session thinking policy.

Validation: 5,407 phone tests and 174 Wear/shared tests; both phone APKs and Android lint/ktlint; native source i18n verification; independent P2 review. Native packaged flow evidence follows in the PR.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
)

Wait for lazy dialog modules before starting DOM readiness polling. Gate
subprocess timeout fixtures on native readiness and exit events while keeping
their original timeout, signal, pipe-drain, and ownership assertions.

Reproduced four dialog failures with delayed real imports and two subprocess
failures with delayed child startup; all six pass after synchronization.
Normal caller/owner coverage: 672 tests passed, one platform skip. Changed
gates and an independent Codex P0-P2 review passed. No production changes.

Related: openclaw#136934
Fixes openclaw#136708
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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