Skip to content

qt: every conversation answers the view keys; a key two shortcuts share runs by the declared order - #2103

Merged
trissim merged 2 commits into
mainfrom
fork-qt-thread-view-actions
Nov 18, 2026
Merged

trissim merged 2 commits into
mainfrom
fork-qt-thread-view-actions

Conversation

@trissim

@trissim trissim commented Nov 18, 2026 •

Copy link
Copy Markdown

What was wrong

  • Thread/DM and agent views bound no view actions. Escape-to-latest (BackToBottomAction) was bound only on the channel view (ConversationView), so a thread did nothing on Escape (found by gate: run the shipped app on a scratch bus; Qt binds only actions its context can run #2099).
  • Even on the channel, a real Escape typed in the composer ran nothing. The composer's DismissAction also answers Escape, and Qt fires neither of two shortcuts sharing a key on the focus path (activatedAmbiguously). The shipped gate presses keys with activated.emit(), so it never saw this.

The fix

  • One binding owner: QtConversation is now the JumpsHistory and binds the ViewAction family. Channel, thread/DM and agent-session views answer the view keys their context provides, as Textual's workspace screen does for whichever conversation it shows. ConversationView's own copy (the base, back_to_bottom_windows and the binding) is deleted.
  • Declared key order: ActionKeys keeps each live shortcut as a BoundAction (shortcut, action, fire, context) and answers activatedAmbiguously with Textual's binding order, read from the declarations. priority actions go first, outermost first, then the rest from the focus outward. The first whose action is available there runs.
    • Escape in a composer jumps a history that is off its tail (BackToBottomAction is priority).
    • Otherwise Escape falls through to the composer's dismiss.
    • BoundAction is declared QT_ONLY with that reason.

Evidence (head e25dcad, on main 6485a58)

New qt_drive escape: real QTest Escape key in the composer, offscreen at 412 px on the live bus.

view scrolled off tail after Escape at tail, Escape with a draft
#comms (ConversationView) 13776 / 16440, jumpable 18076 / 18076, following draft cleared
scratch-live-pipeline (QtMailboxView) 0 / 5793, jumpable 5793 / 5793, following draft cleared

Before this change: the thread had no Escape shortcut at all. On #comms the shortcut was bound, but a real key left the view at 15412 / 18076. Only emitting the shortcut directly jumped it.

Gates:

  • tools/android/check.sh: exit 0, shipped run passed ("shipped app ran every view kind and bound key"). The thread now presses BackToBottomAction.
  • Ratchet exit 0: bare 21 / 21, copies 0, Qt-only 15.
  • shadow_check: 0.

Second commit: the shipped gate presses every key for real

  • New gate behaviour: shipped now presses every key a live shortcut answers as a real QTest key event, with focus in the composer and again on the history. It does this in the channel, in the thread, and in the thread again in vim normal mode, because the reader keys are vim-only. Each press must run exactly what the declared order picks (ActionKeys.order + available), recorded in ActionKeys.ran.
  • The bug it found: pressed for real, Enter, Shift+Enter and Ctrl+Y in the composer ran nothing. QPlainTextEdit accepts the shortcut override for keys it edits with, so its text control took them first.
    • Fix at the owner: ActionKeys.claims(event) (an available priority action answers this key), and ComposerEditor declines the override for such a key. This matches how Textual's priority prompt bindings beat its text area.
  • Scratch bus grant: the scratch bus's UI grant is now ui_access, as the phone's is. With the read-only grant, a real submit failed with "no tool 'comms_user_send'".

check.sh exit 0. Every press:

run composer history
channel, thread (standard) Enter→Submit, Shift+Enter / Ctrl+J→Newline, Ctrl+Enter / Ctrl+Y→SubmitNow, Esc→BackToBottom Esc→BackToBottom
thread (vim normal) same Ctrl+D→PageDown, Ctrl+U→PageUp, Shift+G→Latest, Esc→BackToBottom

Ratchet exit 0 (bare 21/21, copies 0); shadow_check 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

trissim and others added 2 commits November 18, 2026 01:36
…re runs by the declared order

Escape-to-latest (`BackToBottomAction`) was bound only on the channel view, and even there a
real Escape typed in the composer ran nothing: the composer's `DismissAction` answers Escape
too, and Qt fires neither of two shortcuts sharing a key on the focus path.

- `QtConversation` is the `JumpsHistory` and binds the `ViewAction` family, so channel,
  thread/DM and agent-session views all answer the view keys their context provides, as
  Textual's workspace screen does for whichever conversation it shows. ConversationView's
  own copy (base, property, binding) is deleted.
- `ActionKeys` keeps each live shortcut as a `BoundAction` (shortcut, action, fire, context)
  and answers Qt's `activatedAmbiguously` with Textual's binding order, read from the
  declarations: `priority` actions outermost first, then the rest from the focus outward;
  the first whose action is available there runs. Escape in a composer jumps a history
  that is off its tail, and otherwise dismisses the draft.
- `qt_drive escape`: in #comms and scratch-live-pipeline, scroll off the tail, type a real
  Escape in the composer, assert the latest row; at the tail, assert Escape clears a draft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…ority keys to their actions

The shipped run fired `QShortcut.activated` directly, so it never saw focus routing or two
shortcuts sharing a key. Pressed as real key events, Enter, Shift+Enter and Ctrl+Y in the
composer ran nothing: QPlainTextEdit accepts the shortcut override for keys it edits with,
so its text control took them before any shortcut. (Escape worked only because the text
control does not claim it.)

- `ActionKeys.order` is Textual's binding order over the live shortcuts on the focus path
  (priority actions outermost first, then the rest from the focus out); `resolve` runs it
  and `run` records each action a press ran in `ActionKeys.ran`.
- `ActionKeys.claims(event)`: an available priority action answers this key. The composer's
  editor declines the shortcut override for such a key, so Enter sends and Shift+Enter starts
  a line through their declared actions, as Textual's priority prompt bindings beat its text
  area.
- `shipped` presses every key a live shortcut answers as a real QTest key event, with focus
  in the composer and again on the history, in the channel, the thread, and the thread in
  vim normal mode (the reader keys are vim-only). Each press must run exactly what the
  declared order picks (`order` + `available`), never something else or nothing.
- The scratch bus's UI grant is `ui_access`, as the phone's is: a submit pressed for real
  now reaches the bus, and the read-only grant had no send tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
@trissim
trissim force-pushed the fork-qt-thread-view-actions branch from 3b92120 to aad4cc4 Compare November 18, 2026 06:37
@trissim
trissim merged commit f49a87a 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