Skip to content

qt + tui: arrivals stop re-deriving thread facts, scroll response per frame, channel thread config, #any DM files - #2137

Merged
trissim merged 16 commits into
mainfrom
qt-ui-batch-8
Nov 18, 2026
Merged

trissim merged 16 commits into
mainfrom
qt-ui-batch-8

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

Gated locally once (ratchet, shadow, 22 live-bus Qt drives, TUI on the owner's settings; TUI send/history tests).

  • Arrival path (gaming-a-headers): the last sent references are tracked by the history, not a reverse scan; per-page fragments reused so a new message rebuilds only its page; compose access, status, label and mentions are no longer read per bus message.
  • Thread config is read on the first refresh and when the revision's roster part moves (channels get no thread_presented, so they had no mentions/compose/label), plus thread_presented.
  • Scroll (gaming-b-serve): one response per displayed frame, the shared paging and pin in full, no skip-while-dragging; every offset (the window's own glide included) repins, so an arrival's burst stacks.
  • Message files: a DM's files are read in that DM as its sender; #any (DMs between other threads) failed its whole page when the reader was named.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

claude and others added 16 commits November 18, 2026 19:19
ArrivalBurst.stack() fired when pinned.headers was empty — the top row's
own header divider was at the viewport's top, still visible in the flow.
The stack drew "N new" + the earlier message's header at viewport y=0,
covering the visible header with an identically-labelled one from the
burst.  Two "Agent" headers at the same pixels in a DM.

Guard: return NO_STACK when pinned.headers is empty.  The header is
visible; there is nothing to stack on top of.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When B's header divider is the viewport's top row, pinned.headers is
empty (the header is visible, no pin needed).  The old code drew A's
stacked header at y=0 on top of B's visible header — two Agent headers
at the same pixels.

The first attempt (returning NO_STACK when pinned is empty) killed the
stack entirely, failing the drive's assertion that burst heads above the
top row produce a visible stack.

Fix: when pinned.headers is empty, find the burst message at the top
row (reversed scan: message_top <= scroll_y).  Its header becomes the
overlay's last line (top_line) so the opaque overlay covers the flow's
copy, and earlier messages stack above it.  The overlay reads
"N new / A / B" with B drawn once.  The top-row header's key stays out
of stacked.keys, so clicking it does nothing (the reader is already
there).

The overlay height = count + stacked + B_copy >= B_flow, so the flow's
header is fully behind the opaque overlay in both Qt (WA_OpaquePaintEvent,
sized to sum of doc heights at y=0) and Textual (dock=top, auto-height).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ub.com/OpenHCSDev/toad into claude/gaming-a-headers-overlap-hpdz3v

# Conflicts:
#	src/toad/client/history_changes.py
…ch drag

QScroller fires valueChanged at touch rate (90Hz on Pixel 8a, up to 240Hz
on higher panels) while the finger is dragging. Two expensive paths ran at
that rate:

1. repin_header() — calls top_page() which measures header block documents
   via block_row(), plus sticky_header.pin() — now deferred to after drag
   ends, alongside respond_to_scroll. Fling (Scrolling state) still repins
   at frame rate.

2. lookahead velocity was not measured during drag (respond_to_scroll was
   skipped entirely), so read-ahead couldn't predict the reader's speed.
   On a fast upward drag, no pages were requested until the drag ended, and
   the reader hit the top of loaded history. Now lookahead.observe(value)
   fires on every drag tick (two float ops), so the drag-end
   respond_to_scroll sees the full velocity and requests pages far enough
   ahead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nce as TUI

QScroller fires valueChanged at touch rate (90Hz on Pixel 8a, up to 240Hz)
while the finger drags. The full scroll response (repin_header, lookahead
velocity, page requests, tail-follow) now runs once per display frame —
the same cadence as the TUI's watch_scroll_y.

A single-shot QTimer at frame_interval (the display's refresh period) fires
_scroll_frame, which reads the current scrollbar value and runs the full
shared respond_to_scroll + repin_header. Multiple valueChanged ticks within
one frame coalesce into one pass. At frame-rate input (fling, keyboard),
the timer fires on the next event-loop pass with no added latency.

Removes the _scroller_dragging skip entirely: no "skip during drag"
branch, no special drag-end transition. The at_end/follows_tail state
flips stay immediate in scrolled() since they are cheap and consumers
need them during every tick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…OpenHCSDev/toad into gaming-b-serve/qt-scroll-paging

# Conflicts:
#	src/toad/qt/history.py
#1 sent_references O(N) reverse scan → tracked incrementally
  ReadMarkedHistory.last_sent_references, updated from committed_pages_changed
  when the last page commits new fragments. qt/window.py reads the tracked
  value instead of reversing all fragments. TUI has no equivalent scan.

#2/#3 compose_access + status_text per-arrival Core calls → thread_presented
  Moved from _refresh_source (fires on every bus message) to
  _refresh_thread_config (fires on ThreadsObserved, via thread_presented).
  Thread config doesn't change per message; the first open and config
  changes still read them. qt/window.py:ConversationView.thread_presented
  schedules the async reads.

#4 update_mentions per-arrival → thread_presented
  Same move as #2/#3; roster changes fire ThreadsObserved.

#5 show_pages O(all fragments) per-page filtering → cached per page
  QtPage._shown caches shown_fragments; invalidated only on range_changed
  (page content) or set_categories (filter). Unchanged pages return the
  same tuple objects, so HistoryRows.show() identity diff finds the
  unchanged prefix in O(1). Arrival cost: O(new page) instead of O(all).

#7 thread label per-arrival → thread_presented
  conversation.label(source.references()) moved to _refresh_thread_config.

#6 (external_transcript_changed all views) deferred: depends on Core-side
  per-thread info in the revision that claude-a is building.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The TUI's CommsChatView._refresh_source had the same per-arrival
compose_access, status_text, update_mentions and label reads as Qt's.
Move them to _refresh_thread_config, scheduled from thread_presented
(fires on ThreadsObserved + first open). _refresh_source now reads
only the history's changed pages, as the Qt side does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five per-arrival re-reads removed from both frontends' _refresh_source:

#1 sent_references O(all fragments) reverse scan (Qt only):
  ReadMarkedHistory.last_sent_references tracks the last outgoing
  message's references incrementally — note_sent_references walks only
  the newest page's fragments on commit, not the full history. Qt's
  _refresh_source reads the cached value.

#2/#3 compose_access + status_text Core calls per arrival:
  Moved to _refresh_thread_config, triggered by thread_presented (fires
  on ThreadsObserved, not on every bus message). Thread config — whether
  compose is read-only, what the DM status says — doesn't change per
  message.

#4 update_mentions per arrival:
  Same: moved to _refresh_thread_config. Mention candidates change on
  roster changes, not per message.

#7 thread label per arrival:
  Same: moved to _refresh_thread_config. The label changes on title or
  relationship changes, not per message.

Both frontends: Qt's ConversationView._refresh_source and TUI's
CommsChatView._refresh_source now do only the history page read and
receipt follow. Config reads fire from thread_presented through
_refresh_thread_config in each frontend.

Initial load path preserved: transcript_publication.py:801 calls
consume_thread_presentation() on bind, which fires thread_presented,
so compose/status/mentions/label are read on first view open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…header test was removed in #2135: it compared identical-by-construction labels)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…rame only for reader scrolls

The frame-coalesced scroll returned before scheduling anything while the window restored
its own offset (an arrival's glide), so an arrival's header never pinned and its burst
never stacked (batch-8 arrival drive). The per-frame pass now always repins; velocity,
page requests and tail-follow still run only when the reader moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…en the roster moves, channels included

Moving compose access, label, status and mentions off the per-arrival refresh onto
thread_presented left channel views (which never get thread_presented) without them: the
composer drive found no mention offers on #any. Both frontends now read the config when the
revision's roster part moved (NoRevision before the first read), and on thread_presented.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…r reads the page

#any shows DMs between two other threads; reading their files as the reader's DM with the
sender was refused ('Not in claude-a as you may read it') and failed the whole #any page:
the composer drive could not open #any once such DMs were on the bus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
@trissim
trissim merged commit ee86ccd into main Nov 18, 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.

2 participants