perf: strip bloated fields from session ingest, reducing payload 50-77%#503
Open
marius-kilocode wants to merge 2 commits intomainfrom
Open
perf: strip bloated fields from session ingest, reducing payload 50-77%#503marius-kilocode wants to merge 2 commits intomainfrom
marius-kilocode wants to merge 2 commits intomainfrom
Conversation
Strip summary.diffs[].before/after, metadata.filediff.before/after, and metadata.diagnostics from ingest items before storage. These fields contain full file snapshots and project-wide LSP diagnostics that are only needed for local UI rendering, not cloud storage/export. Measured reduction: 50-77% of ingest payload size per session.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Clean, well-structured PR that strips bloated fields ( Key observations:
Files Reviewed (3 files)
|
Strip bloated fields in splitIngestBatchForDO before measuring item size, so items that exceed the ~2MiB limit only because of file snapshots or diagnostics are no longer dropped. Cloudflare observability showed 226 items dropped as oversized and 130 DO OOM crashes in a 45-minute window. Moving the strip upstream addresses both: items are measured post-strip, and the DO stores smaller payloads reducing alarm memory pressure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Strip bloated fields from session ingest items before storage in the Durable Object. These fields are only needed for local UI rendering and are not used by the cloud (share page, metrics, export).
What's Stripped
session.data.summary.diffs[].before/.afterpart.data.state.metadata.filediff.before/.afterpart.data.state.metadata.diagnosticsMeasured Impact
From two profiled sessions in the kilocode repo:
The remaining fields (file path, additions/deletions counts, diff text) are preserved — only the raw file content and project-wide diagnostics are removed.
Changes
cloudflare-session-ingest/src/util/strip-ingest-bloat.ts—stripIngestBloat(item)function that creates a new item with bloated fields removed (does not mutate input)cloudflare-session-ingest/src/dos/SessionIngestDO.ts— applystripIngestBloat()to each item in theingest()method beforeJSON.stringifyand storagecloudflare-session-ingest/src/util/strip-ingest-bloat.test.ts— 9 test cases covering session stripping, part stripping, passthrough for other types, graceful handling of missing fields, and immutabilityTesting
Companion PR
Kilo-Org/kilocode#6241 — filters diagnostics to only the edited file(s) in the local CLI tools, reducing what gets stored in the local SQLite database.