Skip to content

Fix Android/Qt DM view stale-witness, observer drop, and WorkingTranscript publish wedges - #2341

Merged
trissim merged 1 commit into
mainfrom
fix/dm-view-transient-recovery
Nov 28, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/dm-view-transient-recovery

Conversation

@trissim

@trissim trissim commented Nov 28, 2026

Copy link
Copy Markdown

Summary

Fixes 5 interacting root causes that left Android/Qt DM and native thread views (QtMailboxView / SavedTranscript) frozen on stale messages, flipped to "Saved history not loaded", or unable to send on desktop Qt:

  1. Unreachable except ReloadRequired: in TranscriptPublication.publish() (src/toad/transcript_publication.py:209-229)

    • ReloadRequired (and its subclass TranscriptChanged) subclasses ReadAgain, so catching ReadAgain first made the ReloadRequired handler 100% dead code. When the published source witness invalidated, self.owner.current_read was never reset to NotPublished(), wedging the view resending a stale witness.
    • Reordered except ReloadRequired: ahead of except (*TRANSIENT_SOURCE_ERRORS, StaleRevision, ReadAgain): and widened transient handling to trigger coordination_access.check_route() on transient drop/restart errors instead of crashing the publication task.
  2. Observer restarts permanently retiring tabs (src/toad/client/history_state.py:31-39)

    • Added ObservationEnded (covering ObserverDied / ObserverProcessDied) and ObserverUnattached to TRANSIENT_SOURCE_ERRORS. Previously, an observer drop or connector restart during WorkingTranscript.execute fell through to owner.source_failed(error) -> permanent RetiredSourceTranscript ("Saved history not loaded").
  3. Paused saved-transcript reads never waking on reconnect (src/toad/client/prepared_pages.py:438-449, src/toad/client/history.py)

    • Moved CoordinationObserved wakeup up onto PreparedPageSource.observe_availability alongside view.thread_scope.observe(...) and deleted the redundant WirePageBuffer.observe_availability override (IMPL-12). A paused SavedTranscript (QtMailboxView) now resumes automatically when Core reconnects even if no ThreadRowsChanged arrives for that thread.
  4. WorkingTranscript.publish() + CommitTranscript.rows_published() breaking operation completion (src/toad/client/history_state.py:396-399, src/toad/client/committed_presentation.py:341-345)

    • WorkingTranscript inherited TranscriptState.publish(), which replaced owner._source_state mid-execution with LiveTranscript(), causing finish_source_work(operation) to see self._source_state is operation == False and drop operation.owed, TranscriptSourceWorkFinished(), and source_settled (leaving demand=CommitDemand stuck).
    • Added WorkingTranscript.publish() to advance the wrapped source in-place while keeping the running operation mounted until finish_source_work, and made CommitTranscript.rows_published() call super().rows_published(owner) so painting rows onto an UnreadTranscript immediately advances coverage to "Saved history available".
  5. Desktop Qt native thread operational_sources (src/toad/qt/mailbox_view.py:70-73)

    • Initialized self.operational_sources = self.mailbox_sources() in QtMailboxView.__init__ so desktop Qt native threads opened via apply_native_load_plan use Core's inbox composer path instead of SessionSources() ("No agent is connected to this tab"), while keeping BoundSources.apply_native_load_plan intact.

Verification

  • Focused pytest (100 tests across tests/model/test_android_resync_lazy_load_catchup.py and 8 guard suites): all passed (REL_IMPORTS=0).
  • Live headless QtToadApp (repro_dm.py --comms-root /home/ts/.agent-comms --open toad-qt): opened toad-qt cleanly to state=LiveTranscript, cov='Saved history available', demand=CleanDemand, operational_sources=MailboxSources, rows=203, and bumped to 204 on external_transcript_changed().

@trissim
trissim merged commit 6ffb0df 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