Skip to content

feat(peer): follow supersession + name hint when session citations go stale #136

Description

@heavygee

Field report

An agent received a standard nametag citation [Antevorta setup](/sessions/36985b00-e7ba-448c-812c-9eb4f611ff6e).

  1. inspect_peer on that id worked (5 messages, plausible transcript).
  2. A few turns later ping_peer on the same id failed: Session not found.
  3. Immediate retry of inspect_peer on the same id also failed: no session matching prefix.
  4. Recovery: list_peers showed Antevorta setup under a different id (0b350082-d60d-4705-b0ab-d0d80a861660).

Root cause (code)

Peer tools (inspect_peer, ping_peer, hapi inspect-peer, hapi ping-peer) resolve targets only via GET /api/sessions list + prefix match (cli/src/modules/pingPeer/pingPeer.ts). They do not:

  • follow metadata.supersededBySessionId (web already does — web/src/routes/sessions/followSupersedingSession.ts; REST contract warns resume/reopen may return a different id — docs/api/client-contract/rest.md), or
  • suggest name-based fallback when an id vanishes.

When a session is superseded and the old row is deleted (sessionCache.mergeSessionData with deleteOldSession: true), the cited id disappears entirely from the namespace. A successor with the same display name may exist — silent failure with no hint to try list_peers.

This is not the tiann#1618 soft-nametag trust model; it is citation durability / session identity continuity for Layer 0 peer tools.

Proposed fix (pick phased)

P0 — supersession chain: when resolving by id, if row exists with supersededBySessionId, follow to successor (same as web navigation). Also try direct GET /api/sessions/:id before list-only lookup for exact UUIDs.

P1 — helpful not-found: when prefix/id misses, parse citation title if present ([title](/sessions/id)) and list same-name candidates from list_peers; error text should mention supersession and list_peers, not bare "not found".

P2 — tombstones (product policy): consider keeping superseded rows as non-deletable aliases instead of deleteOldSession: true merges, so old ids keep redirect metadata.

Related

Acceptance

Stale [title](/sessions/old-id) citations either land on the successor session or return an actionable error naming the likely replacement id.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions