Skip to content

Client buffers every job.event per invocation for the job's lifetime with no drain #129

@nficano

Description

@nficano

Category: perf Severity: minor
Location: packages/client/src/client-dispatch.ts:357-378

What

Every job.event is pushed onto inv.events (and result_chunk bodies onto inv.chunks) for the job's entire lifetime with no cap or drain; inv.events is never read by the public client surface, so a long-running chatty job grows client memory without bound.

Evidence

const inv = target.invocationsByJobId.get(jobId);
  if (inv === undefined) return;
  inv.events.push(ep);

Proposed fix

Bound or drop inv.events accumulation (it is unused by the public API) and consider streaming chunks rather than retaining all bodies.

Acceptance criteria

  • A job emitting a large number of events does not grow client memory without bound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions