Skip to main content

Module agent_registry_lookup

Module agent_registry_lookup 

Source
Expand description

Slug-based lookup into the global named-agent registry.

One implementation, deliberately. This matching is subtle — the caller holds a routing slug (AGENTMUX_AGENT_ID, e.g. "agenty") while a record stores the display-cased instance_name (e.g. "AgentY"), so both sides have to be normalized through derive_slug rather than compared directly. Raw string equality here was a real bug (reagentx, PR #2428).

It lived in server::native_memory_handlers and was then re-implemented in backend::history; reagentx P2 on PR #3480 flagged the copy, citing this codebase’s own history of exactly that drift — “a future collision/matching fix applied to one copy will silently miss the other.”

It lives in backend/ rather than registry/ on purpose: registry/ has no dependency on crate::backend at all today, and derive_slug is a backend::storage function — homing this there would have added a registry→backend edge to a module that is currently self-contained.

Functions§

active_records_matching_slug 🔒
Every active registry record whose instance_name normalizes to the same slug as agent_id. Usually zero or one; more than one means a collision.
find_active_record_by_slug 🔒
The active registry record whose instance_name normalizes to the same slug as agent_id — only if exactly one does.
find_active_record_by_slug_and_definition 🔒
The active registry record matching both agent_id’s slug and an exact definition_id.
working_dir_from_record 🔒
Reconstruct an agent’s absolute working directory from its registry record.