Skip to content

fix(desktop): steer from live composer text - #53660

Closed
supplefrog wants to merge 1 commit into
NousResearch:mainfrom
supplefrog:fix/53659-desktop-ctrl-enter-steer-live-text
Closed

fix(desktop): steer from live composer text#53660
supplefrog wants to merge 1 commit into
NousResearch:mainfrom
supplefrog:fix/53659-desktop-ctrl-enter-steer-live-text

Conversation

@supplefrog

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes an intermittent Hermes Desktop composer bug where Ctrl+Enter / Cmd+Enter can miss freshly typed steer text. The shortcut branch now mirrors the existing plain-Enter race fix: it reads the live contentEditable DOM synchronously before deciding whether steering is possible, then syncs draftRef/composer state before calling steerDraft().

Related Issue

Fixes #53659

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • apps/desktop/src/app/chat/composer/index.tsx
    • Makes the Ctrl/Cmd+Enter steer branch read composerPlainText(editorRef.current) instead of relying on render-derived canSteer.
    • Makes steerDraft() validate steerability from draftRef.current so the freshly synced text is honored in the same keydown event.
  • apps/desktop/src/app/chat/composer/enter-submit-dom-race.test.tsx
    • Adds a regression case proving fast-typed text is steered on Ctrl+Enter even before composer state has synced.

How to Test

  1. Start a Desktop chat turn that is still running.
  2. Type a steering message and immediately press Ctrl+Enter / Cmd+Enter.
  3. The freshly typed text should steer the active run instead of being swallowed.

Local verification:

  • npm --prefix apps/desktop run typecheck — passed
  • npm --prefix apps/desktop run test:ui -- src/app/chat/composer/enter-submit-dom-race.test.tsx src/app/chat/composer/composer-text-guard.test.tsx — 2 files, 8 tests passed
  • npm --prefix apps/desktop run build — passed
  • git diff --check — passed

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Windows 10

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

No screenshot; this is a keyboard timing fix. The regression is covered by the added jsdom DOM-keydown test.

@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Jun 27, 2026
@supplefrog

Copy link
Copy Markdown
Contributor Author

Closing this duplicate in favor of #53668, which fixes the same issue (#53659) with broader focused coverage and already has CI signal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop composer Ctrl+Enter can miss freshly typed steer text

2 participants