Skip to content

Mail inbox can time out from full-graph broadcast amplification #288

Description

@ZekeAranyLucas

Problem

A worker running graphcode mail inbox reported that the mailbox was oversized and the command timed out. The room is bounded, but the inbox read path still transports and broadcasts the entire project graph rather than a bounded mailbox response.

Observed on the odang graph:

  • 35 nodes
  • 220 retained mailroom posts
  • persisted project graph JSON: about 204 KB
  • mail list --json: 146,840 bytes
  • auto-triaged mail inbox: 19,501 bytes across 221 lines

The read-only mail list --json completes quickly in isolation, so the likely problem is amplification under the live graph with many connected workers rather than rendering alone.

Current flow

mail inbox currently:

  1. Opens the project and receives a full LoopGraph snapshot, including every retained mail body.
  2. Sends mailroomInbox to advance the calling node cursor.
  3. Persists the whole graph and broadcasts another full graphChanged snapshot to all connected clients.
  4. Waits for that broadcast, then renders unread mail from the original snapshot.

Concurrent workers checking mail can therefore produce repeated roughly 200 KB broadcasts to every connected client, even though the final output is headline-triaged to roughly 20 KB.

There is also a known cursor race: a post arriving between the initial snapshot and cursor advancement can be marked read without being included in the rendered output.

Expected

Inbox reads should have bounded cost based on the unread response, not the size of the entire graph or the number of connected clients. The cursor should advance only through the highest post actually returned to the reader.

Potential direction: add a dedicated mailbox request/response carrying bounded unread headlines plus the highest delivered post ID, and update the cursor without requiring a full graph broadcast as the acknowledgement.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions