google / google/adk-go

Console launcher: CJK characters cannot be deleted during input editing

Open
#978 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
8.8k
Forks
1k
Avg merge
3d 18h
Merged PRs (30d)
88

Description

#### Description
When using the console launcher (cmd/launcher/console), editing Chinese/CJK characters during input doesn't work correctly. Specifically, after typing Chinese characters, pressing Backspace fails to delete them. ASCII/English characters work fine.

#### Steps to Reproduce
Build and run any agent with the console launcher
Type Chinese characters (e.g. via an IME) at the User -> prompt
Press Backspace to try to delete the Chinese characters
Observe that the characters cannot be deleted, or only partially deleted

#### Root Cause
The console launcher reads input via bufio.NewReader(os.Stdin).ReadString('\n') (console.go:120-127):

```
go func() {
reader := bufio.NewReader(os.Stdin)
for {
userInput, err := reader.ReadString('\n')
if err != nil {
readErrChan <- err
return
}
inputChan <- userInput
}
}()
```
bufio.Reader has an internal 4096-byte read buffer that eagerly consumes bytes from stdin. CJK characters are UTF-8 multi-byte (3 bytes per character) and occupy 2 terminal columns (wide characters). When an IME sends intermediate composition bytes to stdin, the bufio.Reader may consume them into its buffer, causing the terminal's input editing state to desync from what the program has read. This makes Backspace unable to correctly delete the characters.

#### Suggested Fix
Replace the raw bufio.Reader with a proper readline library (e.g. github.com/ergochat/readline) that correctly handles:

UTF-8 multi-byte character width and cursor movement
IME composition state
Line editing operations (backspace, delete, cursor movement)

#### Environment
adk-go v1.4.0
macOS Darwin 25.5.0
Terminal: VS Code integrated terminal / iTerm2
Input method: macOS Chinese IME

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.