Skip to content

fix(chat): send a Claude Code message that ends in a backslash - #2278

Merged
devswha merged 2 commits into
devswha:mainfrom
jpcarranza94:fix/claude-trailing-backslash
Oct 28, 2026
Merged

devswha merged 2 commits into
devswha:mainfrom
jpcarranza94:fix/claude-trailing-backslash

Conversation

@jpcarranza94

Copy link
Copy Markdown
Contributor

Change

Closes #2277.

A Chat message to Claude Code whose last character is a backslash was not sent. herdr's agent.prompt pastes the text and then presses Enter, and Claude Code reads \ + Enter as "insert a new line". So the message stayed in Claude's input box with an empty line under it, while Chat cleared its own box as for a sent message. A queued message has the same paste-then-Enter shape, and the same problem.

  • closeBackslash (server/core/composer.ts) adds a space after a trailing backslash of a message to Claude Code. With the space, the Enter sends, and Claude Code records the message without it (checked live, Claude Code 2.1.312: the transcript holds Reply with only OK \).
  • It applies where each path builds the text it types, next to the omp /model rewrite: the immediate Chat send (submitText) and the queued send (pending.ts).
  • Only Claude Code gets it. I reproduced the problem with Claude Code only, so other agents keep their text as written.
  • The terminal's input line does not get it: there \ + Enter is what the keyboard types (in a shell, a continued line).
  • A backslash before the end goes as written. In my live check, … path C:\temp\x and a multi-line message whose first line ends in \ were both sent.

The idea is the same as closeMention, which adds a space after a trailing @file mention so that the Enter sends (#404).

Validation

  • server/submit.contract.test.ts, "sends Claude a message that ends in a backslash with a space after it": the Claude pane gets the paste with the space, then Enter. A backslash before the end, a message to omp, and the terminal's input line go as written. It fails on main.
  • server/pending-input.contract.test.ts, "delivers queued $text as $expected to $agent": two new rows, Claude (with the space) and Codex (as written). The Claude row fails on main.
  • Both pass in an isolated herdr session.
  • Live check before the fix (isolated herdr session, Claude Code 2.1.312, a test Ovis server and headless Chromium, sent from the Chat box): Reply with only OK \ stayed in Claude's box, and Reply with only OK \ was sent.
  • bun run check fast: typecheck, build, conventions and the changelog check pass. The unit test files that fail fail the same way on unchanged main on this headless Mac (scripts/check, ci-browser, install-star, self-hosted-runner, remote-entry, session-history, shell-agent, bridge, core/composer-framing). The last two are 5-second timeouts there.
  • Changelog fragment: changelog.d/claude-trailing-backslash.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HabHntUPvy5yA9iU3G1m5y

Claude Code reads `\` + Enter as a new line, so the Enter after a Chat or
queued message whose last character is a backslash added a line instead of
sending it: the message stayed in Claude's input box, while Chat cleared its
own box. A space after a trailing backslash lets the Enter send, and Claude
Code records the message without the space (Claude Code 2.1.312). The
terminal's input line keeps `\` + Enter, as the keyboard types it.

Closes devswha#2277

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HabHntUPvy5yA9iU3G1m5y
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: devswha/ovis
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: d34727d
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 612b632f-6274-4d55-b1a7-62e5e2e6e196

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: devswha/ovis
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: d34727d
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 58af8772-58a4-454d-82e8-6bbbc4a9bbbc
Commits

Reviewing files that changed from the base of the PR and between d34727d and c84b42c.

Files selected for processing: 5
  • changelog.d/claude-trailing-backslash.md
  • server/core/composer.ts
  • server/core/pending.ts
  • server/pending-input.contract.test.ts
  • server/submit.contract.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Chat and queued messages to Claude Code that end with a backslash are now submitted instead of remaining in the input box.
    • Messages sent to other models, and Claude Code messages with a backslash elsewhere in the text, retain their existing behavior.

Claude Chat submissions and queued messages now add a space after a trailing backslash before sending. Other cases, including typed Claude submissions and Codex queued messages, retain the trailing backslash.

Changes: Claude message sending

Layer / File(s) Summary
Normalize Claude Chat submissions
server/core/composer.ts, server/submit.contract.test.ts
The submit path adds a space after a trailing backslash in Claude messages. Tests verify that internal backslashes, OMP submissions, and typed Claude submissions remain unchanged.
Normalize queued messages
server/core/pending.ts, server/pending-input.contract.test.ts, changelog.d/claude-trailing-backslash.md
Pending-message dispatch applies the same handling. Tests verify the Claude adjustment and that Codex messages retain a trailing backslash. The changelog describes the Chat and queued-message behavior.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: devswha

Merge Risk: Minimal · previous review c84b4

The Claude trailing-backslash change is ready to merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description includes the required Change and Validation sections. It explains the problem, intended behavior, scope, linked issue, contract-test coverage, live validation, and check results.
Title check Passed The title clearly and concisely describes the main change: sending Claude Code messages that end with a backslash.
Linked Issues check Passed The implementation satisfies #2277. closeBackslash appends one space only for Claude messages that end in \\\\. The immediate Chat path applies it in server/core/composer.ts, and the queued path a…
Out of Scope Changes check Passed The changes stay within #2277. The changelog and contract-test updates document and verify the fix. No unrelated production behavior is changed; non-Claude agents, internal backslashes, and terminal i…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

The implementation satisfies #2277. closeBackslash appends one space only for Claude messages that end in \\. The immediate Chat path applies it in server/core/composer.ts, and the queued path applies it in server/core/pending.ts. The submit contract test covers the trailing backslash, an internal backslash, OMP, and typed: true terminal input. The pending-input contract test covers Claude and Codex behavior.

Full details: Out of Scope Changes check

Explanation

The changes stay within #2277. The changelog and contract-test updates document and verify the fix. No unrelated production behavior is changed; non-Claude agents, internal backslashes, and terminal input remain unchanged.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 files. (1 skipped: 1 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…s a backslash-closed message

A Claude message ending in a backslash gets a space so its Enter sends; the agent.prompt fallback now types the validated payload with that space inside its closing paste marker, instead of the bare rewritten text that lost the paste markers and newline encoding.
@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Merging ddc65f4 (external, @jpcarranza94; closes #2277). Codex was at capacity, so an omo reviewer and an independent second reviewer reviewed it strictly. herdr's agent.prompt pastes a message and presses Enter, and Claude Code reads a final backslash plus Enter as a new line, so a Chat or queued message ending in a backslash stayed in Claude's box. closeBackslash (server/core/composer.ts) adds one space after a final backslash for Claude only; inner backslashes, other agents and the terminal's typed input are unchanged. The matching that marks a message sent or restored trims whitespace, so the extra space does not leave a message looking unsent; mentions and attachments compose as before. The second review reproduced a MEDIUM the first head introduced: when agent.prompt is refused (agent_not_ready or agent_not_found) on an attached terminal, the fallback typed the rewritten text bare, losing the paste markers and the newline encoding of a multi-line message ending in a backslash. The merge pass fixed it on the branch in ddc65f4: the fallback now sends the validated payload with the space inside its closing paste marker, and the omp /model -> /switch fallback is unchanged. The new fallback tests fail on c84b42c for both trailing-backslash refusal cases (bare text instead of the bracketed paste). Re-review at this head: submit contract 93/93 (incl. the four new fallback cases) and pending-input contract 102/102 pass, plus 72 direct suffix/framing checks. Thank you, @jpcarranza94, for the careful fix and the clear issue. Not verified: what an authenticated Claude Code records for the padded message (the isolated Claude stopped at login).

@devswha
devswha merged commit 0ca9c08 into devswha:main Oct 28, 2026
19 checks passed
@devswha devswha mentioned this pull request Oct 29, 2026
5 tasks
devswha added a commit that referenced this pull request Oct 29, 2026
## Release 0.4.20

The release PR, prepared by step 1 of
[docs/development.md#releasing](https://github.com/devswha/ovis/blob/main/docs/development.md#releasing),
initially on main `bd676637a16471e8744d62c7311026ddb43a39eb` (#2335,
xterm 6), then merged with final-scope main
`ef482f2e66b3344658fb548fa1110744a92929c9` (#2338) and test-only
follow-up main `269e9ce19558b8d197959250075da56b25b9668f` (#2345):

- **Version:** `version` is 0.4.20 in `package.json` and
`herdr-plugin.toml`.
- **Changelog:** `bun scripts/changelog-fold.ts 0.4.20` initially folded
122 fragments into the 2026-10-29 section of `CHANGELOG.md`, linked
their PRs, and deleted the fragments. After merging main, the modified
`letta-native-chat.md` from #2338 was folded by hand with its current
wording and PR link. No other late fragment landed; `changelog.d` holds
only `README.md`. Four additional entries for external PRs without their
own fragments bring the section to 157 entries.
- Added 22 `by @login` credits across all 19 outside-contributor PRs in
the release range. Preserved the existing credit to @Yoonwoo-Ha for
#1634. See the complete ancestry-based audit below.
- **Release summaries:** en, ko, ja and zh each have 5 new, 5 improved
and 5 fixed lines, matching 0.4.19's shape. They include the xterm 6
improvement: terminal frames no longer mix old and new output. Every
English line is at most 80 characters.
- **Remote bundle:** `REMOTE_BUNDLE_VERSION` rises from 38 to 39 because
the bundle inputs changed since remote-v38.
- **Telemetry:** the guard confirms no Worker deploy or deployed
fingerprint update is needed.
- **iOS upload note:** CURRENT_PROJECT_VERSION raised to 3 for App and
OvisNotifications (last uploaded: 2, source: `docs/native-app.md:99`,
commit `54fdadc1c65da5d50a6afef411e3ed8f23b6c255`). Both targets inherit
project-level Debug and Release settings, and every
`CURRENT_PROJECT_VERSION` entry is 3. `app/store/ios.md` now records the
prepared build. This is the last documented upload, not a live App Store
Connect query; check for later uploads before uploading. The marketing
version remains 1.0.
- The changelog explicitly distinguishes delivery: removing WebKit's
form bar (#2109) requires the new iOS app build, while Korean
composition (#2307) comes with the PC update and needs no new iOS build.
The Korean-input summary says the same in all four languages, with no
change to list counts.

## Validation

- Final `dori heavy release-check -- bun run check fast`: passed, exit
0; workflow syntax, generated types/themes, typecheck, build and unit
suite (8,591 pass, 0 fail, 34 platform skips in 549 files). This is the
merged tree containing #2338, #2345, the contributor corrections and iOS
build 3.
- `bun test scripts/changelog-fold.test.ts
server/release-notes.test.ts`: 33 pass, 0 fail.
- `bun scripts/release-notes.ts 0.4.20`: passed, with all patch-note
lists and the full changelog.
- `bun scripts/release-guards.ts` and CI mode with `--base
ef482f2`: passed on the final merged
tree: "Release 0.4.20: remote bundle, telemetry Worker and release
metadata are in order."
- `bun scripts/release-guards.ts --release 0.4.20`: expected exit 1 only
because "remote-v39 is not published." The merge pass publishes it after
merging.

## Merge pass

**Do not merge before the owner's OK.**

- [ ] Merge only after the owner's OK and required checks pass.
- [ ] After merging, push `remote-v39` on the merged commit and wait for
the **Remote PC bundles** workflow to publish the manifest and all
archives.
- [ ] Then run **Release** on `main` with version `0.4.20`, without `v`.
The Release workflow creates the app tag; do not push it by hand.
- [ ] From this PR's merge until the Release run is done, merge nothing
touching `server/`, `shared/`, `bun.lock` or `patches/`.
- [ ] A changelog fragment merged after this PR must be moved into
0.4.20 by hand.

This lane stops at the open PR. No tag, workflow dispatch, merge or
telemetry deploy was performed.

**Completed release follow-up:** merged main `ef482f2e` including #2338
(`fix/letta-no-live-box`), folded its revised fragment into 0.4.20, and
retained the contributor-credit commit `184dc120` and iOS-build commit
`0ffa3d45`. The Letta summary already describes conversation support
without promising a live-terminal box, so it needs no change.

Merged test-only #2345 from main `269e9ce1`: the two usage browser
checks now wait for the earlier shared account-order save and start the
sign-in check from a cleared order. No product behavior or late fragment
was added; `changelog.d` still contains only `README.md`. The iOS
delivery clarification and resolved review thread are retained.

## Complete external-contributor audit

Checked every merged PR whose merge commit is in `git log
v0.4.19..origin/main`: 133 PRs through final-scope main `ef482f2e`, or
134 including test-only #2345 on `269e9ce1`, with 19 PRs by 12 external
non-bot authors. Both rescans found no additional external-author gaps;
#2345 is by the maintainer. Added the four missing entries: #2271 and
#2274 by @CharleoYang, #2290 by @DravenDou, and #2282 by @fivetaku. The
tab-reopening summary now includes the history-page improvement in all
four languages; list counts remain 5/5/5.

Full external PR list checked: #1911 @jjsteffen; #2068 @YuuuXie; #2072
@Noobear; #2087 @JJLiebig; #2145 @mattmarcin; #2176 @jpcarranza94; #2231
@philipprass-prog; #2235 @vuongnmhvn; #2270, #2271, #2274 @CharleoYang;
#2278 @jpcarranza94; #2282 @fivetaku; #2283, #2292, #2293 @YuuuXie;
#2301 @jpcarranza94; #2321 @kilhyeonjun. Every PR has a linked `by
@login` credit in 0.4.20.

---------

Co-authored-by: sisyphus-dev-ai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(chat): a message ending in a backslash stays in Claude Code's input box instead of being sent

2 participants