Skip to content

Stray "x" appears at the end of every prompt (leftover Claude Code 0.2.70 workaround) #223

@mzihlmann

Description

@mzihlmann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions