3.3 KiB
3.3 KiB
| id | slug | title | status | kind | priority | labels | created_at | updated_at | assignee | legacy_ticket | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 20260529-171326-pod-socket-peer-disconnect-noise | pod-socket-peer-disconnect-noise | Treat Pod socket peer disconnects as normal connection close | closed | bug | P1 |
|
2026-05-29T17:13:26Z | 2026-05-29T17:26:50Z | null | null |
Background
The active insomnia TUI session frequently shows notices like:
[notice error] pod: [Internal] invalid method: Connection reset by peer (os error 104)
The message is misleading. The Pod IPC server reports every reader.next::<Method>() error as an Event::Error with invalid method: .... A peer disconnect/reset from a short-lived socket client or status probe is a normal connection lifecycle event, not an invalid method sent by a client.
This becomes noisy during orchestration, multi-Pod polling, attach/picker refreshes, and diagnostic tooling because many clients connect briefly to read initial Alert / Snapshot traffic and then close. Depending on timing, the server can observe that close as ConnectionReset, ConnectionAborted, BrokenPipe, or EOF-like errors. Those must not be broadcast as user-visible Pod errors.
Likely code path:
crates/pod/src/ipc/server.rs:handle_connection,method = reader.next::<Method>()crates/protocol/src/stream.rs: JSON line reader returns I/O errors- TUI displays broadcast
Event::Errorthrough notice/error surfaces
Requirements
- Classify normal peer disconnects while reading client
Methodvalues as connection close, not invalid method.- At minimum handle
ConnectionReset,ConnectionAborted,BrokenPipe, and EOF-like cases appropriately. - The handler should break/return for those cases without broadcasting
Event::Error.
- At minimum handle
- Preserve diagnostics for genuinely invalid client input.
- Malformed JSON or schema-invalid
Methodpayloads should still produce a clear error. - Prefer sending the protocol error to the offending connection only if the current IPC shape makes that reasonable; do not unnecessarily broadcast connection-local parse errors to unrelated TUI clients.
- Malformed JSON or schema-invalid
- Keep normal socket behavior intact.
- Initial
AlertandSnapshotdelivery must still work. - Long-lived TUI attach clients must still receive live events.
- Short-lived probe clients may connect, read enough state, and drop without generating user-visible errors.
- Initial
- Avoid hiding real server failures.
- Only expected peer disconnect/read-close errors should be silenced.
- Unexpected I/O or parse errors should remain observable through logs or explicit error events as appropriate.
- Add focused tests.
- A client that connects and resets/closes without sending a Method should not create an
Event::Error/ notice. - A malformed Method line should still be treated as invalid input.
- Existing controller/IPC tests should continue to pass.
- A client that connects and resets/closes without sending a Method should not create an
Acceptance criteria
- The
[Internal] invalid method: Connection reset by peernotice no longer appears when short-lived Pod socket clients/probes disconnect. - Normal disconnect/reset/abort/broken-pipe while reading a Method closes only that connection and is not broadcast to all clients.
- Invalid JSON or schema-invalid Method input still produces a clear diagnostic.
- Tests cover peer disconnect handling and invalid-method handling.
cargo fmt --check- Relevant pod/protocol/tui IPC tests pass.