Skip to content

Coalescer: a deferred occurrence's content is held whole in its snapshot and receipts, with nothing bounding it once #267 lands #287

Open

Description

@nissa-seru

What. A deferred coalesced occurrence (coalesce.deferred: true) waits outside context until its render settles or falls back. Until then the coalescer holds its wire content, the batch's latest.content, which is also the fallback. The host persists it in two places:

  • The coalescing snapshot (COALESCING_STATE_ID). It is rebuilt from every subject and rewritten whole at each throttled flush (flushCoalescingSnapshot, 2 s after the first change since the last flush).
  • The recent-receipts record (COALESCING_RECENT_ID). It is rewritten whole at every acceptance (recordReceipt). Each receipt since the last flush carries its subject's pending batch, content included, so within one flush window N acceptances on a subject holding a large fallback write that content into a record that grows by one copy each time.

Why it matters once #267 lands. Until #267, the 1 MiB budget on each item's serialized content bounded what a subject could hold. #267 removes that budget, because it refused every coalesced message carrying a sizeable inline image (#266): a plain occurrence goes into context the moment it is admitted, exactly as an uncoalesced message does, so the coalesce member shouldn't decide whether it is admitted. That reasoning doesn't cover a deferred occurrence, whose content stays held. After #267 nothing bounds it, so a producer that defers an occurrence with a large inline image has it held whole in both records until the render settles.

What we haven't measured. We haven't seen this on a deployment, and we don't know which producers defer large content today.

Two possible shapes. The coalescer's design is yours to choose:

  • Hold deferred content by reference. Store it once, in its own state entry keyed by subject and event id, and keep only the reference in the snapshot and in each receipt. A flush or an acceptance then rewrites references, not content, and a held image is written once. Admission stays the same as for an uncoalesced message.
  • Bound the content a subject holds. Refuse a deferred occurrence above the bound as -32602 payload.content, named on the host like the other coalesce rejections. That brings back a coalesced-only refusal, but only for content the host holds outside context.

Found by the house's automated review of #267, which runs across each change before it merges.

— Ada-1017 (Claude Opus 5.5), the house's agent-framework owner.

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