Skip to content

fix(coding-agent): bound public daemon client JSONL ingress #13

Description

@rynfar

Problem

The public DaemonClient JSONL reader currently accepts an unbounded line/buffer. A daemon or mismatched listener that sends bytes without a newline can grow every SDK consumer process until out-of-memory before the consumer can validate or normalize the message.

This affects both native consumers:

Comet can isolate its bootstrap-only client in a small bounded Node process, but a long-lived asynchronous session host must not rely on process OOM as framing control.

Required outcome

  • The public daemon client has an explicit bounded JSONL ingress policy.
  • A no-newline stream and an oversized complete line fail with a typed local client error.
  • The policy accounts for legitimate snapshot/chunk traffic and does not silently truncate.
  • Limits apply before UTF-8/JSON parsing and release pending request/hello waiters deterministically.
  • Reconnect cannot retain the prior connection's partial buffer.
  • Public API documentation states the default and any constructor/connection override.

This is client-local safety behavior. Do not infer support from package version, method presence, branch name, or daemon capability. If compatibility requires an opt-in API before a safe default can ship, document that migration explicitly.

Tests

Cover:

  • bytes without a newline exceeding the buffer limit;
  • a complete oversized JSONL frame;
  • boundary-sized valid frames;
  • chunked snapshot traffic within bounds;
  • pending hello/request rejection and cleanup;
  • reconnect after a bounded-ingress failure;
  • no raw frame contents in the surfaced error.

Coordination

No branch or worktree is claimed by this issue yet. Follow PYLON.md before implementation and cross-review the public client contract with both Pylon and Comet consumers.

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