Repository navigation
fix(android): keep deleted queued messages from reappearing - #136161
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
9dbf4e2 to
079471c
Compare
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 6:44 AM ET / 10:44 UTC. ClawSweeper reviewWhat this changesThe PR makes Android queued-message refreshes discard stale results so deleting an offline message remains visible while other refreshes or sends continue independently. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessThe patch is correct and still needed: current main retains the unfenced outbox publisher. No introduced defect was found; this maintainer-labelled Member PR needs an explicit maintainer merge decision rather than automated closure. Priority: P1 Review scores
Verification
How this fits togetherAndroid ChatController reads durable, gateway-scoped outbox rows and publishes them to queued-message UI state. Reconnect, deletion, and gateway replacement trigger publications; durable outbox ownership remains responsible for deletion and sending. flowchart LR
A[Durable Android outbox] --> B[Chat controller]
C[Reconnect, delete, or gateway change] --> B
B --> D[Revision and scope fence]
D --> E[Queued message UI]
E --> F[Retry, delete, or send]
F --> A
Decision needed
Why: The PR is authored by a repository Member and carries the protected maintainer label, so automated cleanup must leave the landing decision to a maintainer despite the clean technical review. Before merge
Agent review detailsSecurityNone. PR surfaceTests +130, Docs +1, Other -3. Total +128 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Merge the focused revision fence, retaining the existing durable outbox and controller-owned dispatch boundaries. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main applies delayed same-scope outbox reads without ordering them, while the added focused tests model the held-read/delete and newer-failure interleavings. No tests were executed in this read-only review. Is this the best way to solve the issue? Yes. The revision is recorded at the presentation owner under the existing scope lock, so it rejects stale reads without serializing storage I/O or changing durable delete and send ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 18508eff3a41. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Keep publication reads independent, invalidate retired Gateway UI, and preserve claimed dispatch when its UI caller is cancelled. Extend native coverage for visible deletion, active-caller progress, scope retirement and newer load failures. Release note: Android keeps deleted queued messages removed when delayed refreshes finish without making sends wait behind an unrelated refresh.
|
Merged via squash.
|
…#136161) * fix(android): keep deleted queued messages from reappearing * fix(android): fence stale outbox refresh results Keep publication reads independent, invalidate retired Gateway UI, and preserve claimed dispatch when its UI caller is cancelled. Extend native coverage for visible deletion, active-caller progress, scope retirement and newer load failures. Release note: Android keeps deleted queued messages removed when delayed refreshes finish without making sends wait behind an unrelated refresh.
Related: #135796, #135961.
What Problem This Solves
Android could display a deleted queued message again when an older completed outbox read resumed after the deletion refresh. An older successful read could also mark restoration complete after a newer read failed. Both are stale presentation, not evidence that deleted database rows or network sends were recreated.
Why This Change Was Made
The original publisher fenced different Gateway scopes, but not two reads for the same scope. Each publication now registers a revision and its exact Gateway scope under the existing UI-application lock, reads outside that lock, and applies only if both still match. Explicit Gateway UI invalidation advances the same revision, including when the endpoint remains selected. A failed latest read preserves the last rows while leaving restoration incomplete; an older success cannot override that result.
The first candidate serialized the complete read and publication. Review exposed a real drawback: an unrelated suspended read could hold up visible Delete or a newly claimed direct send. That load-held mutex is removed. Publication stays best-effort at caller cancellation because the existing send path may already own a durable Sending claim and must still transfer dispatch to the controller-owned coroutine. Room transactions and attempt/status comparisons remain the persistence and delivery owners.
User Impact
Deleted input stays removed when delayed refreshes finish, and sends do not wait behind an unrelated publication. Gateway separation, queue order, delivery receipts, retries, and Stop semantics are retained. Delete removes the local queued copy; it cannot undo a message already accepted by the Gateway. There are no layout, configuration, dependency, storage-schema, migration, or wire-protocol changes.
Evidence
Current source:
14c1787cad7cb836ae1df2dd71284d014941b312, based onc35350c92d8609d28dfcf190197ec22583e62ea3.ChatController.ktfrom the base commit. Two tests ran and failed at observable assertions: a deleted row was emitted again through StateFlow, and an older successful read masked a newer load failure. Neither failure was a timeout. The revision candidate was restored byte-for-byte afterward.The same original unordered publication owner is present in source at stable tag
v2026.8.2; that is source provenance, not a claim about an Android store upload. The historical CI failure that prompted this investigation did not record its interleaving, so its exact cause is not claimed as established.Production: +12/-15, net -3. Tests: +160/-30, net +130. Docs: +1. Existing regression fixtures are extended, with one focused failure-state test in the same suite; there is no production test seam or new test file.
Review Follow-through and Proof Limits
The prior review's identical pre-Delete Queued snapshot does not itself prove an intermediate reappearance: StateFlow suppresses equal values, and the UI does not optimistically remove that row. The stronger tests instead require visible deletion while the old read is still held and then observe every emitted row list; they reproduce a real re-emission on the original publisher. The separately demonstrated head-of-line delay is repaired by revision fencing rather than serialized I/O.
The latest ClawSweeper review at this exact head has no actionable finding. Its Rank-up move to finish the current-head Android checks is satisfied. This is an explicitly requested maintainer repair and landing; current CODEOWNERS does not restrict the touched Android paths, and live main rules require the CI gate and linear history, not an independent PR approval.
The live run used a fresh API36 emulator, fresh task credentials and APKs built from this head. It used one normal device-role approval and one normal node-capability approval, not a preseeded pairing database. Two onboarding attempts are preserved as failures: the first waited for an automatic reconnect after a terminal role-upgrade response that requires a normal retry; the second reached node approval, but the operator response missed the harness deadline and its stale approval basis was correctly refused before any approval RPC. A third normal attempt completed without changing the APK, increasing timeouts, clearing data or resetting authentication. All five distinct native methods then passed (seven executions total).
The actual cold-relaunch PIDs were 2896 and 3073. The earlier test process had already exited before force-stop, so this is not a forced mid-flight kill. The final reconnect/Refresh observation lasted 20.287 seconds with two samples over 4.188 seconds before Refresh and two over 4.165 seconds afterward. These bounded observations do not force the stale-read race or establish indefinite stability; the separate owner tests prove those interleavings. Live multi-Gateway switching, a real provider turn and physical Android hardware are not claimed.
The first CI security job failed its unauthenticated Git history fetch before the scan. One same-head retry through the workflow's normal alternate runner passed; no credential policy, security check or source was changed. The fresh local harness also retained a missing emulator-registration port setting and an absent-package preflight exit as setup failures, not product regressions. The previous head's proof remains retained but is not substituted for this head.
All new disposable Gateway credentials/state, emulator data, ADB/debug keys and task processes have now been removed. Allocated ports are free, retained text contains no exact task-token match, and the operator's Android metadata is unchanged. Screenshots and native results were independently inspected; media remains local and unuploaded.
Named build follow-up: Android release-task detection mistakes a
--testsfilter containingAfterReleasefor a release-build request. That first attempt stopped during configuration before any test ran. An exact selector then produced the original RED. No signing credentials, timeouts, or assertions were weakened; that build-owner repair is separate.Release note: Android keeps deleted queued messages removed when delayed refreshes finish without making sends wait behind an unrelated refresh.