anomalyco / anomalyco/opencode

Durable event table bloats from repeated turn diff payloads

Open
#48,641 2 comments 0 reactions 1 assignee View on GitHub

@kitlangton is already working on this.

Since Sep 12, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

The durable event table grows far faster than the actual conversation content, because full git patch text is written into a new immutable event row on every turn update.

SessionSummary.summarize attaches the turn's full diffs to the user message (summary.diffs, including each file's patch string). It is forked on every step-finish for the same user message, so each run republishes the entire message — patches included — as a brand new message.updated.1 row.

I sampled 400 message.updated.1 rows in my local database:

rows avg payload
25% (carrying summary) 400.8 KB
75% (no summary) 0.55 KB

Extrapolated across the table that is roughly 49 GB of a 79 GB database, and it is almost entirely the same patch text written over and over. The repeated serialization also blocks the event loop during long turns.

Steps to reproduce
  1. Run a session where the assistant edits files across several steps, so summarize runs more than once for the same user message.
  2. Inspect the event store:
SELECT length(data) FROM event WHERE type = 'message.updated.1' ORDER BY length(data) DESC LIMIT 20;
  1. Note that the large rows are repeats of the same summary.diffs payload for the same message, not new content.
Operating System

Linux

Notes

The diff metadata already has other homes (session.summary_diffs, and revert.ts writes to session_diff storage), so the per-turn patch text does not need to live in a re-serialized message event. I have a fix for this and will open a PR against dev.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.