Skip to content

delivery preview: a live setting turns the queue rows off; the summary keeps Textual's 3 lines - #2117

Merged
trissim merged 1 commit into
mainfrom
fork-delivery-preview-toggle
Nov 18, 2026
Merged

trissim merged 1 commit into
mainfrom
fork-delivery-preview-toggle

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

The delivery preview, meaning the queue summary ("Submitting (1): …", "Delivery (4 visible messages): …") and the delivery-controls row above the prompt, can now be turned off. With it on, it no longer resizes the history over and over.

The setting

ui.input.delivery_preview ("Show delivery preview?") is declared once in InputSettings, so it appears in both frontends' settings forms, persists in toad.json and applies live through PromptSettingEffects.apply_delivery_preview → sync_queue.

  • Default: on. The summary is the TUI's queue UX for agent prompts ("Queued (2): …"), so it stays on unless you turn it off.
  • Off: the summary and controls are neither built nor read. queue_summary is empty and the evidence walk behind it doesn't run, and shows_delivery_controls short-circuits. The history keeps its full height.
  • What's held stays reachable: the info bar shows ⧗ N held (QueueSource.held_count, one answer per source: native adds queued and restored prompts, bus adds visible messages a recipient hasn't taken). Selecting it opens the queue inspection, and Ctrl+Enter still sends ahead.
  • One shared owner, both frontends: PromptComposer holds the decisions (shows_delivery_preview, shows_delivery_controls, queue_summary, queue_hint). Qt's show_submitting became the shared abstract sync_queue that Textual's Prompt already had. Textual's new QueueHint and Qt's QtQueueHint only draw.

When it's on, it was expensive

Measured with qt_drive arrival on #scratch at phone throttle (CPUQuota 45%), timing the strip's calls and the history's resize and paint, each tree run with a fresh config:

main branch, on branch, off
history viewport height changes 65 7 0
history resizes 66 10 7
history row paints (CPU) 475 (108 ms) 304 (114 ms; one 15 ms outlier) 401 (83 ms)
reveal animation ticks 94 8 0
strip updates (CPU total) 27 (17 ms) 19 (11 ms) 26 held-count reads (8 ms)
summary height swung up to 104 px; history between 514 and 722 px held at 51 px (3 lines); history steady at 616 px none

The strip's own logic was cheap (about 0.5 ms a call). The cost came from the history: every frame of every reveal resized and repainted it. The summary wrapped to 5 or more lines at phone width, and its text kept changing as delivery statuses arrived, so it kept growing and shrinking. Two fixes, both at owners:

  • The Qt summary is cut at 3 lines, the same limit Textual's QueueSummary has always had (max_height = 3). Both now read it from one owner, PromptComposer.queue_summary_lines.
  • The Qt composer syncs its queue rows once per event-loop turn. A send publishes several changes, and every notification read reports the queue again. Before, each call could restart a reveal.

Evidence

  • New drive qt_drive delivery_preview: on #scratch it sends 2 messages with the setting on, then turns it off live and sends 2 more, then turns it back on. It fails on any queue row shown while off, the held count shown while on, or the history changing height while off. Result: exit 0.
    • On: the summary was shown and the held count wasn't.
    • Off: no summary or controls, held counts ⧗ 2/3/4 held, history height [721].
    • Back on: the held count was gone.
    • I read the off-state screenshot: no strip, the composer sits directly under the history, and ⧗ 4 held shows in the info bar next to the mode badge.
  • TUI test (tests/textual/test_delivery_preview_setting.py): an agent with 2 queued prompts. On, "Queued (2)" shows. Turned off live, the summary and controls are hidden and the hint reads ⧗ 2 held. Turned back on, the summary returns. It passes together with test_queue_request_results.py (5 passed). The queued-session response that test built locally is now one helper in tests/support/agents.py.
  • Arrival drive, on and off (#scratch, throttled): both exit 0, with no flicker, no plain-text first draws and no queue hide-then-show.

Gates, once on the final head

  • ratchet: Textual-UI modules 11/11, widgets imports 0, bare classes 21/21, copies 0.
  • shadow_check: 0.
  • glyph_check: 0.
  • tools/android/check.sh with PYTHONFAULTHANDLER=1: exit 0, no fatal error. The shipped app ran every view kind and bound key on a scratch bus.

No APK built.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

…ps Textual's 3 lines

ui.input.delivery_preview (on by default, both frontends, applied live): with it off, the
queue summary and delivery controls are neither built nor read, the history keeps its full
height, and the info bar shows only how many messages are held (`QueueSource.held_count`),
which opens the queue inspection when selected. Ctrl+Enter still sends ahead.

With it on, the Qt summary is cut at Textual's 3 lines (`PromptComposer.queue_summary_lines`,
which Textual's QueueSummary now reads too), and the Qt composer syncs its queue rows once
per event-loop turn. At phone throttle on #scratch, the history changed height 7 times
instead of 65, and repainted 304 rows instead of 475.

Qt's `show_submitting` becomes the shared `sync_queue` both composers implement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
@trissim
trissim merged commit 6b3d0bd into main Nov 18, 2026
1 of 2 checks passed
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