Skip to content

Suppress CLI draft while live ACP response is streaming (fix duplicate TUI/Qt streaming) - #2329

Merged
trissim merged 1 commit into
mainfrom
fix/suppress-cli-draft-during-live-response
Nov 27, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/suppress-cli-draft-during-live-response

Conversation

@trissim

@trissim trissim commented Nov 27, 2026

Copy link
Copy Markdown

Root cause (IDEN-5: two live presentations of one in-progress reply)

When a thread connected over live ACP (Antigravity ACP via ExternalTurnTranscriptSink.on_chunk every 0.25s, or Pi via TurnDraftPublication) streams assistant text:

  1. ACP AgentMessageChunk streams into a live AgentResponse (Textual) / QtResponseBlock (Qt) via LiveOutput.
  2. In parallel, ExternalTranscript.draft fires TranscriptDraftUpdate(DraftFold) -> CanonicalSourcePublication.show_draft -> Conversation.show_draft (src/toad/widgets/conversation.py:1028) / QtThreadView.show_draft (src/toad/qt/thread_view.py:256), mounting CliDraft right below AgentResponse so the same reply streams twice in parallel until ExternalTranscript.finish clears the draft to NoDraft.

Fix

  • Declare LiveResponsePresentation(SnapshotPresentation) in src/toad/commit_claims.py, inherited by AgentResponse and QtResponseBlock (while QtThoughtBlock inherits SnapshotPresentation, QtLiveBlock directly so thoughts never suppress assistant drafts).
  • Add DraftCoverage / covers_live_draft in src/toad/client/committed_presentation.py and suppress DraftFold to NoDraft() in CanonicalSourcePublication.show_draft (src/toad/transcript_publication.py:271) whenever a live response presentation is already in view.live_blocks.
  • Add TurnPresentation.clear_draft + ResponseStream.claim_draft (src/toad/live_output.py) so opening a live response block clears any CliDraft that arrived milliseconds earlier.
  • Move CliDraft reordering inside DraftPresentation.draft (src/toad/widgets/cli_draft.py) so NoDraft ticks no longer churn move_child.
  • CLI bridges (Codex/Claude) and remote/observation-only viewers have no LiveResponsePresentation in live_blocks, so their CliDraft behavior is unchanged.
  • Also fix two pre-existing reds met in the focused suite: hoist fragment_classes onto TranscriptHistory / QtTranscriptHistory so PreparedPageCommit.capture works over ClosedHistory (fixing test_closed_same_source_commit_acquires_complete_coverage), and fix the stale loader assertion + missing require_commit() in tests/textual/test_checkpoint_first_source.py.

Verification

  • REL_IMPORTS=0, qt_inherit_ratchet: 0/0/0/0/0, shadow_check: 0, guarded_imports: 0.
  • Focused suite (test_live_draft_suppression.py, test_checkpoint_first_source.py, test_shared_hook_sequences.py, test_deleted_rendering_names.py): 45 passed in 10.05s, plus test_closed_same_source_commit_acquires_complete_coverage 2 passed.

@trissim
trissim merged commit 37268ef into main Nov 27, 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