--- model: claude-opus-4-6 service: claude session: multiaddr-support-rename-prefer timestamp: 2026-04-14T16:33:00Z git_ref: befedc49 scope: code substantive: true raw_file: 20260414T163300Z_befedc49_prompt_io.raw.md --- ## Prompt Create a helper function that determines the best transport given actor locality (distributed vs same host). Use PID/hostname comparison for locality detection, apply at registry addr selection only (not spawn-time). ## Response summary New `prefer_addr()` + `_is_local_addr()` helpers in `_api.py` using `socket.getaddrinfo()` and `ipaddress` for PID/hostname locality detection. Preference: UDS > local TCP > remote TCP. Integrated into `query_actor()` and `wait_for_actor()`. Also changed `Registrar.find_actor()` to return full addr list so callers can apply preference. ## Files changed - `tractor/discovery/_discovery.py` → `_api.py` — renamed + added `prefer_addr()`, `_is_local_addr()`; updated `query_actor()` and `wait_for_actor()` call sites - `tractor/discovery/_registry.py` — `Registrar.find_actor()` returns `list[UnwrappedAddress]|None`