The bare envelope only carried `peer_id` for peer_agent inbound, so a
receiving agent had to round-trip to /registry to find out who's
talking. Surface the sender's display name, role, and an agent-card
URL alongside the routing fields so the agent can render
"ops-agent (sre): ping" in one shot without an extra lookup.
a2a_client.py:
- Add _peer_metadata cache `dict[peer_id → (fetched_at, record)]`
- Add enrich_peer_metadata(peer_id) — sync, hits cache or registry
with a tight 2s timeout, returns None on validation/network/non-200
so callers can degrade gracefully
- TTL = 5 min so a busy multi-peer chat doesn't hit registry on every
push, but role/name renames propagate within a session
- Add _agent_card_url_for(peer_id) — deterministic from peer_id alone
a2a_mcp_server.py:
- _build_channel_notification calls enrich_peer_metadata when peer_id
is non-empty; meta carries peer_name + peer_role + agent_card_url
alongside the existing routing fields
- agent_card_url surfaces unconditionally (constructable from peer_id);
peer_name/role only when registry lookup succeeds — never blocks the
push on a registry stall
Tests: 6 new branches (canvas_user no enrichment / cache hit no GET /
cache miss fetches once / registry-fail graceful degrade / TTL expiry
re-fetches / invalid peer_id skips lookup). Mutation-verified: 6/6
fail without prod code, 39/39 pass with.
Tracks the broader RFC at #2469 (workspace-server activity_type rename
to break the echo loop). Independent of PR #2470 — this is the
metadata-enrichment half of the same UX improvement.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>