SendMessage silently succeeds when recipient name doesn't exist
Body:
## Bug
SendMessage tool returns success: true when called with a recipient name that doesn't match any teammate in the current session. The message
is dropped silently — neither sender nor recipient is notified.
## Reproduce
- Spawn an agent named
team-lead. - From parent or peer, call
SendMessage({to: "team_lead", message: "hi"})(typo: underscore). - Tool returns
{success: true, routing: {target: "@team_lead", ...}}. - No teammate named
team_leadexists. Message is lost.
## Expected
Tool should return an error like:
Error: Recipient "team_lead" not found. Available teammates: [team-lead, coder, qa].
…or at minimum emit a warning + structured error result the LLM can react to.
## Impact / why it matters
- Silent coordination failure: multi-agent teams break when sender typos a name; nobody knows the message was lost.
- Prompt injection vector: if an agent reads role names from the codebase (config files, docstrings), it will happily address messages to
those names. Observed case: agent read ramager (a role name in config/agents.yaml) and DM'd to ramager instead of team-lead. Tool
reported success → agent kept working assuming peer was notified.
- Contrast: tools that can't be called (typo on tool name) error loudly. Inter-agent messaging shouldn't have weaker validation.
## Suggested fix
Validate to against known teammate names in current session. On miss: return error result (not throw — let the LLM see and recover).
## Environment
- Claude Code CLI (encountered with sub-agents via Agent + SendMessage)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗