fix: move MCP message injection into send_message()#12
Merged
Conversation
T-858: Log rotation detection — reset offset when file shrinks T-862: inject_into_pane accepts pane_id (u64) instead of index (usize) T-863: Remove duplicate raw-mode setup from TerminalGuard (ratatui owns it) T-864: Wire dirty_rx into event loop for immediate PTY redraws T-874: TextDone matches correct turn via turn_seq instead of blind last_mut T-875: rename_session migrates orphaned UUID rows on SessionBound Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…sh delivery The structured messaging migration (PR #8) changed potato_send_message args from {message} to {type, subject, body}, but the bridge's build_inject_request() still looked for args.get("message"), which silently returned None for every structured message. Agents only saw messages when they polled get_messages() — push notifications were dead. Root cause: the bridge was reconstructing injection intent by post-hoc parsing of raw RPC args, duplicating knowledge that send_message() already had. Fix: InterSessionState::send_message() now owns injection. It has from_pane, to_pane, content, and roles — everything needed. The bridge's build_inject_request() and is_send_message_call() are removed entirely. Any code path that calls send_message() now automatically triggers PTY injection. No duplication, no schema drift, one source of truth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The structured messaging migration (PR #8) changed
potato_send_messageargs from{message}to{type, subject, body}, butbridge.rs::build_inject_request()still calledargs.get("message"), which returnedNonefor every structured message. Push delivery was silently dead — agents only saw messages when they polledget_messages().Fix
Move injection into
InterSessionState::send_message()where all the context already lives (from_pane, to_pane, content, roles). Remove the bridge's post-hoc RPC arg parsing (is_send_message_call,build_inject_request).Any code path calling
send_message()now automatically triggers PTY injection. One source of truth, no schema coupling.Changes
inject_tx: Option<UnboundedSender<InjectRequest>>toInterSessionState.send_message()fires injection request before enqueueing.is_send_message_call(),build_inject_request(), and all post-dispatch injection logic.inject_txinto state before bridge startup.Tests
799 passed, 0 failed. Clippy clean.