Repository navigation
feat(android): restore per-session chat reading position across cold starts - #137674
roboclaw-bot wants to merge 19 commits into
Conversation
Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 4:17 AM ET / 08:17 UTC. ClawSweeper reviewWhat this changesAndroid remembers deliberately paused chat positions across restarts, preserves live following, and handles local database initialization failures without crashing. Merge readiness✅ Ready for maintainer review This PR remains useful: current main lacks durable Android reading bookmarks, and related work does not replace that capability. The prior manual-navigation finding is addressed, the persistence contract has recorded acceptance, and no blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherAndroid’s chat reader turns Gateway history and user gestures into a transcript viewport. The new local bookmark store carries that reading choice across app restarts while session and Gateway lifecycle events control cleanup. flowchart TD
A[Gateway chat history] --> B[Session identity]
B --> C[Android chat reader]
D[Reader gestures] --> C
C --> E{Following or paused}
E -->|Following| F[Latest output and cleared bookmark]
E -->|Paused| G[Local bookmark store]
G -->|Reopen same session| C
H[Session deletion or Gateway removal] --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +947, Docs +1, Other +496. Total +1444 across 16 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the accepted bounded bookmark design, with live following as the default and restoration limited to the same session instance. Do we have a high-confidence way to reproduce the issue? Not applicable to the primary feature request; current main has no durable bookmark path. The supplied evidence records before/after restoration and failure-boundary scenarios, but this review did not execute them. Is this the best way to solve the issue? Yes. Reusing the existing metadata store and reader state provides the accepted capability without a parallel setting, schema migration, or competing scroll policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 240b8b158988. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (18 earlier review cycles; latest 8 shown)
|
0656e32 to
9619eef
Compare
Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
…droid-reader-repair
Persist transcript instance IDs in the disposable cache and recheck nullable cache identity atomically before deletion. Keep generation-unbound composer and outbox input separate from exact-instance bookmark retirement. Preserve offline cache rows on the v3-to-v4 upgrade and durable client state across cache downgrade. Cover replacement, missing-cache, and local-delete races with real Room regression tests. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
Preserve main transcript usage metadata and the atomic approvals inbox while retaining instance-scoped reader/cache retirement. Carry session metadata and transcript identity together through cache writes. Update the stale inbox test consumer and complete real database startup before arming the neutralized reconnect fixture; keep existing assertions and timeouts. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
Retain durable message anchors and offsets in existing client-state metadata. Use one initialized store for binding, saving and instance-scoped retirement. Remove the cache schema migration and broader cache/input deletion redesign. Preserve focused stale-writer, restart, scope and rollback coverage alongside the existing Android behavior tests. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
Keep the latest-output fallback when leaving the live edge, and persist only paused reading positions. Jump to latest clears the bookmark immediately. Preserve the newest choice across in-flight writes, including Clear/Save/Clear, and do not infer resumed following from a restored bookmark at the latest row. Reuse the existing store, schema, and reader state. Cover the two reopen modes and write ordering while consolidating duplicate test cases. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
…nnect Handle client database initialization failures at the shared connection owner, without starting a gateway connection or discarding durable data. Publish the native error only for the current intent and preserve cancellation. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
…ources Generate the single missing native source-catalog entry for the connection error added in f34f75c. Executable Android sources remain unchanged. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
Integrate the pinned main history-publication fencing and adaptive chat layout without rewriting the published reader-position work. Retain reader scope and store callbacks in the current owners. Manual navigation now adopts current timeline facts before a pending bookmark load can restore an older viewport. Real Compose gestures prove the chosen viewport is preserved and persisted, while normal restore and new-user-turn following remain intact. Worked on by: - @IWhatsskill Co-authored-by: IWhatsskill <[email protected]>
Related: #135429, #135251; preserves the latest-output behavior from #137682.
What Problem This Solves
Android readers lose an intentionally chosen place in a long chat after the app process restarts. Saving a bookmark while following live content would instead reopen at yesterday’s last message rather than new output. This PR distinguishes those choices.
The connection-startup review also identified a P1: awaiting the new reader store could propagate a failed local database initialization into an unhandled automatic or manual connection coroutine. The repair reports that local failure without crashing the app or deleting durable data.
Why This Change Was Made
One bounded store saves stable message anchors and pixel offsets in the existing client-state metadata table, scoped by Gateway, owner agent, session key, and session instance. It reuses the reader’s following/paused state instead of adding a setting or persisted mode flag.
The shared connection owner now handles database initialization failures before starting transport, rethrows coroutine cancellation, and publishes its native error only while the connection intent remains current. Both role statuses retain the failure; no alternate store, destructive recovery, or global exception handler is introduced.
Client-state schema v1 and cache schema v3 remain unchanged. No new configuration, dependency, protocol change, or migration.
User Impact
Evidence
Checked final candidate —
5b234ef7cdaa966a3d598d0460ff5319d6918110MainViewModel.connectregression tests failed with the unhandled Room initialization exception (unsupported durable database version 99 → 1).git diff --checkpassed. The Play debug APK build and Android lint also completed successfully at the repair commit.Native connection-failure evidence — captured September 6, 2026
Actual API 31 software emulator, 480×800, with an owned loopback mock Gateway. Baseline APK:
820b4294c6c5; repaired APK:f34f75c97c1c. Both used the same debug signer and a data-preserving install. The subsequent catalog-only commit changes no Android executable sources. These captures are not a claim of fresh testing of the later integrated adaptive layout.The launcher image alone does not establish cause: the native crash log records the uncaught Room 99-to-1 initialization exception, and both original automatic/manual boundary tests reproduce it. After repair, the app process remains alive and the isolated database retains version 99 and the saved sentinel. Unit tests independently preserve durable queued input. The existing recovery headline is generic; the specific new message appears under View details.
Before — startup and process exit, 14.9 seconds, continuous normal speed:
pr137674-before-startup-15s.mp4
After — manual Test connection reaches a handled failure, 10 seconds, continuous normal speed:
pr137674-after-connection-10s.mp4
After — opening View details, 9.9 seconds, continuous normal speed:
pr137674-after-details-10s.mp4
The three separate excerpts total about 35 seconds. The before excerpt is raw seconds 68–83; the after excerpts are raw seconds 0–10 and 80–90. The 70-second idle period between the two separate after interactions is omitted, not represented as elapsed response time. No action-to-result interval is sped up or cut internally. Full original WebM recordings are retained. The MP4s are silent and do not prove microphone/audio behavior.
All selected raw videos and MP4s were fully decoded; full-resolution screenshots and beginning/transition/end frames were visually inspected. All five published files were downloaded anonymously and SHA-256 matched the originals. GitHub’s rendered HTML was verified to contain two image embeds and three video players with controls. A separate browser-based playback test was not exercised.
Earlier bookmark-persistence evidence — historical head
820b4294c6c5Reviewed head:
820b4294c6c598dd04c0322809c3acc5478d8ff5; tested source tree:7be1db25d5dd81eb9fbd3e843d993ba1f56baa59.38-second silent recording, normal speed: live source segments 16–24 s and 135–143 s; paused source segments 2–10 s and 105–113 s. Explicit cut cards identify 111 s and 95 s omitted around restart/reconnection, with a separate 2-second mode-change card. The actual Jump and bookmark-restoration transitions are shown, not accelerated.
pr137674-hybrid-proof-38s.mp4
Proof uses an API 31 software emulator and a deterministic loopback mock Gateway, not a physical device or live provider. It is not authentication or performance evidence. The emulator reported a SIGSEGV during shutdown after both recordings completed; task-owned processes and ports were then verified stopped.
Maintainer Decision
Recorded at the explicit request of @IWhatsskill on September 6, 2026: the narrowed Android bookmark-persistence contract is accepted for reviewed head
820b4294c6c598dd04c0322809c3acc5478d8ff5.Accepted scope and tradeoffs:
This records the design decision and its limitations; it does not waive required reviews, CI, or the repository’s guarded merge workflow.
CI and Review Status
Published final head:
5b234ef7cdaa966a3d598d0460ff5319d6918110. The current-main integration and the review-discovered P2 are complete. The exact committed tree matches the tested/reviewed tree; all 483 selected local tests and required local gates passed.Final-head CI run 34097037023 passed on this exact head (attempt 1), including Android Play, third-party, Wear, Kotlin lint, native i18n and the final CI gate.
ClawSweeper’s final-head review, completed September 7, 2026 at 07:57 UTC, reports Ready for maintainer review, no findings, and Before merge: None. The earlier
f34CI failure was the missing source-catalog entry, corrected in1eecand retained here; it is not the final-head verdict.The recorded native P1 connection boundary remains byte-identical to the final candidate. Existing recordings are explicitly revision-labeled, not presented as a new final-head emulator run. No merge or auto-merge is authorized.
Worked on by