Skip to content

af send: Enter (\r) doesn't submit multi-line formatted messages #492

Closed

Description

@waleedkadous

Bug (Updated Diagnosis)

af send messages never get their Enter keystroke processed by Claude Code. The user always has to press Enter manually after the message appears.

Root Cause

The formatted message is a multi-line block:

### [ARCHITECT INSTRUCTION | 2026-...] ###
PR approved. Please merge.
###############################

This gets written to the PTY as a single session.write(formattedMessage + '\r'). The PTY/terminal processes the embedded \n characters as line breaks. By the time the trailing \r arrives, the cursor is on an empty line after the ### footer. The \r submits that empty line, not the message content.

This is fundamentally different from how the terminal handles human input — Claude Code sees a multi-line paste event and displays it, but the trailing \r just adds a blank Enter after the display.

Why Cron Messages Work

Cron messages (af-cron) also use the same format and \r, but they appear to work because the Claude Code process treats the pasted block as input regardless — the message content itself triggers the AI to respond. The \r was never actually submitting the message; it was always just adding a blank line.

History

Fix Options

  1. Send \r before the message: Write '\r' + formattedMessage + '\r' so the first Enter clears any partial input, then the message is pasted, then the final Enter submits
  2. Send \r\n at the end: Some terminals need \r\n rather than just \r
  3. Investigate how Claude Code handles pasted input: Maybe there's a bracket-paste mode issue where the message needs to be wrapped in paste markers

Activity

  1. added
    bug
    on Feb 21, 2026
  2. waleedkadous commented on Feb 21, 2026

    @waleedkadous
    ContributorAuthor

    On it! Working on a fix now.

  3. added a commit that references this issue on Feb 21, 2026
    8ac64ab
  4. added a commit that references this issue on Feb 21, 2026
    b15a88e
  5. changed the title [-]af send typing awareness over-fires: messages delayed 60s[/-] [+]af send: Enter (\r) doesn't submit multi-line formatted messages[/+] on Feb 22, 2026
  6. added a commit that references this issue on Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions