Skip to content

Keep a comment's text when it fails to send #281

Description

@HMarzban

Problem

A document comment that fails to send loses its text. The composer clears before the send, and the comment path has nothing that gives the text back.

On 14ab7f9c1. Paths are under apps/webapp/src/components/chatroom/.

  1. A comment that fits one row clears the composer before the send. shouldClearComposerEarly is true when the chunker returns no chunks and there is no edit (utils/outboundMessagePipeline.ts:52-55, :125). An empty chunk list means the text fits one row (apps/webapp/src/utils/chunkHtmlContent.ts:61-66). cleanupAfterSubmit() runs at components/MessageComposer/hooks/useComposerSubmit.ts:160. It clears the comment memory, the saved draft, and the editor (:86-116).
  2. The comment branch of dispatchOutboundChunk calls sendComment (utils/outboundMessagePipeline.ts:266-279). sendCommentMessage inserts with .throwOnError() (apps/webapp/src/api/messages/sendCommentMessage.ts:33), and useApi throws the error again (apps/webapp/src/hooks/useApi.ts:34).
  3. The submit catch shows a toast and returns (components/MessageComposer/hooks/useComposerSubmit.ts:172-180). By then the text and the comment mode are gone.

A reply and a plain send keep their text, because their optimistic row holds it, and Retry sends it again. A text send while the Media only filter is on is the exception. It appends no optimistic row, so it loses its text too. An edit is never cleared early. A comment has no optimistic row and no Retry.

Steps to reproduce

  1. Start a comment on pad text, so the chat composer opens in comment mode.
  2. Turn the network off in the browser DevTools.
  3. Type a short comment and send it.
  4. See the error toast and an empty composer. The comment text is gone, and comment mode has ended.

Acceptance criteria

  • When a comment fails to send, the composer shows its text again, in comment mode, on the same anchor.
  • After the network returns, sending again from that state posts one comment on the same anchor.
  • Pressing send again while a comment is still sending posts one comment, not two.
  • A successful comment still clears the composer.

Agent Brief

Category: bug
Summary: A comment that fails to send must keep its text, its comment mode, and its anchor in the composer.

Current behavior:
The composer clears the text, the comment mode, and the anchor before a comment that fits one row is sent. When the insert fails, only a toast shows. The comment path has no optimistic row and no Retry.

Desired behavior:
A failed comment keeps the text in the composer, keeps comment mode on the same anchor, and shows the error.

Key interfaces:

  • cleanupAfterSubmit() and shouldClearComposerEarly — the early clear.
  • dispatchOutboundChunk() — its comment branch calls sendComment.
  • sendCommentMessage() — inserts the comment row.
  • CommentMessageMemory — holds the comment anchor.

Out of scope

Notes

Coordinate with #263. It builds the send hand-off on the same early clear.

Coordinate with #266. Both fixes change what the early clear does in comment mode. Today the clear also removes a comment's attachments from the composer and deletes their uploads. So a restored comment cannot send them again.

Do not keep the comment text in the chat store mode memory or in the composer context (apps/webapp/src/components/chatroom/CLAUDE.md:69, :73).

The evidence is a code trace on 14ab7f9c1. It was not reproduced in a browser.

Activity

  1. added
    bugSomething isn't working
    ChatRelated to chat features
    on Sep 14, 2026
  2. added a commit that references this issue on Sep 22, 2026
    875017d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ChatRelated to chat featuresbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions