Skip to content

fix(relay): align message byte limits and native worker framing #264

Closed

Description

@abruption

What happened

Priority: P2. Paired-device messages accepted by the receiver's UTF-8 byte limit can be truncated by the internal native-worker JSON reader. Separately, a known pre-frame size rejection is returned as an unknown submission.

Source:

The receiver accepts up to 32,768 UTF-8 message bytes, but internal json.dumps uses ASCII escaping and the worker reads only 65,537 bytes.

Synthetic binding results:

  • 32,000 UTF-8 bytes of emoji produce 96,086 worker JSON bytes and fail before native execution.
  • 32,766 UTF-8 bytes of Hangul produce 65,618 worker JSON bytes and fail before native execution.
  • 32,700 bytes of Hangul pass with a short binding; the actual threshold varies with binding/envelope overhead.

Also, a 70,000-byte body rejected by the real Secure.send pre-frame size guard produces status=unknown through exchange, despite zero TLS writes in the synthetic channel.

What you expected

Valid bounded messages should survive internal framing. A positively proven pre-effect size rejection should be reported as refusal, while ambiguous I/O failures remain unknown and never trigger resend.

Environment

  • Python session-peer 1.0.3 / source 817d92ab780f657ec754d40fcf86087b5b01a883.
  • macOS arm64, Python 3.13.7.
  • Actual worker parser and wire size guard exercised with mocked policy/native effect and a fake preconnected channel.
  • No real native submission, TLS/network connection, receiver journal query, or live ACK test occurred.

Discovery output

Not applicable: synthetic parser/framing verification.

Proposed fix and acceptance criteria

  • Define compatible byte budgets for raw message, full application envelope, and worker frame including operator-owned binding overhead.
  • Preserve UTF-8 messages and handle worst-case JSON escaping; ensure_ascii=False alone must not be assumed to solve control-character expansion.
  • Enforce known message/envelope limits before application submission.
  • Test ASCII, Hangul, emoji, escaping-heavy inputs, long policy bindings, and boundary/over-limit cases.
  • Known pre-effect oversize refusal causes no application write/native effect/journal send intent; real later uncertainty stays unknown.
  • Preserve status/reconciliation semantics and never retry the original send automatically.

Related work

Closed #176 addressed native preflight classification, and #207 bounded SSH command bytes. This is a separate paired-device/worker framing boundary, not a request to raise limits without bounds.

Checked

  • Searched existing issues and open PRs.
  • Removed sensitive information; messages/bindings were generated fixtures.
  • No real transport or approval-setting changes were made.

Activity

  1. added this to the v1.0.4 milestone on Oct 7, 2026
  2. added
    bug
    on Oct 7, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions