feat(android): adopt device chat session on connect#101927
Conversation
|
Ready for review. The PR body includes the passing GitHub Actions run, Android emulator media artifact, and captured sessions.create payload. @clawsweeper review-pr |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs real behavior proof before merge. Reviewed July 12, 2026, 3:44 AM ET / 07:44 UTC. Summary PR surface: Docs +2, Other +533. Total +535 across 8 files. Reproducibility: yes. at the exact-head source and focused-test level. Leave the first session describe pending, switch to a second session, and this branch incorrectly expects zero history calls even though the newest session should proceed after creation. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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
Security Review findings
Review detailsBest possible solution: Validate and land the replacement’s corrected latest-session invariant with green exact-head Android checks and redacted final-head emulator or Gateway-trace proof, then close this divergent branch as superseded while preserving contributor credit. Do we have a high-confidence way to reproduce the issue? Yes at the exact-head source and focused-test level. Leave the first session describe pending, switch to a second session, and this branch incorrectly expects zero history calls even though the newest session should proceed after creation. Is this the best way to solve the issue? No for this exact branch: the runtime ownership and Gateway API direction are appropriate, but the regression assertion encodes the wrong behavior. The replacement’s latest-session-specific assertion is the narrow correction. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0b30a3292f70. Label changesLabel justifications:
Evidence reviewedPR surface: Docs +2, Other +533. Total +535 across 8 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 (8 earlier review cycles)
|
fb9c98f to
9e1c569
Compare
9e1c569 to
2b3f4ad
Compare
9d534c0 to
47cc3e8
Compare
47cc3e8 to
44f8264
Compare
44f8264 to
978dcef
Compare
Co-authored-by: snowzlmbot <[email protected]>
04e7d30 to
ef0a577
Compare
|
Thanks @snowzlmbot — this work is now landed through the canonical replacement PR #105115 as commit 448b90a. GitHub's maintainer-edit shadow ref for this fork diverged from the branch ref, so the final reviewed fixups could not be made to reach this PR head reliably. The replacement preserves your contributor credit with a A final race hardening follow-up also landed in #105144 as commit d31eeea: session bootstrap now uses an atomic label-only patch so concurrent identity fields cannot be overwritten. Closing this PR as superseded. For future fork PRs, keeping Allow edits by maintainers enabled helps avoid this path; if GitHub's shadow ref still diverges, recreating the branch may be necessary. |
Related: #45854
What Problem This Solves
Android already isolates each device on a stable
agent:<agent>:node-<device>chat key, but the app did not explicitly create/adopt that session before connected history loaded. A new installation could read history before the app-owned session was ready, while renaming the key would strand existing Android conversations.Why This Change Was Made
node-<device>key so upgrades retain existing history and contextOpenClaw App · <device> · <id>labelThe Gateway's explicit-key
sessions.createpath preserves an existing session ID/transcript. The final implementation therefore adopts the established key rather than migrating toopenclaw-app-*.User Impact
Android users keep their existing device-specific conversation across upgrades. New and reconnected app sessions are ready before history loads, receive a recognizable device-unique label, and retain correct unread state across agent switches.
Evidence
04e7d30cfabc; prior-head Android Play/third-party tests, ktlint, native-i18n, and repository lint passedsessions.createimplementation and tests inspected: an existing explicit key keeps its session ID/transcript while applying metadatasessions.createthenchat.historyintegration shapeEvidence Source Map
apps/android/app/src/main/java/ai/openclaw/app/SessionKey.ktapps/android/app/src/main/java/ai/openclaw/app/NodeRuntime.ktapps/android/app/src/main/java/ai/openclaw/app/chat/ChatController.ktapps/android/app/src/test/java/ai/openclaw/app/chat/ChatControllerReconnectRestoreTest.ktRisk
Bounded to Android chat connection/session lifecycle. Adoption failures remain non-blocking so older or temporarily unavailable Gateways still load history under the already-bound key. The existing key and transcript are unchanged.
Rollback
Revert this PR to stop explicit readiness/adoption; the existing
node-*session and history remain intact.Docs Updated
apps/android/README.mdapps/android/CHANGELOG.mdRelease note: create/adopt Android's existing per-device chat session before history loads, preserving prior conversations and unread state. Thanks @snowzlmbot.