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/.
- 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).
- 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).
- 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
- Start a comment on pad text, so the chat composer opens in comment mode.
- Turn the network off in the browser DevTools.
- Type a short comment and send it.
- See the error toast and an empty composer. The comment text is gone, and comment mode has ended.
Acceptance criteria
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.
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 underapps/webapp/src/components/chatroom/.shouldClearComposerEarlyis 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 atcomponents/MessageComposer/hooks/useComposerSubmit.ts:160. It clears the comment memory, the saved draft, and the editor (:86-116).dispatchOutboundChunkcallssendComment(utils/outboundMessagePipeline.ts:266-279).sendCommentMessageinserts with.throwOnError()(apps/webapp/src/api/messages/sendCommentMessage.ts:33), anduseApithrows the error again (apps/webapp/src/hooks/useApi.ts:34).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
Acceptance criteria
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()andshouldClearComposerEarly— the early clear.dispatchOutboundChunk()— its comment branch callssendComment.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.