Skip to main content

discovered_block_to_agent

Function discovered_block_to_agent 

Source
async fn discovered_block_to_agent(
    cx: &ToolCtx<'_>,
) -> Result<HashMap<String, String>>
Expand description

Each local and cross-channel agent’s block id mapped to its name, from discovery.

/agentmux/reactive/inject‘s target_agent resolves by agent UID or registered AGENT NAME only (resolve_target, crates/srv-core/src/backend/reactive/handler.rs) — never by block_id, even though this tool’s own advertised contract (MESSAGE_TOOL, broadcast) is block_id values from Agents list, to stay consistent with Stop agents’ targeting scheme. The WS-RPC path (fleet_broadcast_impl, agentmux-srv) already resolves block_id -> agent_id via get_agent_by_block before injecting; this MCP path talks to srv over plain HTTP with no access to that in-process registry, so it resolves the same way DiscoverAgents/FleetList already do: read /agentmux/discovery’s host.addressable (each entry already carries both agent_id and a live block_id) and map through it before signing/injecting (Codex P1 + reagent P0, PR #2687 review — every advertised call failed “agent not found” without this).

REPORT_CROSS_INSTANCE_CONTROL_ROBUSTNESS_AUDIT_2026_08_22.md: host.addressable alone missed host.cross_channel entries (a different channel on this SAME host — those genuinely have a block_id in this host’s namespace, discovery just wasn’t being read for it) and LAN/WAN entries (which have NO block_id at all — only an agent name, since they’re not local blocks). Both are folded in below: cross_channel extends the same block_id->name map (identical shape), and any target string that doesn’t match ANY known block_id falls through to being used AS a literal agent name — safe because /agentmux/reactive/inject’s own cross-tier cascade (cross-channel -> LAN -> WAN muxbus relay, server/reactive.rs) already resolves by name across every tier; an invalid name just fails the same “not found” way it always did.