Skip to content

fix(runtimed): pipe mode stream corruption — relay writes to daemon socket during pending read #613

@rgbkrk

Description

@rgbkrk

Resolved

Two fixes applied in PR #616:

  1. Stream corruption (original bug): Buffered outgoing pipe frames in a VecDeque, flushed before select!
  2. Output rendering: Re-enabled broadcast-driven output (onOutput: appendOutput) since Automerge sync doesn't deliver changes in pipe mode (changed=false on all frames — see sync state mismatch below)

Remaining: Sync state mismatch (follow-up)

The daemon's Automerge sync state tracks the relay peer (established during do_initial_sync), but in pipe mode the actual consumer is the WASM (which has its own sync::State). All sync frames arrive with changed=false because the sync protocol is talking to the wrong peer.

This means:

  • Outputs render via broadcasts only (the workaround), not via sync
  • The WASM doc doesn't get incremental updates from the daemon after execution
  • Reopening the app loads correct state (from GetDocBytes at bootstrap)

The proper fix: skip do_initial_sync in pipe mode and let the WASM handle the full sync protocol with the daemon through the pipe. See .context/plans/fix-pipe-mode-sync-state.md for the full design.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions