SendMessage silently succeeds when recipient name doesn't exist

Resolved 💬 3 comments Opened May 10, 2026 by lknight Closed May 13, 2026

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

  1. Spawn an agent named team-lead.
  2. From parent or peer, call SendMessage({to: "team_lead", message: "hi"}) (typo: underscore).
  3. Tool returns {success: true, routing: {target: "@team_lead", ...}}.
  4. No teammate named team_lead exists. 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)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗