Summary
Every message sent through agentapi to Claude Code produces a visible stray x character in the prompt area. The x comes from a workaround introduced in b732081 almost a year ago, which the commit itself promised to remove "a couple of days after the new version is released."
Source of the bug
lib/httpapi/claude.go, in formatClaudeCodeMessage:
// janky hack: send a random character and then a backspace because otherwise
// Claude Code echoes the startSeq back to the terminal.
// This basically simulates a user typing and then removing the character.
parts = append(parts, st.MessagePartText{Content: \"x\b\", Hidden: true})
The hack was a workaround for a bug in Claude Code 0.2.70 (anthropics/claude-code#803). With current Claude Code versions, the bracketed-paste start sequence is no longer echoed, so the masking x is rendered straight into the prompt area and the \b has nothing to erase — net result is a visible x on every message.
Environment
- agentapi v0.12.1 (latest release as of writing)
- claude-code 2.1.143
Notes
Proposed fix
Remove the parts = append(parts, st.MessagePartText{Content: \"x\b\", Hidden: true}) line. The original Claude Code bug it worked around is long fixed.
Summary
Every message sent through agentapi to Claude Code produces a visible stray
xcharacter in the prompt area. Thexcomes from a workaround introduced in b732081 almost a year ago, which the commit itself promised to remove "a couple of days after the new version is released."Source of the bug
lib/httpapi/claude.go, informatClaudeCodeMessage:The hack was a workaround for a bug in Claude Code 0.2.70 (anthropics/claude-code#803). With current Claude Code versions, the bracketed-paste start sequence is no longer echoed, so the masking
xis rendered straight into the prompt area and the\bhas nothing to erase — net result is a visiblexon every message.Environment
Notes
formatPaste; thex\bline was left in place.Proposed fix
Remove the
parts = append(parts, st.MessagePartText{Content: \"x\b\", Hidden: true})line. The original Claude Code bug it worked around is long fixed.