hermes - 💡(How to fix) Fix [Bug]: IME composition causes send button to show as voice button + text truncation on submit

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root cause: hasComposerPayload is computed as draft.trim().length > 0 in apps/desktop/src/app/chat/composer/index.tsx. During IME composition (between compositionstart and compositionend), draft may be empty or contain only uncommitted pinyin/romaji characters. This causes showVoicePrimary to be true in controls.tsx, hiding the send button.

Fix Action

Workaround

Users can work around this by:

  1. Pressing Space or clicking elsewhere to commit IME text before pressing Enter
  2. Using the CLI version (hermes in terminal) instead of the desktop app

Code Example

// Track IME composition state
const composingRef = useRef(false)

// In the editor's event handlers:
onCompositionStart={() => { composingRef.current = true }}
onCompositionEnd={() => { composingRef.current = false }}

// Then:
const hasComposerPayload = composingRef.current || draft.trim().length > 0 || attachments.length > 0

// And in submitDraft, guard against submitting during composition:
const submitDraft = () => {
  if (composingRef.current) return  // Let IME finish first
  // ... rest of submit logic
}

---

## Workaround

Users can work around this by:
1. Pressing Space or clicking elsewhere to commit IME text before pressing Enter
2. Using the CLI version (`hermes` in terminal) instead of the desktop app

---
RAW_BUFFERClick to expand / collapse

Bug Description

The desktop app's composer has two related issues when typing with an IME (Input Method Editor), such as Chinese/Japanese/Korean input:

1. Send button shows as voice button for short text

When typing with an IME, short text causes the send button to be replaced by the "Start voice conversation" button. The user must type extra spaces to make the send button appear.

Root cause: hasComposerPayload is computed as draft.trim().length > 0 in apps/desktop/src/app/chat/composer/index.tsx. During IME composition (between compositionstart and compositionend), draft may be empty or contain only uncommitted pinyin/romaji characters. This causes showVoicePrimary to be true in controls.tsx, hiding the send button.

2. Text truncated on submit during IME composition

When the user presses Enter while an IME composition is still in progress, only the already-committed portion of the text is submitted. The remaining composing text is lost.

For example, typing "今天天气真好" (6 CJK characters) via pinyin and pressing Enter before the IME fully commits results in only "今天天" (3 characters) being sent.

Root cause: Pressing Enter during IME composition triggers both: (1) partial IME commit (truncated text), and (2) form onSubmitsubmitDraft(). The draft state only contains the committed portion at that moment.

Environment

  • OS: Windows 10
  • Hermes version: v0.15.1
  • Desktop app (Electron)
  • IME: Chinese (Microsoft Pinyin / Sogou)

Steps to Reproduce

To Reproduce

  1. Open Hermes desktop on Windows
  2. Switch to a Chinese IME (Microsoft Pinyin, Sogou, etc.)
  3. Type a short message, e.g. pinyin nihao → select 你好
  4. Observe: if the text is short, the send button may show as "Start voice conversation" instead of the send arrow
  5. For the truncation bug: type a longer message with IME and press Enter quickly before the IME underline disappears
  6. Observe: only a portion of the text is sent

Expected Behavior

Expected behavior

  • The send button should always be visible when there is any text in the composer, regardless of IME composition state
  • Pressing Enter should wait for IME composition to complete before submitting, or submit the full composing text

Actual Behavior

Possible fix direction

In apps/desktop/src/app/chat/composer/index.tsx, the hasComposerPayload check could also consider the IME composition state. Alternatively, the composer could listen for compositionstart/compositionend and defer the voice/send toggle and submit logic during active composition:

// Track IME composition state
const composingRef = useRef(false)

// In the editor's event handlers:
onCompositionStart={() => { composingRef.current = true }}
onCompositionEnd={() => { composingRef.current = false }}

// Then:
const hasComposerPayload = composingRef.current || draft.trim().length > 0 || attachments.length > 0

// And in submitDraft, guard against submitting during composition:
const submitDraft = () => {
  if (composingRef.current) return  // Let IME finish first
  // ... rest of submit logic
}

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

## Workaround

Users can work around this by:
1. Pressing Space or clicking elsewhere to commit IME text before pressing Enter
2. Using the CLI version (`hermes` in terminal) instead of the desktop app

Operating System

Windows 10

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • The send button should always be visible when there is any text in the composer, regardless of IME composition state
  • Pressing Enter should wait for IME composition to complete before submitting, or submit the full composing text

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING