Skip to content

Show AI-assist messages immediately, with Cancel and Retry, in a shared assist thread #1552

Open

Description

@paullizer

Summary

Part of #1543 (Track A1). Fix the input experience in the V2 AI-assist side channels: the diagram, chart, image and orchestration plan editors. Your message should appear in the thread and the input should clear as soon as you send, with a pending AI turn you can cancel or retry. One shared component replaces the four copies.

User Value

Today, after you send in an assist editor, your text stays in the input and nothing appears in the thread until the AI answers, so it looks like nothing happened. A failed request has no clear retry. The editors also disagree on which key sends, and long instructions are silently cut off.

Proposed Behavior

  • The bug, confirmed in all four editors:
    • DiagramEditor.tsx:162-172 and ChartEditor.tsx:211-221 await askBlockRevision, which merges stored turns only after the response (chatStore.ts:3376-3406), and clear the input only on success.
    • ImageEditor.tsx:161-181 behaves the same way and has no transcript.
    • The plan editor's submitPlanRevision only sets submitting (orchestrationController.ts:1364-1420).
    • The plan editor sends on Ctrl/⌘+Enter; the others send on Enter.
    • blockRevisions.ask silently truncates to MAX_INSTRUCTION_LENGTH.
  • The fix: one AssistThread component and useAssistThread hook, following Score's useAssistConversation:
    • on submit, clear the input and append your turn plus a pending AI turn ("Working… 12 s · Cancel")
    • on failure, the AI turn shows the error with Retry and Edit and resend
    • only completed exchanges are replayed to the model
    • Enter sends, Shift+Enter adds a newline, and Ctrl/⌘+Enter stays as an alias
    • role="log" with aria-live="polite"
    • a character counter instead of silent truncation
    • optimistic turns reconcile with server-stored turns by a client submission_id, including on the shared-chat collaboration path
  • Built on ComposerEditor with a new restricted mode: # documents and tags plus Add context, with no uploads or / prompts. It's off by default and stays off in the diagram, chart and image editors. A2 and Phase 3 turn it on.
  • Migrate DiagramEditor, ChartEditor, ImageEditor (which gains a small transcript) and OrchestrationPlanEditor.

Acceptance Criteria

  • In all four editors, your message moves into the thread immediately and the input clears.
  • Cancel, Retry and Edit and resend work, and a failed request never leaves an orphaned or duplicated turn in stored history.
  • Existing revision behavior is unchanged, including in shared chats.
  • Over-limit input shows a counter and is rejected instead of truncated.
  • Playwright covers all four editors, plus a regression check of the orchestration question card, which also uses ComposerEditor.
  • Release notes and config.py version.

Notes

Metadata

Metadata

Labels

P1Priority 1: urgent, address before P2 workenhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions