Skip to content

fix: send session_end notification before wipe/close (#6)#14

Open
rafabd1 wants to merge 1 commit intomainfrom
fix/issue-6-wipe-session-notification
Open

fix: send session_end notification before wipe/close (#6)#14
rafabd1 wants to merge 1 commit intomainfrom
fix/issue-6-wipe-session-notification

Conversation

@rafabd1
Copy link
Owner

@rafabd1 rafabd1 commented Mar 14, 2026

Fix: Send session_end notification before wipe/close

Closes #6

Problem

When a user triggers panic_wipe() or close_session(), the local session is shut down but the peer receives no protocol-level notification. This creates an asymmetric state where one side thinks the session is active while the other has already destroyed it.

Solution

  • Added a new "end" wire message type to the protocol
  • Both close_session and do_panic_wipe now send a {"t":"end"} frame to the peer before shutting down the stream writer
  • The receive_loop / handle_incoming_message now recognizes "end" messages and:
    • Clears the local session
    • Emits session_closed with reason: "peer_ended" to the frontend
    • Breaks the receive loop cleanly

Security considerations

  • The "end" message is sent as a best-effort signal — if the I2P tunnel is already broken, the send may fail silently, which is acceptable since the stream will eventually error out on the peer side
  • No sensitive data is included in the "end" frame

This PR was generated with Oz.

- Add 'end' wire message type sent to peer before shutdown
- Handle incoming 'end' messages in receive_loop to cleanly close session
- Both close_session and panic_wipe now notify peer before destroying state
- Peer receives session_closed event with reason='peer_ended'

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRITICAL: Wipe clears peer session without notification

1 participant