Skip to content

Steer or queue messages mid-turn, and fix Shift+Enter, chat scrolling and questions - #150

Merged
m4rocks merged 8 commits into
mainfrom
chat-composer-fixes
Nov 22, 2026
Merged

m4rocks merged 8 commits into
mainfrom
chat-composer-fixes

Conversation

@m4rocks

@m4rocks m4rocks commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Messages sent while the agent worked vanished until the turn ended. Shift+Enter sent the message instead of starting a new line. The chat jumped while scrolling, and questions had a fixed highlight with no way to type an answer. This branch fixes those and adds the related changes the maintainer asked for.

Changes

  • Shift+Enter starts a new line in Home and the chat. The textarea reports it as Enter too, so both boxes now send only through composer::sends.
  • Settings → General picks Steer (the default) or Queue for messages sent while the agent works, and Cmd/Ctrl+Enter does the other.
    • Claude Code takes a steer through the bridge's _m4code/steer at priority "next". The chat shows it where Claude reads it.
    • Codex, OpenCode and Antigravity stop the turn and start again with the message.
    • Slash commands and compaction always queue.
  • Queued messages and unread steers show above the message box. Queued ones can be edited or removed.
  • The working status moves from the message box to the foot of the chat.
  • Questions: the highlight follows the arrows and the mouse, and Enter picks it. Claude Code's questions and ask_user take the typed text as the answer. Elicitation fields don't, since their answer must match the schema.
  • User messages render as Markdown and keep their line breaks.
  • The right sidebar's sections are cards on the window background. Drag them into any order, which is saved in layout.right_cards.
  • Scrolling no longer jumps. GPUI dropped a message's parsed Markdown when its row left the list, so the row parsed again, drew empty and grew. The chat now keeps it.
  • Inline code's background covers its whole glyph box, patched in vendor/gpui-base.

Evidence

  • cargo clippy --locked --all-targets -- -D warnings is clean. cargo test --locked -- --test-threads=1 passes 481 tests, run twice. The vendored inline_code tests pass, 16 in all.
  • The steer placement test fails on the old code with the reported symptom, Agent("Hello wor"), User("stop"), Agent("ld."), and passes now.
  • A review found 3 blockers and 8 shoulds, all fixed in the last commit. For the three bridge findings I drove the bridge with a scripted SDK stand-in:
    • a stopped steer leaked into the next turn
    • a turn hung when the stream ended
    • a later steer showed too early
      All three failed on the earlier bridge and pass now. The script isn't committed, because the bridge has no test setup.

Risk

  • The bridge's steering hasn't run against a real claude. It relies on the SDK's user_message_uuids, command_lifecycle messages and interrupt receipt.
  • No view was checked on screen, because there was no screenshot tool.
  • The rebase onto 31ba86c keeps that commit's composer and elicitation. The working chips moved from the composer to the chat.

…ns take your own answer

- Shift+Enter starts a new line in Home and the chat: the textarea reports it as Enter too, so both now send only through `composer::sends`.
- The working status moves from the message box to the foot of the chat.
- Messages waiting for the turn to end show above the message box, where they can be edited or removed.
- The user's messages render as Markdown and keep their line breaks.
- A question's highlight follows the arrows and the mouse, and Enter picks it. Claude Code's questions take what is typed in the message box as the answer, through `_meta.m4code` on the permission request and its reply.
Settings → General picks Steer (the default, as in t3code) or Queue, and Cmd/Ctrl+Enter does the other for one message. Slash commands and messages during compaction always queue.

- Claude Code takes a steer in its running turn through the bridge's `_m4code/steer`. The bridge stamps every message with a uuid and keeps the ACP turn open until Claude's results have answered each one. A steer Claude drops by itself comes back in `_meta.m4code.resend` and goes as the next message. One the user stopped before Claude read it comes back in `_meta.m4code.unread`, shows as a notice, and its own turn is stopped too.
- Codex, OpenCode and Antigravity stop their turn and start again with the message.
The menu drops its outer panel and sits on the window's background, and each section is a card drawn like the chat's panel, so cards no longer sit inside a card. Dragging a card over another moves it there, the way session rows reorder. The order is saved in `layout.right_cards`. A blank card holds a place for later.
`TextView::markdown` kept its parse in frame state, which GPUI drops when a row scrolls out of the list. A message that came back into view parsed again, and one over 4 KB parses in the background, so it drew empty for a frame and then grew, moving everything around it. The chat now holds each entry's `TextViewState` and draws it with `TextView::new`; `github::ui::styled_markdown` gives both kinds of view the same look.
Upstream gpui-base fits the box behind inline code to the capital height plus some padding, so in fonts with deep descenders g, p and y reach past it. The patched `code_background` uses the code's ascent and descent instead. The Cargo.toml patch notes say so.
A steer went into the chat the moment it was sent, while Claude was still writing. The rest of that reply then landed after the user's message, so the reply looked cut off and its end looked like the answer to the steer.

The bridge now sends a steer at "next" priority, as t3code does, so Claude finishes its current step first. Once Claude reads the steer, the bridge emits it as a `user_message_chunk` marked `_meta.m4code.steer`. Until then the chat holds it above the message box. A steer still unread when the agent exits becomes a notice.
- Bridge:
  - A new message waits, up to 10 s, until the steers the user stopped have run and been stopped. Clearing them let one run in the new turn and fail it.
  - A turn still open when Claude Code's stream ends is rejected rather than left working.
  - After a held result, only the oldest waiting steer shows as read.
- Chat:
  - A steer the turn ends without reading, as when it fails, becomes a notice instead of disappearing.
  - Each steer is its own message, even right after another one.
  - Steers for an agent that restarts keep their order, ahead of the queue.
  - A running slash command such as a manual /compact can't be steered into.
  - The slash menu stays closed while a question takes the typed answer.
  - Replay drops the parsed markdown along with the entries.
  - Queue buttons get new ids when messages move.
  - Fences close only on a marker as long as the one that opened them.
- Sidebar: a card moves only once the pointer passes the middle of the card it goes over, so cards of different heights no longer swap back and forth.
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
claudiu Ready Ready Preview Nov 22, 2026 8:40pm UTC

…their data folder

`a_process_that_ends_closes_the_session_and_leaves_its_worktree` isn't ignored, so it ran beside the unit tests and set `M4CODE_DATA_DIR` to its own folder while the worktree tests read theirs. It failed CI on Linux, including on main. The test now uses the run's one throwaway folder (`datadir::use_throwaway_folders`) and finds its project by path. Part of #149: the ignored headless tests still set the variable, though they run on their own.
@m4rocks
m4rocks merged commit e2c8ea3 into main Nov 22, 2026
5 checks passed
@m4rocks
m4rocks deleted the chat-composer-fixes branch November 24, 2026 22:38

This branch was successfully deployed

1 active deployment
Preview — 10f49d0a Deployed Nov 22, 2026 by vercel[bot]
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.

1 participant