Skip to content

qt + tui: windows fill a phone, an older bus never breaks history, motion at the display's rate, no stranding at the top, drives keep their own settings - #2134

Merged
trissim merged 11 commits into
mainfrom
qt-ui-batch-3
Nov 18, 2026
Merged

trissim merged 11 commits into
mainfrom
qt-ui-batch-3

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

Five branches, integrated and gated together so that the gated head is the merged head.

What's in it

  • Phone-class windows (phone-dialogs): ScreenWidth measures the app window in columns of its own text (under 100 is NARROW). WindowPresentation gives NARROW a page that fills the app (Qt FilledWindow with a "← Title" header; TUI FilledPanel) and WIDE a floating window (Qt FloatingWindow; TUI 50% SidePanel). Every Qt dialog inherits PresentedWindow, which applies the presentation in setVisible. The ratchet counts dialogs outside it, baseline 0. Settings, Team, Keymap, the transfer dialogs, queue inspection, delivery details, the command window, goal history and goal edit, and path search are converted. Tristan: "This should be a pattern for any of the windows that open, like the team window."
  • Older bus (optional-reads, with agent-comms #4890): a newer client read every history page from the laptop's older bus through comms_message_files and failed every page. CoreAccess.serves answers from the connector's tool list, and OptionalRead.absent() gives no files. Toad's pages draw without chips there, and Attach is not offered (ComposeAccess.takes_files).
  • Display-rate motion (display-rate-motion, with ui-theme Format coordination context as text and reuse already open thread tabs #34 and pyqt-reactive Check the wire root before starting or prompting an agent in maintenance #67): arrival motion is a Glide at the display's rate (it was a 60 fps Transition, so it moved every other frame at 120 Hz). The animation timer is precise. Rows scroll by moving pixels and repaint only the bands under floating widgets, and the pinned header is opaque. Unthrottled glide frames: median 17.0 → 8.1 ms, repainted share 1.0 → 0.05. Phone speed is still about 30 ms per frame, from UI-thread work during bursts (sidebar re-presentation 17%, glide tick 10.5%, page reads 8.6%, tab wave 8.6%); that work is in a separate branch.
  • Stranded at the top (the stopped history fork's edbe9d9f3 and c971fc459, rebased onto today's main):
    • A finger pulled past the top now asks for older rows. Before, the next page appeared 7.1 s after the reader reached the top, once 145 s.
    • Receipt updates repaint only the rows they changed.
    • row_of is an index.
    • An unchanged style sheet is not reapplied.
    • Each path-like word is checked on disk once per 10 s.
    • A tap reveals the message head (HEAD_REVEAL, now a display-rate Glide), and a tap on moving rows only stops them.
  • Drive isolation (drive-isolates-settings): qt_drive keeps XDG config and state under OUTDIR unless the caller sets them, so a drive can't write the real toad.json again.

Integration gate (benchmarks, not suites)

Runtime core-d2e0546b2 (ui-theme d1965ff05, pyqt-reactive 7ea4f12ca), Pixel 8a profile, live bus, every heavy step through the 2-slot lock.

  • Ratchet at baseline: 0 copies, 21 bare classes, 0 dialogs outside PresentedWindow. Shadow check 0.
  • New test files: test_older_bus.py and test_message_file_chips.py, pass.
  • Drives, all exit 0: windows_phone (412×915), windows_phone (1280×800), older_bus, jump_back, sole_sidebar, send_gap, menu_parity, hold, tab_strip, menu_float, header_rule, delivery_preview, arrival, history, participants, composer, tabs, frame, sticky, menu, tall_arrival, menu_text.
  • check.sh: exit 0, 0 fatal or traceback lines. The real toad.json was untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

trissim and others added 11 commits November 18, 2026 12:10
… open one are declared

ScreenWidth moves from Textual's app to a neutral module and counts columns of the frontend's
own text: under a hundred (a phone's fifty, a narrow terminal) is NARROW, where a window fills
the app, wider is WIDE. Textual's settings panel already read it; Qt's windows did not.
toad.qt.presented_window is Qt's one owner of the presentation (applied in setVisible, which
show/open/exec all reach), and OpensWindow marks the application actions that open a window,
so the windows_phone drive opens every one of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…says; the TUI reads the same family

On a phone (fewer than a hundred columns of text) every window Toad opens fills the app window
under a ← header, as a phone app's page does; on a desktop it floats no larger than its screen.
Settings opened as a 228x165 dialog over the chat with 47% of it for its pages, and the team
board as 900x650 on a 412-wide phone with 12 widgets drawn off screen (Tristan, 2026-11-18).

- toad.window_presentation: the WindowPresentation family keyed by ScreenWidth (FillsApp,
  BesideApp); both frontends' members inherit it and are found through for_width, so neither
  can lay a window out by its own rule. ScreenWidth keeps only the thresholds.
- Qt: PresentedWindow applies the presentation in setVisible (show/open/exec all reach it);
  every Qt dialog lists it first (settings, team, keymap, transfers, queue inspection, delivery
  details, command window, goal history/edit, path search) and drops its own window flags and
  fit_screen. Android's back key and the header's ← close as Close does.
- Textual: the settings panel's width is PanelPresentation.for_width(...).panel_width().
- tools/qt_inherit_ratchet.py fails a Qt QDialog outside PresentedWindow (baseline 0; against
  the previous tree it lists all 12).
- tools/qt_drive.py windows_phone opens every OpensWindow action's window and fails on a window
  that does not fill a phone's app window or float on a desktop, on any widget drawn outside,
  and on settings pages under 60% of the window. The finger scenario no longer resizes dialogs
  by hand to fit the phone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…its width and seven tenths its height, inside the screen less its frame

Settings floated at 100x30 once its layout no longer imposed a minimum, and the team board
sat 2 px past an 800-wide screen's edge: placing the client area inside the screen less the
app window's frame margins keeps every part of it on screen (windows_phone at 1280x800).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…nts only what floats over the rows

Tristan, Pixel 8a (120 Hz), 2026-11-18: "messages coming in is still stuttery, not 120fps".
Two causes, measured with the `arrival` drive (burst of 5 into #scratch, frames recorded as the
history viewport paints them):

1. Rate: FOLLOW_ARRIVAL was a 60 fps Transition, and the clock repaints only when an effect's
   cadence boundary changes, so the glide moved on every other frame of a 120 Hz screen
   (unthrottled: interval median 17.0 ms). It is now a `Glide` (ui_theme `Motion`), shown every
   frame the medium shows. The Qt clock's frame interval is the window's screen's
   (`widget_animation.frame_interval`: one over its refresh rate, 60 Hz where it reports none),
   follows the window to another screen and a screen's refresh-rate change, and its timer is
   precise. The activity sweep reads the same owner instead of the screen itself. Textual's
   clock takes Textual's own frame interval. TransitionTarget's two-frame step reads the cadence.
2. Repaint: every gliding frame repainted the whole viewport, every row's rich text, because Qt
   repaints all of a scroll that a sibling overlaps and the pinned header, overlay scrollbar and
   jump bar float over the rows. PyQT-reactive's VirtualRowView now scrolls the uncovered part by
   its pixels (pyqt-reactive #67); the pinned header is opaque, so the rows under it are not
   painted at all. A gliding frame repaints a median 5% of the viewport (was 100%).

The drive records painted frames (interval, distance, repainted share) and marks the burst
("burst: posting") so a profiler can attach to it. Needs ui-theme #34 (Glide, Cadence,
AnimationClock.frame_interval) and pyqt-reactive #67 in the runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
… chips, and compose

offers Attach only where the bus takes files

The phone's APK on the laptop's older bus failed every history page on the files read
that bus did not serve. With agent-comms' OptionalRead the page read answers no files
there. Compose learns the same fact from the same Core answer it already read:
refresh_composer takes one ComposeAccess (read_only, takes_files) built by
MessageDestination.compose_access(core), where a bus takes files exactly when it serves
the files read (files and that read shipped together in #4889).

- ComposeAccess owns the held reason (block_reason; both views drew it from a copy of
  the same conditional) and refuses a draft carrying files to a bus that takes none, so
  delivery returns it with that reason instead of an old Core's "Unknown fields".
- The shared MessagePromptComposer stores takes_files (offer_files) and guards
  attach_file; Qt hides its Attach button and the TUI's AttachFileAction is offered only
  while the bus takes files. An agent prompt attaches nothing and offers nothing.
- Page sources answer compose_access() in place of read_only().

Tests: tests/textual/test_older_bus.py (a Core posting each request as across the
connector, serving every tool but the file reads and refusing them as the old connector
did): the page draws its messages with no chips and the files read is never posted;
compose_access says takes no files and refuses a draft with files; a message composer
stops offering Attach and says why. Drive older_bus on the live bus with an older
connector's tool list: no notice, no error file, takes_files False, Attach hidden; the
control run offers Attach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…e caller gives it its own

Run as a script with no XDG_CONFIG_HOME or XDG_STATE_HOME, the drive sets both under OUTDIR before
anything of Toad is imported. Drives run without them wrote the real toad.json (2026-11-17); every
caller had to remember both. Proved by a menu_text run with both unset: exit 0, the real toad.json's
mtime unchanged, the drive's client db under OUTDIR/state/toad.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…e message head

A reader dragging a channel's history to the top was stranded there. The shared
preparation rule requests a page only for measured travel ("Stationary input never
requests another source page"), its idle expiry is 0.2 s, and Qt measures no finger
travel while QScroller drags. A pull past the top moves nothing, so nothing asked for
the next page until the next drag happened to start early enough. On #comms an older
page appeared 7.1 s, and once 145 s, after the reader reached the top. The wheel at an
edge already asks (`wheelEvent` → `request_boundary`); a finger now does the same from
QScroller's overshoot (`QtHistoryWindow.overshot`), so it is never stranded.

Steady-state work while reading:
- A receipt update repainted nothing but laid every history row out again
  (`QtConversationHistory._show` → `rows_changed`) before the new looks were even
  prepared. It now repaints the rows it changed; the delegate's own prepared-row path
  lays them out.
- `HistoryRows.row_of` scanned every row's key per lookup (per changed row on each
  receipt update, arrival, glide and reader restore); the model keeps a key → row
  index built with its rows.
- Re-applying an unchanged style sheet repolishes a widget and posts a LayoutRequest
  up its parents. The session-status title (each status row), the composer frame
  (each focus change), the "Your last message" line (each notification) and the flash
  restyled every time, re-laying the composer out. `QtLineRenderer.apply_sheet`
  applies a sheet only when it differs.
- A history row's formatting resolved every path-like word on disk (realpath plus
  stat, per word, per row, per width) on the phone's row thread, which shares the
  interpreter with the UI. `ProjectLink.linked_file` checks a spelling once per 10 s
  for drawing it as a link; opening a link still checks the file as it is then.

Tap on a message (Tristan: "it makes the header align with the top of the screen.
It's useful, but it has pretty big input delay, and sometimes interferes with
scrolling"). Qt's align was accidental: a press made its row current and
QAbstractItemView.autoScroll scrolled it into view at once, a jump, and one that
fought a drag starting on a row. Now:
- autoScroll is off;
- a tap (the app's one press classifier, `FingerPress.tapped`) on a message whose
  head is above the viewport glides the head to the top (`HEAD_REVEAL`, through the
  shared clock), as Textual's clicked-head reveal does;
- the head is the same shared rule in both frontends (`HistoryFragment.message_head`);
- a head already on screen stays put; a finger taking the rows stops the glide;
- a tap that stops moving rows reveals nothing.

Tools: qt_drive `history_scroll_back` (finger scroll-back to the history's start, per-page
time after reaching the top, the probe's stalls, the work it repeats, and the three touch
checks through the window), `tools/tui_scroll_back.py` (the Textual side, line for line),
and `tools/history_bus.py` (a scratch bus with a long #comms, served as the phone reaches
a bus).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
A tap while a fling is still moving the rows caught them but let the fling run on
(1335 px in the drive). It now stops the scroller and claims the press, opening no
link and revealing no head, as Android's lists do.

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

1 participant