Skip to content

fix(android): restore reopened chats at the live edge - #137682

Merged
roboclaw-bot merged 2 commits into
mainfrom
fix/android-reopen-live-edge
Sep 5, 2026
Merged

roboclaw-bot merged 2 commits into
mainfrom
fix/android-reopen-live-edge

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #135251

What Problem This Solves

Fixes an issue where Android users reopening a long or active chat would land at the start of the latest user turn instead of the latest output. The reopened reader therefore hid newer content below the viewport and showed Jump to latest even though the user had just entered the chat.

Why This Change Was Made

Android initial chat restoration now explicitly follows latestContentIndex, matching the iOS reopen policy while leaving existing ReadAnchor handling, manual reading, and live-turn streaming transitions intact. The deterministic Android screenshot fixture now waits for the latest seeded reply, and layout tests explicitly enter manual-reading mode before checking the jump affordance.

User Impact

Reopened Android chats now start at the live edge with the newest output visible and no stale Jump to latest pill. Scrolling upward still pauses following and offers the jump control when newer content is actually below the viewport.

Evidence

Native Android Before/After videos

Same emulator, original A/B transcripts and interaction script. Baseline: ce30057; candidate: 7304918. Both complete MP4s were decoded and visually inspected.

Before — baseline (75 seconds)

The final answer is visible around 00:40, then the reader automatically jumps back to the last user question at 00:45/00:49. The first manual scroll is only at 00:51.

before.mp4

After — current PR head (80 seconds)

At the equivalent point after reopening, the reader stays at the final output. Manual browsing and Jump to latest continue to work.

after.mp4

Before

  • On the unmodified base, :app:testPlayDebugUnitTest --tests ai.openclaw.app.ui.chat.ChatReaderScrollControllerTest passed while asserting ReadAnchor, scrollIndex = 1, and hasNewerContent = true for loaded history.
  • With only the new regression expectations applied to the old production code, the same command failed in three intended cases: initial history returned index 1 instead of 0, a one-message reopen retained ReadAnchor, and a completed reply returned index 1 instead of 0.

After — earlier implementation validation

  • ANDROID_HOME=<API-37 SDK> ./gradlew :app:testPlayDebugUnitTest :app:ktlintCheck — passed, including all 2,731 Play unit and Compose/Robolectric UI tests.
  • ANDROID_HOME=<API-37 SDK> ./gradlew :app:testThirdPartyDebugUnitTest --tests ai.openclaw.app.ui.chat.ChatReaderScrollControllerTest --tests ai.openclaw.app.ui.chat.ChatComposerLayoutTest --tests ai.openclaw.app.ui.chat.ChatReaderScrollOwnershipLayoutTest — passed.
  • pnpm test test/scripts/android-screenshots.test.ts — passed all 12 screenshot-tooling contract tests.
  • node scripts/check-changed.mjs -- <six changed paths> — passed all selected app/test/tooling gates, including test-root typecheck, Android Kotlin lint, and script lint.
  • Initial autoreview --mode local --base origin/main --max-priority P2 — scoped clean, no accepted/actionable findings (confidence 0.89).
  • Production delta: +4/-16; tests and Android screenshot tooling: +49/-24.

Rebase and maintainer-review validation — September 4, 2026

  • Candidate head: 77a90c9c143345840eb1f3d0a9aae68a10c1f418, based on ce30057dbb089eac266d7e5b0b8e8e508ee49779. This includes main's advisory-network recovery fix from fix(ci): recover transient npm advisory request failures #137825; no CI bypass or security-check weakening was added by this PR.
  • Fresh focused Android proof covers ChatReaderScrollControllerTest, ChatComposerLayoutTest, ChatReaderScrollOwnershipLayoutTest, and ChatTimelineTest in both Play and Third-Party debug flavors — 64/64 tests passed per flavor on 77a90c9c143, zero skips or failures; final combined Gradle run completed successfully in 1m 7s.
  • node scripts/run-vitest.mjs test/scripts/android-screenshots.test.ts test/scripts/pnpm-audit-prod.test.ts — 47/47 tests passed again on 77a90c9c143.
  • node scripts/check-changed.mjs -- <six changed paths> — passed on 28d275cff95, including all four Android Ktlint modules, root-test typecheck, script lint, and selected guards.
  • Fresh repo-native autoreview --mode branch --base origin/main --max-priority P2 — scoped-clean on 28d275cff95, no accepted/actionable findings. The final mechanical rebase adds only an unrelated main logging change; all Android, screenshot-tooling, and corresponding test files are byte-identical across these two candidates.
  • Direct caller/timeline/iOS-sibling inspection and an independent read-only regression review found no concrete P0/P1/P2 regression. The controller remains the narrow policy owner; timeline anchor semantics, saved-state handling, manual scrolling, and live-turn transitions remain unchanged. Actual saved-state A→B→A navigation and tall streamed-row finalization remain additional coverage opportunities, not reproduced defects.
  • Maintainer disposition — intentional default accepted: the requesting repository maintainer explicitly accepted live-edge initial restoration for existing Android chats and instructed this assistant to record that decision. The rationale and limited scope are in the decision comment. This is recorded acceptance of the intentional UX change, not a claim of independent Android-area ownership or an already-updated ClawSweeper verdict.

Earlier emulator attempt — superseded by the native videos above

This paragraph records the earlier failed setup attempt, not the final native proof. The two videos above now close that evidence gap.

The host had no real Android device and no preconfigured AVD. A task-isolated API 37 AVD was created and started headlessly with software acceleration because /dev/kvm was unavailable. After 12 minutes it still had not reached BOOT_COMPLETED; APK installation was rejected with device is still booting. No screenshot was captured. The repository's deterministic long-chat screenshot fixture and its readiness marker were updated for the live edge, while the green Compose/Robolectric UI coverage and Android CI lanes provide the executable substitute proof.

Worked on by

Native Android verification update — September 5, 2026

The real before/after videos are embedded directly in the Evidence section above. Same emulator, script and original transcripts; both raw/MP4 videos fully decoded and inspected.

See the sanitized proof, exact revisions, hashes, limitations and verified cleanup.

Ready for maintainer review. Do not merge on this request. No PR-code changes made.


View the OpenClaw team session

@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.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: android App: android scripts Repository scripts labels Sep 3, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 3, 2026 23:54
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 3, 2026
@IWhatsskill IWhatsskill self-assigned this Sep 4, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 5, 2026, 10:00 AM ET / 14:00 UTC.

ClawSweeper review

What this changes

Reopened Android chats start at the newest output, with scrolling tests and screenshot readiness checks updated accordingly.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains useful: current main still reopens Android chats at the latest user prompt. No blocking correctness findings were found; the recorded landing hold remains in effect.

Priority: P2
Reviewed head: 7304918a0cde468b8fb9d18e1146dfe5402d5436
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with reported native before/after proof and meaningful regression coverage; the landing hold is separate from patch quality.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (recording): The supplied native A/B verification exercises session reopening through the real Android reader and isolated Gateway, reporting stable newest-output visibility after the fix plus working manual reading and Jump recovery. Linked recordings were not independently viewable here because GitHub DNS failed; this is a reviewer limitation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (recording): The supplied native A/B verification exercises session reopening through the real Android reader and isolated Gateway, reporting stable newest-output visibility after the fix plus working manual reading and Jump recovery. Linked recordings were not independently viewable here because GitHub DNS failed; this is a reviewer limitation.
Evidence reviewed 11 items Current main still has the reported behavior: Initial restoration selects readAnchorIndex before latestContentIndex and sets ReadAnchor following. This remains distinct from the proposed live-edge initialization.
Repair stays at the scroll policy owner: The initial transition now selects latestContentIndex and LatestContent following. Existing initialized-state handling, saved-state serialization, manual navigation, and animation cancellation remain unchanged.
Caller and timeline boundary: ChatMessageList builds the timeline, calls the reader controller, and passes its state to a reverse-layout LazyColumn. The timeline already distinguishes the newest content from the latest user prompt; changing that shared anchor would be broader than repairing initial selection. This changed path is native Compose presentation, with no Codex runtime or protocol dependency.
Findings None None.
Security None None.

How this fits together

Android builds a chat timeline from history and live updates. Its scroll controller determines which content is visible and when to offer Jump to latest.

flowchart TD
  A[Open chat] --> B[History and live updates]
  B --> C[Newest-first timeline]
  C --> D{Reader position}
  D -->|Initial view| E[Newest output visible]
  D -->|Manual reading| F[Preserve position and offer Jump]
  F -->|Jump to latest| E
Loading

Decision needed

Question Recommendation
Should the requesting maintainer's explicit landing hold remain, or may this PR proceed through the normal landing gates? Retain the hold: Keep the PR unmerged until the requesting maintainer explicitly changes the recorded instruction.

Why: The latest supplied handoff expressly requires a new instruction releasing the hold; technical review cannot supply that authorization.

Before merge

  • Resolve merge risk (P1) - Independent visual inspection of the linked native recordings was unavailable because GitHub DNS resolution failed in this worker.
  • Complete next step (P2) - Obtain a new explicit instruction from the requesting maintainer releasing the recorded landing hold.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Tests +25, Other -12. Total +13 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 46 21 +25
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 7 19 -12
Total 6 53 40 +13

Review metrics

Metric Value Why it matters
Production versus test footprint Production −12 lines; tests +25; screenshot tooling net 0 The repair removes redundant initial-target selection while expanding behavioral coverage.
Initial-position default 1 changed default; 0 new settings The recorded disposition accepts newest-output restoration without adding configuration or rewriting saved state.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep initial live-edge selection in the existing scroll controller while preserving deliberate reading positions and the saved-state format.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep initial live-edge selection in the existing scroll controller while preserving deliberate reading positions and the saved-state format.

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

Yes, from source: reopening populated history selects the latest user prompt on current main, and existing tests explicitly assert that position. The supplied native A/B report corroborates the symptom; no runtime reproduction was executed here.

Is this the best way to solve the issue?

Yes. Initial positioning belongs in the scroll controller; changing timeline anchors or adding another restoration path would unnecessarily affect preserved reading and saved-state behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1582f0ba4513.

Labels

Label justifications:

  • P2: This repairs Android chat reopening friction with a bounded presentation change and an existing Jump recovery action.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The supplied native A/B verification exercises session reopening through the real Android reader and isolated Gateway, reporting stable newest-output visibility after the fix plus working manual reading and Jump recovery. Linked recordings were not independently viewable here because GitHub DNS failed; this is a reviewer limitation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied native A/B verification exercises session reopening through the real Android reader and isolated Gateway, reporting stable newest-output visibility after the fix plus working manual reading and Jump recovery. Linked recordings were not independently viewable here because GitHub DNS failed; this is a reviewer limitation.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The supplied native A/B verification exercises session reopening through the real Android reader and isolated Gateway, reporting stable newest-output visibility after the fix plus working manual reading and Jump recovery. Linked recordings were not independently viewable here because GitHub DNS failed; this is a reviewer limitation.

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)
  • IWhatsskill: 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 (7 earlier review cycles)
  • reviewed 2026-09-04T00:42:52.370Z sha 7221877 :: blocked before merge. :: none
  • reviewed 2026-09-04T02:06:35.279Z sha cbeaf9c :: blocked before merge. :: none
  • reviewed 2026-09-04T04:45:43.508Z sha 77a90c9 :: blocked before merge. :: none
  • reviewed 2026-09-04T05:28:42.724Z sha 77a90c9 :: blocked before merge. :: none
  • reviewed 2026-09-04T05:58:35.421Z sha 77a90c9 :: blocked before merge. :: none
  • reviewed 2026-09-04T15:43:47.684Z sha 7304918 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-05T13:09:45.197Z sha 7304918 :: blocked before merge. :: none

@roboclaw-bot
roboclaw-bot force-pushed the fix/android-reopen-live-edge branch from 7221877 to cbeaf9c Compare September 4, 2026 01:59
@roboclaw-bot
roboclaw-bot force-pushed the fix/android-reopen-live-edge branch 2 times, most recently from 77a90c9 to 7304918 Compare September 4, 2026 15:34
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 4, 2026
@roboclaw-bot

roboclaw-bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

Final maintainer handoff

Current head: 7304918a0cde468b8fb9d18e1146dfe5402d5436. Ready for maintainer review; the requester’s explicit landing hold remains in effect. No merge or auto-merge has been performed. This replaces my separate decision, interim CI, and proof updates.

Scope and recorded maintainer decision

Initial Android chat positioning now follows latestContentIndex at the existing scroll-controller boundary. Deliberate manual reading, saved-state handling and live-turn transitions retain their existing ownership.
The requesting maintainer explicitly accepted live-edge restoration for existing chats on September 4, 2026 (then-head 77a90c9c143); the requester’s repository role was verified as maintain at that time. Reopening should show the newest output without another scroll, while deliberate upward scrolling preserves reading position. This preserves the recorded UX acceptance, not a fabricated independent human/Android-area approval or permission to merge.

Verified evidence

Check Result
Differential controller regression Baseline production + candidate tests: 18 tests, 3 intended assertion failures, 0 errors/skips. Candidate: 18/18 passed with the same command/environment.
Focused current-head suites 64/64 Play + 64/64 Third-Party; 12/12 screenshot-tooling tests. Tooling mocks are not presented as device proof.
Native before/after Same API 31 emulator, real isolated Gateway, original 22/2-message chats and identical script. At 18 s after reopening, baseline hides the output at the last question; candidate keeps the final output visible. Manual input starts at 20 s in both runs. Manual reading and Jump to latest work.

Playable videos are embedded directly under Evidence in the PR body: Before, 75.02 s · After, 80.12 s. Baseline: ce30057dbb089eac266d7e5b0b8e8e508ee49779. Both raw/MP4 recordings were fully decoded and decisive frames inspected. Public GitHub downloads match the original hashes. No cuts, speed changes, overlays, fake timers, controller injection, live-model calls or production credentials.

Current checks and review

  • Audit 2026-09-05T13:25:07.881Z: 148 checks — 114 successful, 33 skipped, 1 neutral; no failed or incomplete checks. Required openclaw/ci-gate passed. The CodeQL comparison limitation is not comprehensive security clearance.
  • ClawSweeper’s September 5, 13:09 UTC review reports no correctness or security findings. Its two remaining pre-merge items both concern retaining the requester’s landing hold. Its video-access caveat predates the public uploads; this does not claim that ClawSweeper independently inspected those videos.
  • No formal reviews or inline review comments were present at the audit. Merge requires a new explicit instruction releasing the hold and the then-current landing gates. No fresh integrated-current-main run is claimed.
  • Native scope is session reopening and manual reader recovery, not physical-device/performance, live generation, every streaming path, or Activity/process-death restoration. Earlier-revision full-suite runs remain distinguished in the PR description.

Cleanup

Owned emulator/Gateway/supervisor stopped; ports, AVD, isolated state/credentials and build caches cleaned. Inspected artifacts retained; temporary uploader removed. No additional PR-code changes, new AWS lease, release or production deployment.

Artifact identities and reproducible controller command
  • Before MP4 SHA-256: ecfd92082edbba22bc1f83312cfecaa5175367079196f72dc9289a155759a597
  • After MP4 SHA-256: ec91cc071ca40d3bfd80348b3a018184d40aa40e28272eda7df6d67b1732a6b1
  • Before APK SHA-256: 4a1bb1605de97c2e1567135c84a4fd93b9a1dff0c6e25d8f06be7272560b1695
  • After APK SHA-256: 8987056c12c16f4f4e131466915fb0c27ac880473718ca34ee80a64885bbb723
  • Identical interaction-script SHA-256: e08e9b9d0ad63d2e6b3d76d3bbbb24c2ff361531f1ba0fa5029a4219f2ced5a8
  • Controller command, from apps/android: ./gradlew --no-daemon :app:testPlayDebugUnitTest --tests ai.openclaw.app.ui.chat.ChatReaderScrollControllerTest
  • Corrected differential run used Java 21.0.12.1 / Android SDK 37. Setup/quoting/dependency failures were excluded from regression evidence.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. labels Sep 5, 2026
@roboclaw-bot
roboclaw-bot merged commit 6c1ebc0 into main Sep 5, 2026
158 checks passed
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

@roboclaw-bot
roboclaw-bot deleted the fix/android-reopen-live-edge branch September 5, 2026 14:11
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
* fix(android): restore reopened chats at the live edge

Worked on by:
- @IWhatsskill

Co-authored-by: IWhatsskill <[email protected]>

* test(android): align screenshot readiness with live edge

Worked on by:
- @IWhatsskill

Co-authored-by: IWhatsskill <[email protected]>

---------

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: IWhatsskill <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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.

2 participants