Repository navigation
fix(chat): make Enter send from the multiline composer - #1674
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. Reviewed October 7, 2026, 6:43 PM ET / 22:43 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR handles chat keyboard shortcuts before the multiline text box consumes Enter and adds a native keyboard assertion that pressing Enter again leaves the cleared draft unchanged. Merge readiness⛔ Needs changes before merge - 1 item remains This remains a useful focused fix absent from current main. No blocking code defect was found, and the member-authored PR is protected from automatic closure. Priority: P2 Review scores
Verification
How this fits togetherCompanion’s native chat composer receives keyboard input and forwards draft and send actions to the existing chat controller. The controller admits submissions, sends them through the chat provider, and clears accepted drafts. flowchart TD
A[Keyboard input] --> B[Native chat composer]
B --> C{Shortcut selection}
C --> D[Slash command selection]
C --> E[Shift Enter inserts newline]
C --> F[Enter requests send]
F --> G[Chat controller and provider]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep keyboard interception in the native composer while preserving the existing slash-selection, draft, and send owners. Do we have a high-confidence way to reproduce the issue? No high-confidence runtime reproduction was established. Current main uses the bubbling handler on a multiline text box, and the existing opt-in native keyboard theory provides a focused check, but its Windows run remains blocked. Is this the best way to solve the issue? Yes, source inspection supports preview-event interception as a focused repair that preserves native Shift+Enter handling and existing slash precedence. Actual WinUI routing still needs the declared interactive validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ba89f377ce8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
What Problem This Solves
Fixes Companion chat inserting a newline when users press Enter, despite advertising Enter to send.
User Impact
Enter sends the draft. Shift+Enter continues to insert a newline, and slash-command selection retains precedence.
Why This Change Was Made
Handle composer shortcuts in
PreviewKeyDown, before the multiline WinUI TextBox consumes Enter. Draft/send/slash workflow ownership remains in the existing view model and controller; the composer remains the native keyboard adapter.Evidence
The existing native-keyboard theory covers five caret/selection positions, Shift+Enter, typed text and exact submitted content. Extended it to verify a second Enter after sending neither sends again nor inserts an empty newline, and to capture the post-send state.
Rubber-duck review: no blocking findings. Verified preview-event choice, slash shortcut precedence, Shift+Enter preservation and post-render empty-draft assertions.
Change Type
Scope
Required proof pools
windows-winui-interactive: native Enter/Shift+Enter routing requires the real WinUI TextBox and an interactive foreground desktop.Validation
CI retry on unchanged head
The first hosted UI job hung in WinUI test-host bootstrap before any tray UI test completed, then the five-minute inactivity watchdog aborted it. Retried failed jobs without changing
bfcdc10176910b98972f9717aa0e32d0b49400e7.Build and Test attempt 2 passed, including CI Gate:
No source changes or test exclusions were needed. Native-keyboard theory remains skipped in hosted CI, so this does not fulfill the interactive proof pool. A new Crabbox acquisition attempt still failed with fleet capacity
21/20; no lease was issued. C# security was still running at this update.git diff --check: passed.dotnet build tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: passed on macOS, 0 warnings/errors.dotnet build tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: passed on macOS, 0 warnings/errors. These builds do not compile the changed WinUI composer or UI theory.pwsh -NoProfile -File ./build.ps1: blocked, reportsThis project requires Windows.pwsh -NoProfile -File ./scripts/setup-dev.ps1 -CheckOnly: blocked, reportsOpenClaw Windows development requires Windows.OPENCLAW_REPO_ROOT="$PWD" dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: macOS diagnostic run failed, 4,127 passed, 135 failed, 35 skipped (4,297 total). Windows-dependent path, execution and IPC behavior fails on this host. This is not native Windows closeout validation.OPENCLAW_REPO_ROOT="$PWD" OPENCLAW_TRAY_DATA_DIR=/tmp/chat-enter-tray-tests dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: macOS diagnostic run failed, 3,892 passed, 102 failed, 2 skipped (3,996 total). Failures include Windows-style source paths, Windows DPAPI and Windows IPC. This is not native Windows closeout validation.OPENCLAW_REPO_ROOT="$PWD" OPENCLAW_TRAY_DATA_DIR=/tmp/chat-enter-focused-tests dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore --filter "FullyQualifiedName~ChatComposer|FullyQualifiedName~ChatRootComposerClosureTests": 109 passed, 0 failed, 0 skipped. Covers existing composer/controller policies, not native key routing.crabbox warmup --provider azure --target windows --windows-mode normal --desktop --keep --idle-timeout 90m --ttl 240m --timing-json. Both rejected with HTTP 429cost_limit_exceeded,fleet active lease limit exceeded: 21/20. No lease ID or run URL was issued; no cloud lease requires cleanup.Real Behavior Proof
bfcdc101.dotnet test tests/OpenClaw.Tray.UITests/OpenClaw.Tray.UITests.csproj -r win-x64 --filter FullyQualifiedName~ComposerInput_NativeKeyboardPreservesCaretAndEnterSends, withOPENCLAW_RUN_KEYBOARD_PROOF=1,OPENCLAW_REPO_ROOTpointing to this checkout, and isolated tray data/appdata/localappdata roots. EnableOPENCLAW_VISUAL_TEST=1andOPENCLAW_VISUAL_TEST_DIRfor captures../build.ps1, Shared tests and Tray tests with--no-restoreafter building fresh test projects.Security Impact
No new permissions, credentials, network calls, command execution or data access.
Compatibility and Migration
Backward compatible. No configuration changes or migration.