Repository navigation
turn presentation: shared turn code names what to show, each frontend draws it; permission review builds again - #2101
Merged
Merged
Conversation
trissim
force-pushed
the
fork-qt-acp-turns
branch
from
November 18, 2026 06:25
53abce9 to
584ac73
Compare
c0f6983 put `select_answer(index)` on `QuestionContext` as an abstract method, but every caller invokes `context.question.select_answer(...)`: the method is the question's. `PermissionsScreen` is a context that delegates to its own `PermissionsQuestion`, so it could not be built ("abstract select_answer"), which broke the permission review in the TUI and three tests: test_j_and_k_step_through_the_changes_from_the_question, test_a_request_changed_while_its_screen_push_is_pending_is_cancelled_or_shown_once, and the native permissions layout test. `ChoiceQuestion` now declares `select_answer`; `QuestionContext.question` returns one. Textual's `Question` and Qt's `QtQuestion` inherit both (each is its own question); `PermissionsScreen` stays a context only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…tend draws it The shared turn code built Textual widgets itself: LocalTurnBinding.present_input made a UserInput, ResponseStream/ThoughtStream.create made AgentResponse/AgentThought, and AgentFail/HelpAgentFail/FailureLog made ErrorNote/MarkdownNote/AgentResponse. Qt could not draw a turn, and six of those imports sat on the APK's KNOWN_LAZY list. toad.turn_presentation declares the hooks: present_user_input, response_block, thought_block, show_live_block, present_error_note, present_help_note, present_log_link, plus shows_live_output/after_live_output for LiveOutput. The streams and failures call them; LiveBlock is the block contract. Textual's Conversation answers with its existing widgets (no behaviour change). QtConversation answers with history rows: qt/live_turn.py's QtLiveBlock is one transcript event that grows in place, drawn as a QtLiveFragment after the saved history and the draft through the row delegate; HistoryFragment.revision (event count by default, the live text's revision here) keys the row cache, so a growing row re-renders. A finished block leaves when the window's committed pages change. KNOWN_LAZY 21 -> 15. qt_drive live_turn feeds an input row, a thought, a response streamed in three pieces, a failure and its help into a Qt view on the live bus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
trissim
force-pushed
the
fork-qt-acp-turns
branch
from
November 18, 2026 06:31
584ac73 to
fdcc582
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes.
1. Permission review could not be built (TUI regression)
c0f6983 put an abstract
select_answer(index)onQuestionContext, but every caller runscontext.question.select_answer(...). The method belongs to the question.PermissionsScreenis a context that hands off to its ownPermissionsQuestion, so it could not be built ("abstract select_answer"). That broke the TUI's permission review, and three tests failed:test_j_and_k_step_through_the_changes_from_the_questiontest_a_request_changed_while_its_screen_push_is_pending_is_cancelled_or_shown_onceThe fix: a new
ChoiceQuestiondeclaresselect_answer, andQuestionContext.questionreturns aChoiceQuestion. Textual'sQuestionand Qt'sQtQuestioninherit both, since each is its own question. All three tests pass.2. Shared turn code no longer builds Textual widgets
The shared turn code built Textual widgets itself:
LocalTurnBinding.present_inputUserInputResponseStream.createAgentResponseThoughtStream.createAgentThoughtAgentFail.presentErrorNoteHelpAgentFail.presentMarkdownNoteFailureLog.show_logAgentResponselinkSo Qt couldn't draw a turn, and six of these lazy imports sat on the APK's
KNOWN_LAZYlist.The contract.
toad.turn_presentationdeclares the hooks:present_user_input,response_block,thought_block,show_live_blockpresent_error_note,present_help_note,present_log_linkshows_live_outputandafter_live_output, whichLiveOutputusesThe streams and failures decide what appears and call these hooks;
LiveBlockis the block contract.Textual:
Conversationanswers with the same widgets as before, so the TUI doesn't change.Qt:
QtConversationanswers with history rows.qt/live_turn.py'sQtLiveBlockis one transcript event that grows in place.QtLiveFragmentafter the saved history and the draft, through the row delegate, so the sticky header and the reader's place work on it.HistoryFragment.revisionis the event count by default and the live text's revision here. It keys the row cache, so a growing row renders again.KNOWN_LAZY: 21 → 15.
check.shreported all six chains GONE, and their lines are deleted.Evidence (final head 53abce9, on main 526f26a)
live_turn: onscratch-live-pipelineagainst the live bus, it feeds a Qt view an input row, a thought, a response streamed in three pieces, a failure and its help.committed_pages_changedclears the finished blocks.Userdivider with the input bar, the muted thought, and anAgentdivider over the response.tabs,composerandmenuall exit 0 with no stray windows.composer's traceback is its intended forced send to#composer-drive-missing.shadow_check: 0.tools/android/check.sh: exit 0 at 15/15.test_window_top_edge[size1], which fails on its own at both sizes on both trees, every time.test_live_output_streams.pydeclares its own stream; it's updated to the newcreate(view, fragment).test_reader_position_in_live_output.py::test_reader_returns_to_the_same_session_after_a_switch. The template server waits onProcessPoolExecutorworkers that never exit: the preparation pool shutdown the feedback fork is fixing.Not in this PR
Running an ACP agent on Qt. Qt launches with
NoAgent(qt/window.py) and nothing callsbinding.attach_to(...)on a Qt view.QtAcpSessionViewonly reopens a saved session, so no agent replies there today. This PR gives Qt the turn drawing; making an agent run on Qt is a separate port:AttachedSurfaceBindingdelivers agent events through Textual'spost_message, and its terminal path builds aTerminalToolwidget.OperationalSessionSources.create_agent.QtAcpSessionViewimplementingAgentConversation, and the Qt session entry callingattach_to.AgentAttached.Android can't run an ACP agent process in any case.
🤖 Generated with Claude Code
https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3