Problem
There is no stable, restart-surviving handle for addressing a logical worker.
The two identifiers a peer can target are both tied to a single process lifetime:
- The fallback alias
subagent-chat-<id> is derived from the pi session id, so a fresh session (quit + relaunch, not resume) gets a new alias. A parent that cached subagent-chat-019eb2da then gets Session not found after the worker restarts.
- The broker session id (
SessionInfo.id) is a randomUUID() assigned per connect (broker.ts), so it changes on every reconnect.
The only stable handle today is a user-chosen /name, but that must be re-applied on every fresh start, and (until #11) didn't even propagate reliably. For an orchestration setup where a supervisor relaunches workers, there's no way to say "this is the same DCA-worker as before" automatically.
Proposal (seeking direction before coding)
Let a session pin its advertised presence name so a relaunched worker re-advertises the same address with no manual /name.
There's already a related primitive — PI_SUBAGENT_INTERCOM_SESSION_NAME — but it only feeds contact_supervisor routing metadata; it does not set the session's advertised presence name. Options:
- Env var (e.g.
PI_INTERCOM_SESSION_NAME) read at session_start; when set, resolveIntercomPresenceName() returns it instead of pi.getSessionName()/the fallback. A launcher/orchestrator can pin a stable name per worker role.
- Config field in
~/.pi/agent/intercom/config.json (sessionName), same effect, for non-launcher setups.
- Both (env wins over config wins over
/name/fallback).
This composes with #11 (the pinned name still needs to propagate promptly) and is adjacent to #35 (routing by a stable identifier rather than a possibly-duplicate display name) — a pinned name is stable but author-controlled for uniqueness.
Questions
Happy to implement once you point at the shape you'd accept.
Problem
There is no stable, restart-surviving handle for addressing a logical worker.
The two identifiers a peer can target are both tied to a single process lifetime:
subagent-chat-<id>is derived from the pi session id, so a fresh session (quit + relaunch, not resume) gets a new alias. A parent that cachedsubagent-chat-019eb2dathen getsSession not foundafter the worker restarts.SessionInfo.id) is arandomUUID()assigned per connect (broker.ts), so it changes on every reconnect.The only stable handle today is a user-chosen
/name, but that must be re-applied on every fresh start, and (until #11) didn't even propagate reliably. For an orchestration setup where a supervisor relaunches workers, there's no way to say "this is the same DCA-worker as before" automatically.Proposal (seeking direction before coding)
Let a session pin its advertised presence name so a relaunched worker re-advertises the same address with no manual
/name.There's already a related primitive —
PI_SUBAGENT_INTERCOM_SESSION_NAME— but it only feedscontact_supervisorrouting metadata; it does not set the session's advertised presence name. Options:PI_INTERCOM_SESSION_NAME) read atsession_start; when set,resolveIntercomPresenceName()returns it instead ofpi.getSessionName()/the fallback. A launcher/orchestrator can pin a stable name per worker role.~/.pi/agent/intercom/config.json(sessionName), same effect, for non-launcher setups./name/fallback).This composes with #11 (the pinned name still needs to propagate promptly) and is adjacent to #35 (routing by a stable identifier rather than a possibly-duplicate display name) — a pinned name is stable but author-controlled for uniqueness.
Questions
/name, or should/nameoverride the pin for the rest of the session?Happy to implement once you point at the shape you'd accept.