fix(android): harden offline cache lifecycle#100454
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b279fc9ef2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| ### Fixes | ||
|
|
||
| - **Android offline chat cache:** serialize Gateway teardown and cache writes during pairing changes, purge SQLite companion files before credential reset, and prevent old sockets or explicit new credentials from restoring another identity's cached conversations. |
There was a problem hiding this comment.
Remove the normal-fix changelog entry
Root AGENTS.md says CHANGELOG.md is release-only and that normal fixes/direct commits should put release-note context in the PR body or commit message because release generation owns this file. This Android fix entry bypasses that flow, so it should be removed from the commit and left for the release changelog generator.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. Reviewed July 5, 2026, 9:19 PM ET / 01:19 UTC. Summary PR surface: Other +1210. Total +1210 across 17 files. Reproducibility: yes. Source inspection shows beginConnect can pass the reset flag sample before reset starts and remain outside the in-flight counter until it later calls connectWithAuth. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Claim or generation-check the whole beginConnect/TLS path before stale auth can reach connectWithAuth, with a regression test for a connect that entered just before reset starts. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows beginConnect can pass the reset flag sample before reset starts and remain outside the in-flight counter until it later calls connectWithAuth. Is this the best way to solve the issue? No. NodeRuntime is the right layer for this hardening, but the current patch claims only connectWithAuth and leaves the earlier beginConnect/TLS path outside the reset drain. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eda9b9fb1858. Label changesLabel justifications:
Evidence reviewedPR surface: Other +1210. Total +1210 across 17 files. View PR surface stats
Security concerns:
Acceptance criteria:
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)
|
This comment has been minimized.
This comment has been minimized.
5e18c93 to
fdd3630
Compare
fdd3630 to
99fa987
Compare
6e7b65a to
b755d3a
Compare
7e04b52 to
606cf3c
Compare
|
Merged via squash.
|
* fix(android): harden offline cache lifecycle * docs(changelog): harden Android offline cache lifecycle * fix(android): drain terminal gateway work safely * test(android): cover queued command purge * chore(android): refresh native i18n inventory * docs(changelog): avoid duplicate offline cache entry
* fix(android): harden offline cache lifecycle * docs(changelog): harden Android offline cache lifecycle * fix(android): drain terminal gateway work safely * test(android): cover queued command purge * chore(android): refresh native i18n inventory * docs(changelog): avoid duplicate offline cache entry
What Problem This Solves
Follow-up to #100227: the Android offline cache shipped before its pairing-reset and WebSocket lifecycle hardening. A pairing or explicit credential change could race old connection callbacks, preserve endpoint-keyed cache across identities, or delete credentials before SQLite cache cleanup was verified.
Advances #100194.
Why This Change Was Made
This makes auth reset and cache ownership one bounded lifecycle. Gateway connection starts are counted without holding the auth monitor across session calls; reset drains starts, retires and joins old sockets/callback work, advances the cache generation, then verifies cache deletion before clearing credentials. Explicit credentials on the same endpoint now replace cached identity state instead of preserving it.
Room cleanup uses the app's single production database handle and clears both transcripts and durable queued commands before verifying the database, journal, WAL, SHM, and master-journal files. Gateway terminal ownership drains accepted connect responses and acknowledges peer closes before teardown. Fresh installs with no database directory remain a successful no-op. The Android Room license notice is included in the app inventory.
User Impact
Evidence
tbx_01kwtaq7dakscv93rrmz0jbrb9(run 28759024321): focused Play-debug cache, auth-reset, reconnect, terminal-callback, config-resolution, queued-command purge, and license-notice suites passed after the final rebase.git diff --checkpassed.606cf3c440606edc1af8a0eca0c91dbfcc1242d7: clean with no accepted or actionable findings, confidence 0.82.