Skip to content

Sidecar reader silently treats truncated frames as clean EOF #21

Open

Description

@MelbourneDeveloper

Native sidecar connections currently treat any UnexpectedEof from the shared frame reader as a clean end of stream. That error also occurs when a peer closes after part of the four-byte length prefix or part of a declared payload. Consumers therefore receive None instead of a terminal error and can miss a backend failure.

Reproduced against f693a58 with a real local TCP connection, including a complete valid response followed by a truncated frame. A zero-byte disconnect should remain clean; partial prefixes and partial payloads must produce a visible error, preserve previously received responses in order, and release both response and notification channels.

The regression test fails with truncation is an error, not clean EOF. The minimal fix probes for zero-byte EOF, then feeds the first byte and remaining stream through the existing shared frame decoder. The unchanged native regression passes after that fix.

Evidence: SharpLsp target/diagnostics-repro/transport-truncation-red.log and transport-truncation-green.log. Fix and tests will be linked from the upstream pull request.

Activity

  1. added a commit that references this issue on Oct 23, 2026
    d8f6213
  2. MelbourneDeveloper commented on Nov 17, 2026

    @MelbourneDeveloper
    CollaboratorAuthor

    Verified against the released v0.5.0 crates

    Method: git worktree at tag v0.5.0; replaced crates/lspkit/src, crates/lspkit-server/src and crates/lspkit-server/examples with the sources unpacked from the crates.io 0.5.0 downloads (sha256 lspkit fca7d7fa…f5ce7, lspkit-server 1472ab35…231f2). git status stayed clean: the published source is byte-identical to the tag. Rebuilt diagnostic-reference from it and ran the regression test:

    • lspkit 0.5.0: crates/lspkit/tests/sidecar_disconnect_session.rs native_disconnects_preserve_prefix_and_payload_failures_after_valid_traffic → ok (1 passed)

    Red→green evidence for the fix itself: docs/plans/issue-fix-evidence-21-26-48-49.md (PR #51).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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