Repository navigation
fix: clear the chat box after sending and keep drafts per conversation - #2430
Conversation
The composer kept one draft and one sending flag for every conversation and cleared the text only after the Gateway accepted the message. Text stayed in the box after Send, followed you to other conversations, and a pending send could lock the box in another conversation. Drafts and sending state are now per conversation. The box clears as soon as a send is admitted locally and the text is restored if the send fails. Session switches and removals are fenced, and a removed conversation's draft is cleared only after the Gateway confirms removal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🦞👀 ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: passed. What this changesThe PR clears admitted submissions immediately and keeps drafts, attachments, and sending state separate for each conversation. Example: Send “Summarize notes” in conversation A while acceptance is delayed, then select conversation B.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses composer behavior still present on main, and the pinned diff contains no definite introduced defect. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe mounted native chat composer receives conversation projections and user input, delegates sends through the existing runtime adapter, and projects conversation-specific drafts and operation results back into WinUI. flowchart LR
User[User input] --> Composer[Reactor composer]
Composer --> Controller[Composer controller]
Controller --> Drafts[Conversation draft state]
Drafts --> Composer
Controller --> Runtime[Existing runtime adapter]
Runtime --> Gateway[Gateway and send queue]
Gateway --> Controller
Technical reviewBest possible solution: Land the conversation-scoped repair within the existing composer and Workspace owners after the existing validation gates settle. Do we have a high-confidence way to reproduce the issue? Main's shared draft and send gate establish the reported cross-conversation path directly; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch addresses the state ownership cause using existing owners, preserves newer edits and delayed ingress, and adds only a test hang-guard environment option rather than a user setting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6c14fe598718. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating guidance
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed December 1, 2026, 11:51 AM ET / 16:51 UTC. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep shared message normalization for Ask OpenClaw and chat, while retaining per-conversation clearing at send admission. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep drafts in other conversations from blocking Ask OpenClaw prefills, and clear the active text through the per-conversation view model. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
c3d9a4c34620f7437c082357978ffa683a48804b↑ CI Gate passed, including the previously failing sidebar checks.
↓ Physical Enter, repeated Enter, Shift+Enter and caret handling remain unverified: the local test could not obtain focus and the hosted shard skipped it.
↑ The old code waited for acknowledgement to clear a shared editor. The same three assertions passed on the fix.
↓ This was not a replay of the reporter's live Gateway session.
What Problem This Solves
When you send a chat message in Companion, the text stays in the chat box, so it appears both in the conversation and in the box. If you then switch to another conversation, the old text follows you there, and the chat box can stay locked to the previous conversation while a send is still pending.
User Impact
User impact: the chat box clears when your message is sent, so the text no longer shows in both places. Each conversation keeps its own unsent draft. Switching conversations shows that conversation's draft (empty for a new chat) and brings yours back when you return. A pending send in one conversation no longer locks the box in another. If a send fails, your text comes back in that conversation's box, ahead of anything you typed while it was sending. Archiving or deleting a conversation clears its draft only after the Gateway confirms the removal; if the Gateway rejects it, your conversation and draft stay as they were.
Why This Change Was Made
The composer kept a single draft and a single "sending" flag for every conversation, and cleared the text only after the Gateway accepted the message. This change stores drafts and the sending state per conversation. It clears the box as soon as the send is admitted locally, before any new-chat setup and without waiting for the Gateway to accept it, and restores the text if the send fails. It also fences session switches and removals so a late result for a conversation you have left cannot overwrite the one you are viewing. A new local chat's draft moves to the real Gateway session once the Gateway creates it.
Implementation notes
ChatComposerViewModelowns a per-conversation draft map, binds and promotes a local draft to its materialized session, and tracks sending state per thread.ChatComposerControllerandChatComposerSessiontake the draft once the send passes local admission (before new-chat setup) and restore it on failure or rejection. They also admit a materialized session.ChatPage,SessionsPage,SessionsHubController,App,WorkspaceWindowandDesktopCompanionChatHostclear the removed conversation's pending state only after the Gateway confirms removal.ChatComposerSubmissionPolicy.ShouldClearInputis removed because clearing no longer waits for acceptance.docs/ARCHITECTURE.mdanddocs/CHAT_VISUAL_DESIGN.mddescribe the new draft ownership and composer states.Evidence
Real behavior proof
On the same disposable Windows desktop, the unmodified main build (
02c1b86d) failed three checks at the reported behavior: the message stayed in the textbox while the fixture Gateway held the acknowledgement, and the fork's draft appeared in Home in both Light and Dark. Onc3d9a4c, all three passed in both Debug and unsigned non-Dev Release. Returning to the fork restored its exact draft. Native captures also showed the sent message in the transcript with an empty textbox.The other four passing scenarios in each configuration covered switching the mounted editor during a pending send, confirmed removal, rejected removal, and prefilling the active editor while another conversation retained a draft.
Validation
.\build.ps1dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet vstest C:\repo\tests\OpenClaw.Tray.Tests\bin\Debug\net10.0\OpenClaw.Tray.Tests.dllin the guestNot verified / blocked
ComposerInput_NativeKeyboardPreservesCaretAndEnterSends; green CI does not close this gap.Review: A bounded independent review of the Ask OpenClaw integration on
c3d9a4cfound no reproducible defect. The three earlier Hanselman dual-model rounds (claude-opus-5.5high,gpt-6-astralong context high) covered the pre-integration change, not the entire final head:MaterializationHistoryWait_CanStillBeCancelleddoes not switch the visible conversation; the transport-phase test covers the same lookup.The subsequent UI assertion updates cover clearing while new-chat setup is pending and switching from a fork to Home and back. They do not change product behavior.
Known limitations (LOW, not changed here)
ChatPage.CurrentAppstill uses a hard cast (unchanged from base).Required proof pools
windows-winui-interactive: the chat composer's clearing, per-conversation drafts and session-switch behavior changed. Only partly covered locally (see Not verified / blocked).