Skip to content

Fix Android reconnect toasts, cache state across suspend/resume, and fix 2 live phone crashes - #2344

Merged
trissim merged 1 commit into
mainfrom
fix/android-reconnect-cache-quiet-toasts-and-crashes
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/android-reconnect-cache-quiet-toasts-and-crashes

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown

Summary

Fixes the Android minimize/reopen reconnect toasts, slow blank-screen reconnects, and two live Pixel 8a crashes pulled directly from device logs (org.toadcomms.toadcomms on 2026-11-27):

  1. Silence transient disconnect error toasts (src/toad/client/connection.py, src/toad/client/application.py)

    • Added ObservationFailureReport(MroDispatch) (connection.py) so expected remote transport drops (ConnectorObserverClosed with non-ServiceFailed RelayEnding, OSError EOF) log quietly and auto-retry without popping report_fatal/show_error toasts on every phone lock/unlock. Real Core service crashes (ServiceFailed) and local observer deaths (ObserverDied) still surface through the host.
    • Removed the premature synchronous app.workspace_sessions.selected.reload() from SuspendedPresence.activate (application.py:117-123) and made CoordinationAccess.resume_route unconditionally publish CoordinationObserved after reopen_current finishes — eliminating the ObserverRetired error burst (Task-1811, Task-1654, etc.) where reload() raced the dying observation on every resume.
  2. Keep cached state warm across same-root reconnects & brief Android app switches (src/toad/client/connection.py, src/toad/client/sidebar_state.py, src/toad/qt/virtual_scroll.py)

    • RemoteObserving.resumed_through now calls RemoteCoreConnection.resume_observe(access, self.served_root) when reconnecting to the same connection, skipping the cold CommsServedRootTool HTTPS round-trip on resume.
    • CoordinationAccess.observe_remote retains and reuses (SidebarModel, RegistryReads) per root, and Observation.attach preserves notification_known and thread_status when reconnecting to the same bus root (only clearing them when switching to a different root).
    • SidebarStateMachine.bind_observation skips model_replaced() on same-root reconnects so the sidebar stays painted and diffs in place instead of flashing blank / "Reading comms" for ~3 s while the server spins up a new /observe worker.
    • RowDocumentStore._application_state_changed defers release_documents() by 60 s (SUSPEND_RELEASE_MS = 60_000) on ApplicationSuspended and cancels on ApplicationActive, so brief app switches keep laid-out QTextDocuments and 3x DPR RowPictures tiles warm instead of taking a 100+ ms re-layout/re-rasterize stall on every unlock.
  3. Fix two live crashes from Pixel 8a logs/errors/ (src/toad/qt/transcript_history.py, src/toad/qt/history.py)

    • QtTranscriptHistory.undrawn now returns not self.draws_rows (matching Textual's TranscriptHistory / HistoryPager.undrawn) instead of inheriting wire-only ReadMarkedHistory.undrawn (page.after.requires_read()), which crashed with AttributeError: 'NoNativeTranscriptCursor' object has no attribute 'requires_read' on DM arrivals (History_2026-11-27T20_45_38).
    • HistoryRowDelegate.prepare_inline returns False when self._stopped is True (and returns key in self._prepared), eliminating KeyError at history.py:375 when a stopped delegate lays out a late draft (Task-449_failed_2026-11-27T20_45_38).

Verification

  • tools/qt_inherit_ratchet.py: 0 across all baselines (REL_IMPORTS=0).
  • Focused pytest suite: tests/model/test_android_resync_lazy_load_catchup.py, tests/model/test_android_perf_ux_arrivals.py, tests/textual/test_observation_shutdown.py, tests/textual/test_sidebar_failure_lifetime.py, tests/guards/test_shared_history_change.py, tests/guards/test_shared_hook_sequences.py.

@trissim
trissim merged commit 9db2468 into main Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant