#10926·zeroclaw

[Bug]: Matrix send_via treats peer user identities as room destinations

Author: Audacity88Created Sep 17, 2026Updated Sep 17, 2026
Labelsbugchanneltoolchannel:matrixpriority:p2needs-maintainer-reviewfollow-uprisk:medium

Affected component

tools

Severity

S2 - degraded behavior

Current behavior

SendViaTool::resolve_target in crates/zeroclaw-tools/src/send_via.rs uses the first external_peers entry as the recipient, both when selecting a peer group directly and when resolving a channel covered by one group. Matrix peer groups identify users as @user:server, but Matrix's resolve_room accepts only room IDs beginning with ! or room aliases beginning with #.

A Matrix peer group containing a valid user identity therefore supplies a recipient that the Matrix sender rejects with matrix: not a room id or alias: {id_or_alias}. The same ambiguity affects wildcard peer entries: an authorization selector is not a delivery address.

This source-established follow-up from #10489 has not been reproduced through a live Matrix deployment. It is distinct from #9646's tool ownership scope and #10925's input-modality feature.

Expected behavior

Keep authorized peer identities separate from outbound room destinations. Provide an explicit room ID or alias through a scoped delivery-address contract and validate it before delivery. Do not guess a shared room, choose an arbitrary membership match, create a DM automatically, or reinterpret the peer authorization list as a room list.

The implementation needs a maintainer decision on where that explicit destination belongs. Preserve agent peer-group membership checks and applicable channel/room authorization. If no valid destination is available, return a clear actionable error rather than attempting to send to a user ID.

Steps to reproduce

Source-derived scenario; live delivery not executed:
1. Configure an agent in a Matrix peer group whose external_peers contains a permitted Matrix user ID.
2. Invoke send_via targeting that peer group with a message body.
3. Observe resolve_target select the first external peer as the recipient.
4. Follow that recipient into Matrix resolve_room, which rejects the @user address.
Also cover an exact channel target with one matching group and a wildcard peer entry.

Impact

Cross-channel or proactive delivery through send_via cannot use the documented Matrix user-based peer group as a valid room destination. This affects addressing regardless of text or voice modality; ordinary replies already carrying a room target are not the reported failure.

Logs / stack traces

No response

ZeroClaw version

Source inspected on master during follow-up reconciliation of #10489; inspected baseline 3df68fb2236c6f089c25005d0ebb780c9c7fd642.

Rust version

Not measured; source-based report.

Operating system

Not platform-specific in the inspected code; no live platform reproduction performed.

Regression?

Unknown

Pre-flight checks

  • I reproduced this on the latest master branch or latest release.
  • I redacted secrets, tokens, and personal data from all submitted content.