Repository navigation
fix(android): restore sticky node service - #104226
Conversation
146bb6a to
25b2fd8
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 7:43 AM ET / 11:43 UTC. Summary PR surface: Other +257. Total +257 across 5 files. Reproducibility: yes. at high confidence from current-main source: a fresh-process sticky restart has no process runtime and the service stops itself. This review did not run the path on an emulator or physical device. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Keep the focused single-runtime lifecycle design and merge only after redacted real Android restart proof or an explicit Android-owner waiver of that proof gate. Do we have a high-confidence way to reproduce the issue? Yes at high confidence from current-main source: a fresh-process sticky restart has no process runtime and the service stops itself. This review did not run the path on an emulator or physical device. Is this the best way to solve the issue? Yes. The patch repairs the canonical service/singleton boundary, performs expensive construction off-main, preserves Activity foreground adoption, and avoids adding a fallback or duplicate runtime path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1d84acf2c35b. Label changesLabel justifications:
Evidence reviewedPR surface: Other +257. Total +257 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (5 earlier review cycles)
|
25b2fd8 to
9b1c718
Compare
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
5e1e4f1 to
8f00b83
Compare
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where Android declared the node foreground service
START_STICKY, but a process-death restart always stopped becauseonCreate()only accepted an already-existing process-localNodeRuntime. The OS restart therefore could not restore the node connection it was intended to keep alive.Why This Change Was Made
onCreate()now establishes foreground notification state only. Every non-STOPonStartCommand()(including Android's null-intent sticky restart) starts one off-main recovery and atomically publishes a background-safe runtime. Ownership transfers to the service only after activation; cancellation, STOP, or activation failure disconnects an unowned runtime.A cold STOP never constructs a runtime. STOP also uses a process-owned disconnect fallback so an Activity-created or concurrently constructing runtime is not stranded after the service scope ends. Newer start IDs are stopped again after a STOP so a queued start cannot leave a disconnected foreground service alive.
Cold recovery initializes
NodeRuntimeas background before publication and clears persisted microphone capture instead of briefly reviving foreground-only capabilities without an Activity.User Impact
When Android recreates the sticky foreground service in a fresh process, OpenClaw can reconstruct the node runtime and resume its normal Gateway reconnect loop. Explicit STOP remains terminal and does not create or leak a runtime.
Evidence
AI-assisted change. I reviewed the service/process ownership races and background capability boundary.
Focused Robolectric coverage verifies:
stopSelfResultagain;Final local verification used both Android product flavors (Testbox unavailable for this contributor):
The repository native-i18n generator was also run and this PR commits the Android inventory line shifts caused by the service/runtime changes. The current base independently has two uncommitted
MenuBar.swiftinventory line shifts (321 -> 322); a non-Android branch reproduces that same remainingnative:i18n:checkfailure, so this PR does not duplicate the unrelated macOS baseline update.No physical-device process-kill test was run; the proof is deterministic service/runtime lifecycle coverage under Robolectric.
Agent Transcript
Redacted Codex session transcript: Android sticky service recovery