Treat code-mode collaboration messages as plaintext (#55633)

## What changed

Classify messages from code-mode collaboration calls as `AgentMessage::Plaintext` so they receive the context wrapper for plaintext messages. Apply this to `spawn_agent`, `send_message`, and `followup_task`.

## Testing

Add a regression test that spawns an agent through `exec` and verifies that the child receives the task as plaintext with sender and recipient attribution.

GitOrigin-RevId: 495c70ea13fd2bb06989e5aacab60beed0c19a56
This commit is contained in:
Henry Levy
2026-10-20 17:15:35 +00:00
committed by copyberry
parent e776b27eb0
commit 7a152fbcf9
3 changed files with 118 additions and 0 deletions
@@ -58,6 +58,7 @@ fn agent_message_from_tool(
if matches!(
source,
crate::tools::context::ToolCallSource::DirectPlaintextMessage
| crate::tools::context::ToolCallSource::CodeMode { .. }
) {
AgentMessage::Plaintext(message)
} else {