Skip to content

fix: paste chat text once after using the context menu - #2371

Merged
bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:fix/chat-paste-shortcut-ownership
Nov 25, 2026
Merged

bkudiess merged 1 commit into
openclaw:mainfrom
bkudiess:fix/chat-paste-shortcut-ownership

Conversation

@bkudiess

@bkudiess bkudiess commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

After opening and dismissing the chat editor's context menu, one Ctrl+V could paste the same text three times. This makes composing or editing messages error-prone.

User Impact

User impact: paste inserts text once, whether the chat context menu is open or has been dismissed. Native Copy/Cut/Undo/Redo/Select All, image paste, shortcut hints and screen-reader shortcut information remain available.

Why This Change Was Made

Keep one keyboard-editing owner: the TextBox outside the menu, and native accelerators scoped to the menu's own presenter while it has focus. Disable menu accelerators after dismissal. This prevents leftover shortcut handlers without a debounce or a custom clipboard/key-forwarding path.

Hanselman dual-model review caught an open-menu keyboard regression in the first candidate. It was reproduced against a stock Windows TextBox, repaired, and revalidated before this PR. No controller, network, permission or settings changes.

Evidence

  • Before: the exact four-case native regression ran twice. Fresh normal/compact editors pasted once; both menu-dismissal cases pasted three copies and raised three Paste events.
  • After: the unchanged four cases paste once. The expanded native suite passes 16/16, zero failed/skipped, including open-menu Ctrl+V, multi-step Undo/Redo, UIA menu invocation, shortcut/accessibility metadata, outside-editor focus and one bitmap-decode start.
  • Stock-control comparison established the open-menu review finding before repair: stock TextBox pasted once, initial candidate pasted nothing. Final candidate matches the stock control and still prevents duplicate paste after dismissal.
  • Independent Hanselman review used Claude Opus 5.5 and GPT-6 Astra, high reasoning requested, user-approved default context. Runtime-reported Opus route: claude-opus-5.5 to claude-opus-5-5. Both reviewed the final identical file hashes. No remaining verified product defects; optional wording/redundant-assertion suggestions are documented, not represented as bugs.
Final reviewed and tested source identity

Validation ran on the dirty source tree rooted at 64727b8dbd382a98e813977fd3bf4d66324ba9ef, before the publication-only commit. Publication commit 0d257b42e50c44811238b7889acfcad06d5d57d2 was checked against these exact four source hashes. The earlier validation was not rerun at the publication commit.

File SHA256
ReactorChatComposer.cs 6A254F0DD44E347711C12A3600A74BD33AC5EF273CE2AA2E3BC8505DF7992019
ReactorChatLayoutProofTests.Clipboard.cs A10E57003263C039F18D40716C2E502A549072368B8DFEE05A6DD522FC2F77D4
ReactorChatLayoutProofTests.EditCommands.cs 6EA85CC41B325F141AFECD924D37904E1F97E31E1DCFFBBCF42BBABEC390DC94
ReactorChatLayoutProofTests.OpenMenuProbe.cs 9ED6A2CB0A6682606FFB989F912561BA7F6CECB90D0121B9BFA2CA59DDCA461B

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-winui-interactive: chat editing shortcuts and native accessibility behavior changed. Focused native keyboard/UIA proof completed on the authorized isolated Windows ARM64 desktop. This is selected behavior proof, not a claim that every inventory-owned pool command ran.

Validation

Final native ARM64 build and canonical closeout passed on the exact reviewed source:

Check Result
Full build.ps1 All five targets passed, win-arm64
Shared project build Passed, zero warnings/errors
Tray project build Passed, zero warnings/errors
Shared tests 5,911 passed, 28 ordinary gated skips, 0 failed (5,939 total), 3m24s
Tray tests 6,755 passed, 0 skipped/failed, 1m45s
Native selected regression suite 16 passed, 0 skipped/failed, 14.4577s
Native UI test build Passed, zero warnings/errors
Diff and test-timing ratchet Passed
.\build.ps1
dotnet build .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj
dotnet build .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj
dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore
dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore

# Authorized interactive desktop only. The fixture checks foreground/focus ownership.
$env:OPENCLAW_RUN_KEYBOARD_PROOF='1'
dotnet build .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Debug -r win-arm64 -p:Platform=ARM64 -p:DevBuild=false -p:RequireSignedCleanupHost=false
dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj --no-build --no-restore -c Debug -r win-arm64 -p:Platform=ARM64 -p:DevBuild=false -p:RequireSignedCleanupHost=false --filter 'FullyQualifiedName~ComposerInput_OneNativePasteInsertsClipboardTextOnce|FullyQualifiedName~ComposerInput_EditShortcutsAndMenuRemainUsableAfterRepeatedMenuOpening|FullyQualifiedName~ComposerInput_BitmapPasteAfterMenuUseAddsOneAttachmentWithoutPastingText|FullyQualifiedName~ChatComposerControllerPasteFencingProofTests|FullyQualifiedName~ComposerInput_OpenMenuShortcutDiagnostic'

No forced RID for Shared/Tray tests. Their gated skips are not counted as native integration proof. Hosted PR CI is separate and has not run before publication.

Additional x64 Release attempt (2026-11-24)

  • Exact PR head: 0d257b42e50c44811238b7889acfcad06d5d57d2, unchanged source. Production-shaped non-Dev Release build of the WinUI app and UI-test project for win-x64 passed with 0 warnings and 0 errors, 2m03s.
  • The same selected 16-case clipboard suite was attempted on the local isolated x64 desktop. It reported 0 passed, 16 failed, 0 skipped because every case failed in shared fixture initialization, before its test body: Cannot initialize owned testhost as PerMonitorV2: context=0x12, with SetProcessDpiAwarenessContext error 5. This is a failed attempt, not a clipboard behavior pass or a skipped success.
  • The shared DPI fixture is unchanged by this PR. No guard was disabled, no compatibility/security settings changed, and no retry is represented as a fix. No testhost or Companion process from this attempt remained in the agent session after exit.
  • Still not verified: installed/shipped x64 candidate behavior. No candidate package is installed in this agent account; the built, mounted-control harness is not installed-app proof. Prior native ARM64 16/16 results and exact-head hosted CI remain separate evidence. Ready-for-review status is not release acceptance.

Real Behavior Proof

  • Environment tested: Native Windows 11 ARM64, existing .NET SDK 10.0.404 / Windows App SDK 2.6.5; synthetic mounted production composer, isolated interactive desktop session. Crabbox SSH / windows-normal slot winnode-d0ec93d80a59.
  • PR head or commit tested: Pre-commit reviewed source rooted at 64727b8dbd382a98e813977fd3bf4d66324ba9ef, exact four hashes above. Final native/canonical run run_b2dacd5332ee486632d779b412d9935d; native receipt nonce cde76dec0736429c86688611bb63a667. Publication commit 0d257b42e50c44811238b7889acfcad06d5d57d2 matches these four reviewed file hashes. Upstream was observed at 17cadf79dbea1b1623f3301a01f9af590cea93bb during publication. This draft preserves the tested base; integration with newer main has not been revalidated.
  • Exact steps or command run: In normal and compact chat, copy the synthetic sentinel, open/dismiss the editor context menu, focus the editor and inject exactly one Ctrl+V. Separately keep menu-presenter focus and inject Ctrl+V. Run selected native filter above with real SendInput and UIA invocation.
  • Evidence after fix: Copied non-sensitive runtime output:
    clipboard-repro: compact=False; menuOpened=True; nativeCtrlV=1; pasteEvents=1; expected=before:CLIPBOARD-ONE-PASTE; actual=before:CLIPBOARD-ONE-PASTE; draft=before:CLIPBOARD-ONE-PASTE
    clipboard-repro: compact=True; menuOpened=True; nativeCtrlV=1; pasteEvents=1; expected=before:CLIPBOARD-ONE-PASTE; actual=before:CLIPBOARD-ONE-PASTE; draft=before:CLIPBOARD-ONE-PASTE
    open-menu-probe: stock=False; flyout=MenuFlyout; focus=MenuFlyoutPresenter; textBefore=before:
    open-menu-probe: stock=False; menuOpen=False; pasteEvents=1; actual=before:OPEN-MENU-PASTE; draft=before:OPEN-MENU-PASTE
    Total tests: 16. Passed: 16.
    
  • Observed result: One input produces one paste, editor/draft agree, open-menu shortcut dismisses the menu, and other edit/image paths remain usable. All selected cases executed. Native tasks/apps cleaned up; Crabbox slot released.
  • Screenshot or artifact links verified? N/A. Current runtime output is copied above. Screenshots/TRX/logs were collected and inspected locally; private local paths are not presented as public evidence links.
  • Not verified or blocked: Installed x64/Store app, all menu-opening gestures, all keyboard layouts/UI languages, inventory-bound full proof-pool recipes and hosted PR CI. No installer/deployment/Gateway/MXC behavior claim. Original four-case red/green test retains its documented fixed-settle timing tradeoff.

Security Impact

  • New permissions or capabilities? No
  • Secrets or tokens handling changed? No
  • New or changed network calls? No
  • Command or tool execution surface changed? No
  • Data access scope changed? No
  • If any answer is Yes, explain the risk and mitigation: N/A. Existing clipboard/edit scope unchanged.

Compatibility and Migration

  • Backward compatible? Yes
  • Config or environment changes? No
  • Migration needed? No
  • If yes, list the exact upgrade steps: N/A.

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR scopes chat context-menu keyboard shortcuts to the open menu and disables them after dismissal.

Example: Copy CLIPBOARD-ONE-PASTE, open and dismiss the chat editor's context menu, then press Ctrl+V once.

  • Before: The reported native reproduction inserts CLIPBOARD-ONE-PASTE three times.
  • After: The supplied native harness output shows one insertion and one Paste event.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, useful repair with strong native harness coverage and no identified patch defect; shipped-app behavior remains unproven.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: One Ctrl+V can duplicate text after the chat context menu has been opened and dismissed.
Reason: The maintainer-authored direction restores ordinary single-paste behavior with a narrow change that preserves the existing native editing contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a concrete paste defect still present on main, and review found no introduced correctness defect.

Reviewed head: 0d257b42e50c44811238b7889acfcad06d5d57d2

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Show one paste after context-menu dismissal and one paste with menu focus in the shipped Companion app at the reviewed source revision.
Agent review details

How this fits together

ReactorChatComposer mounts the native TextBox and its editing menu; keyboard and clipboard input update the draft, while bitmap paste uses the existing composer controller.

flowchart LR
  Keyboard[Keyboard input] --> Editor[Native TextBox]
  Keyboard --> Menu[Open menu presenter]
  Menu --> Commands[Standard editing commands]
  Commands --> Editor
  Editor --> Draft[Composer draft]
  Commands --> Images[Existing image paste controller]
Loading

Technical review

Best possible solution:

Keep the focused accelerator lifetime fix in the existing composer view while preserving native editing commands and clipboard routing.

Do we have a high-confidence way to reproduce the issue?

Main retains the unrestricted menu shortcut path, and the supplied baseline native runs report three Paste events after menu dismissal; this review executed no reproduction.

Is this the best way to solve the issue?

The patch addresses competing shortcut ownership directly, without a debounce, custom key forwarding, controller changes, or additional production state.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 17cadf79dbea.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Barbara Kudiess: Raw commit 49813a6 adds src/OpenClaw.Tray.WinUI/Chat/ReactorChatComposer.cs:84 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 49813a63c6f8; files: src/OpenClaw.Tray.WinUI/Chat/ReactorChatComposer.cs)
  • Caleb Eden: Raw commit 89666df adds src/OpenClaw.Tray.WinUI/Chat/ChatComposerContextMenuState.cs:13 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 89666df49eb9; files: src/OpenClaw.Tray.WinUI/Chat/ChatComposerContextMenuState.cs)

Preflight source

Source 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

Metric Value Why it matters
Production and test growth Production +27 lines; tests +478 lines The tests reuse the existing mounted-control fixture and cover distinct native input, menu invocation, undo/redo, accessibility metadata, and bitmap-routing failures.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 24, 2026, 10:26 PM ET / November 25, 2026, 03:26 UTC.

@bkudiess
bkudiess marked this pull request as ready for review November 25, 2026 05:31
@bkudiess
bkudiess merged commit 3981f63 into openclaw:main Nov 25, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal priority bug or improvement with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant