Skip to content

v0.2.1 — clean /peers list

Choose a tag to compare

@jkrandom-sudo jkrandom-sudo released this 10 Aug 04:05
· 4 commits to main since this release
7bb5b9c

opencode-plugin-peers 0.2.1 — clean /peers list (one row per process)

/peers now shows one row per running opencode process, matching Claude Code's instance list — no more flooding with historical sessions.

The problem

Long-running opencode --auto daemons accumulated 100+ v2 registry entries (one per historical session), all showing as "alive" in /peers because the process PID was live and heartbeats refreshed every entry. The list also jittered between invocations because heartbeat atomic rewrites reshuffled directory order.

Fixes

  • Lifecycle-based adoption: startup no longer bulk-adopts every session from session.list(). Only sessions busy/retry in the status snapshot, or holding spool records for restart recovery, are adopted. Everything else comes through real activity (events, messages, commands).
  • Display collapse to one row per process: since opencode replays events for historical sessions at startup, adoption alone isn't enough. /peers and list_agents now collapse multiple session endpoints of the same process into one row (the most recently active). Routing (send_message by exact endpoint ID) is unaffected.
  • Deterministic sort (startedAt + endpointId): eliminates row-order jitter across heartbeats.

Verification

  • npm test: 172/172 pass
  • Real OpenCode 1.18.15 process test: pass
  • Real TUI E2E: /peers went from 113 rows → 2 rows on this machine, stable across invocations

Full Changelog: v0.2.0...v0.2.1