Agent pane: a message sent mid-turn never leaves Return and Send dead
Summary
Leo could not send in a lane chat while its agent was mid-turn: the text stayed in the composer, Send looked ready, and both Return and clicking Send did nothing.
Cause: the composer holds a sent prompt until acpmux takes it (accepted), and while it holds one, Return and Send are no-ops with no feedback. The pane only learned a queued prompt was taken from acpmux's queued event record. A lagged event stream drops records, so the prompt sat in the field with Return and Send dead until the turn ended. Clicking Send failed the same way, which rules out Caps Lock / IME composition (the click path never reads keys).
Fix:
- A prompt sent behind a running turn is taken as soon as the pane draws it in the queue. That row is the visible confirmation; a later refusal (including a folder-trust refusal) comes back as its bubble with Retry instead of deleting the prompt.
- The pane also listens for
_acpmux/prompt_accepted, which acpmux sends straight to the sending connection, so a lagged event stream no longer matters. - Return or Send while a prompt is still on its way now says "Still sending your last message. It stays here until the agent takes it." (21 locales) instead of doing nothing.
Testing
Regression first, from webviews/: bun test src/agent-session/acpmux/promptAccepted.test.ts
- Base (
6bb0037d, test only): 2 fail. The queue row shows, butacceptednever runs (without thequeuedrecord, and with onlyprompt_accepted). - Head: 2 pass;
heldPromptGesture.test.tsstill passes.
Observed / Not run
- Ran: the two test files above;
vp fmt --checkandvp lint(type-aware) on the changed TS files, clean. - Not run: the full
bun run checkandscripts/web-lint.sh/ prepush gate locally. Git on cosmic-gray was hung (about 190 git processes stuck in uninterruptible I/O on the shared object store), so these commits were made through the GitHub API; CI's web lint job covers the full check. Not dogfooded in a tagged build.
Changelog
Fixed: A message sent while the agent is working no longer gets stuck in the composer with Return and Send doing nothing.
Agent session: cosmic-gray
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the agent pane composer so a message sent while the agent is mid-turn never gets stuck with Return and Send dead. The composer held the prompt until acpmux's queued event record arrived, and a lagged event stream can drop that record, leaving the typed prompt in the field with Return and Send doing nothing until the turn ended.
- A prompt sent behind a running turn is now taken as soon as it's drawn in the queue; a later refusal comes back as its bubble with Retry.
- The pane also listens for acpmux's
_acpmux/prompt_accepted, which reaches the sending connection even when the event stream lags. - Pressing Return or Send while the last prompt is still on its way now shows a note explaining the message stays in the composer.