2.1 KiB
2.1 KiB
Implementation report: peer Pod handshake command
Date: 2026-06-02
Investigation
The current boundaries are documented in artifacts/investigation-summary.md. No escalation blocker was found. The main concern identified was avoiding reuse of spawned-child state (SpawnedPodRegistry, delegated scope, output cursors, and child completion semantics) for peer communication; the implementation therefore adds separate peer metadata and a separate peer send tool.
Implemented behavior
- Added reciprocal peer metadata to
PodMetadataaspeers, separate fromspawned_childrenandreclaimed_children. - Added protocol
Method::RegisterPeer { name }andEvent::PeerRegistered { result }. - Added controller handling for
RegisterPeer, idle/paused only, validating an existing target Pod and rejecting self-handshakes. - Added
PodDiscovery::register_peerthat persists both metadata directions and rolls back the first side on ordinary second-side write failure. - Extended
ListPodsvisibility to includeVisibilityReason::Peer; a successful handshake makes both Pods see each other aspeerthrough Pod metadata. - Added
SendToPeerPodas a distinct LLM tool. It only sends to visible live peer Pods, deliversMethod::Notifywith a source label, and does not use child delegation, output cursors, parent ownership, or child completion notifications. - Added TUI command
:peer <pod-name>for idle attached Pods. Success is reported through a transient actionbar notice when the controller returnsPeerRegistered. - Documented peer semantics in
docs/design/pod-session-state.mdand added prompt guidance that peer Pods are not spawned children.
Tests and validation run
cargo test -p protocol -p pod-store -p pod -p tui --lib./tickets.sh doctorgit diff --checknix build .#yoi
Notes
The two-file reciprocal metadata update is not crash-transactional because the existing Pod metadata store has no multi-record transaction boundary. The implementation avoids successful replies with one-sided state for normal validation/write failures by rolling back the first write if the reciprocal write fails.