Mail peer v1: one oversize entity blocks the snapshot permanently #179

Closed
opened 2026-11-04 01:30:14 +00:00 by svc-agent-writer · 0 comments

Symptom

One oversize peer entity blocks a Mail peer v1 snapshot permanently. A consumer can never complete its first snapshot.

Seen on mailmind-piers (0.11.0, schema v16) with people-mind-mcp 0.1.0-rc.7 as the consumer (starbase/iac#323), 2026-11-04 12:27 AEDT:

  • People Mind staged 30,447 snapshot records, then mail_peer_snapshot_v1 returned record_too_large (duration 2 ms).
  • People Mind fails the pass as mailmind-record-too-large. The next pass resumes at the same cursor and hits the same record.

Cause

  • peer.py snapshot render (about line 830): a row with oversize set stops the page. A page whose first row is oversize raises record_too_large with no rows and no cursor advancement.
  • ADR 0008 §9 states this behaviour: "an unservable first record returns record_too_large without advancement". The contract has no way to skip, redact or tombstone one unservable entity, so the snapshot cannot pass it.
  • The same stopped and not events path exists in the changes feed (about line 910), so one oversize event would block the feed the same way.

The record

Read-only query on the piers store. Shape only, no addresses:

  • 1 of 249,077 peer_entities rows has oversize = 1; 0 peer_events rows do.
  • account fastmail, revised_at 2026-11-03T21:13:17Z, entity id length 34.
  • from: 1 address, 16 bytes. cc: 0 addresses.
  • to: 1 address, 361 characters. This is over PEER_ADDRESS_CHARS (320). It passed _PEER_ADDRESS.fullmatch, so it is probably a mis-parsed header rather than a real address.

Expected

One unservable entity must not stop the snapshot or the feed. Possible directions (for triage, not decided):

  1. Serve an oversize entity with a redacted envelope (for example, drop the over-limit addresses and mark the record), so the cursor advances.
  2. Add a contract-level skip or marker for an unservable record, under the next mind-v1 minor with the #152 gaps.
  3. Tighten address parsing or _PEER_ADDRESS so a 361-character value is never accepted as an address.

The consumer side may also need a finite policy for non-retryable records. That belongs on dev/people-mind-mcp and is not filed here.

Impact

People Mind on piers has never completed a Mail pass: interactions is 0 on both rc.6 and rc.7. CardDAV Sources are unaffected.

Related: #152.

Human act

T4 merge: the operator merges PR #180 and pushes the v0.12.1 tag (ADR-0011)

## Symptom One oversize peer entity blocks a Mail peer v1 snapshot permanently. A consumer can never complete its first snapshot. Seen on mailmind-piers (0.11.0, schema v16) with people-mind-mcp 0.1.0-rc.7 as the consumer (starbase/iac#323), 2026-11-04 12:27 AEDT: - People Mind staged 30,447 snapshot records, then `mail_peer_snapshot_v1` returned `record_too_large` (duration 2 ms). - People Mind fails the pass as `mailmind-record-too-large`. The next pass resumes at the same cursor and hits the same record. ## Cause - `peer.py` snapshot render (about line 830): a row with `oversize` set stops the page. A page whose first row is oversize raises `record_too_large` with no rows and no cursor advancement. - ADR 0008 §9 states this behaviour: "an unservable first record returns `record_too_large` without advancement". The contract has no way to skip, redact or tombstone one unservable entity, so the snapshot cannot pass it. - The same `stopped and not events` path exists in the changes feed (about line 910), so one oversize event would block the feed the same way. ## The record Read-only query on the piers store. Shape only, no addresses: - 1 of 249,077 `peer_entities` rows has `oversize = 1`; 0 `peer_events` rows do. - account `fastmail`, `revised_at` 2026-11-03T21:13:17Z, entity id length 34. - `from`: 1 address, 16 bytes. `cc`: 0 addresses. - `to`: 1 address, 361 characters. This is over `PEER_ADDRESS_CHARS` (320). It passed `_PEER_ADDRESS.fullmatch`, so it is probably a mis-parsed header rather than a real address. ## Expected One unservable entity must not stop the snapshot or the feed. Possible directions (for triage, not decided): 1. Serve an oversize entity with a redacted envelope (for example, drop the over-limit addresses and mark the record), so the cursor advances. 2. Add a contract-level skip or marker for an unservable record, under the next mind-v1 minor with the #152 gaps. 3. Tighten address parsing or `_PEER_ADDRESS` so a 361-character value is never accepted as an address. The consumer side may also need a finite policy for non-retryable records. That belongs on dev/people-mind-mcp and is not filed here. ## Impact People Mind on piers has never completed a Mail pass: `interactions` is 0 on both rc.6 and rc.7. CardDAV Sources are unaffected. Related: #152. ## Human act T4 merge: the operator merges PR #180 and pushes the v0.12.1 tag (ADR-0011)
piers closed this issue 2026-11-04 02:10:55 +00:00
piers referenced this issue from a commit 2026-11-04 02:11:09 +00:00
piers referenced this issue from a commit 2026-11-04 02:23:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dev/mail-mind-mcp#179
No description provided.