Skip to content

Session summaries should cap or filter huge generated/vendor diffs in message.data.summary.diffs #30165

Closed as not planned

Description

@rayzhangxql-design

Summary

OpenCode can store very large diffs inside SQLite message.data.summary.diffs.

When generated/vendor/cache files are included, this can create huge message rows and cause downstream consumers such as Claudian/Obsidian to freeze or show blank restored sessions.

I think OpenCode should add filtering and size caps for session summary diffs before they are written into persistent message data.

Environment

  • OpenCode provider used through Claudian
  • Storage: SQLite DB at ~/.local/share/opencode/opencode.db
  • Affected field: message.data.summary.diffs
  • Downstream consumer: Claudian Obsidian plugin

What Happened

Some OpenCode session messages contained very large summary.diffs.

In one affected session, a single message was around 2.69 MB because summary.diffs contained 13 generated/vendor diffs from a Vite dependency cache path similar to:

frontend/node_modules/.vite/deps/...

These diffs were not meaningful conversation content. They were generated dependency/cache files.

The large message row caused downstream session rendering problems in Claudian/Obsidian.

After removing only generated/vendor/cache entries from message.data.summary.diffs, the session became much safer to load while preserving all actual conversation rows and parts.

Later, for two sessions that still showed blank content in Claudian, removing only their summary.diffs metadata reduced the largest message rows significantly:

Before:
max message length: 738756 bytes
summary diff bytes: 1638126

After:
max message length: 460 bytes
summary diff bytes: 0

The actual conversation content was preserved:

messages unchanged
parts unchanged
text parts unchanged
text bytes unchanged

Why This Is a Problem

summary.diffs is useful metadata, but storing full large diffs in message rows can cause:

  • very large SQLite rows
  • slow session restore
  • high memory usage during JSON parsing
  • downstream UI freezes
  • blank session rendering in integrations
  • polluted summaries with generated files that users do not care about

Generated/vendor/cache diffs are especially problematic because they are usually not useful for human review.

Expected Behavior

OpenCode should avoid storing huge generated/vendor/cache diffs in message.data.summary.diffs.

Instead, it should either:

  • omit them
  • summarize them
  • store only metadata
  • cap them by byte/line count
  • lazy-load full diff content only if explicitly requested

Suggested Default Filters

OpenCode should exclude or summarize-only paths matching common generated/vendor/cache patterns:

node_modules/
.vite/
dist/
build/
out/
coverage/
.cache/
cache/
caches/
__pycache__/
*.pyc
*.pyo
*.pyd
.pytest_cache/
.mypy_cache/
.ruff_cache/
.next/
.nuxt/
.turbo/
vendor/
third_party/
site-packages/
.venv/
venv/

Suggested Size Caps

Possible default limits:

  • max bytes per diff entry
  • max diff entries per message
  • max total summary.diffs bytes per message
  • max total summary.diffs bytes per session
  • max rendered/stored lines per diff

For example:

per file diff cap: 50-100 KB
per message summary diff cap: 250-500 KB
per session summary diff cap: configurable

If a diff exceeds the cap, store metadata instead of full patch content:

{
  "file": "frontend/node_modules/.vite/deps/chunk-xyz.js",
  "omitted": true,
  "reason": "generated_or_too_large",
  "originalBytes": 734221,
  "originalEntries": 1
}

Related Issues

These existing issues seem related to large diffs / session restore performance:

Suggested Implementation Direction

1. Add path filtering before writing message.data.summary.diffs

Filter generated/vendor/cache paths before persisting summary diffs.

2. Add byte/entry caps

Even non-generated real code diffs can become large. Summary diffs should be bounded.

3. Store omitted metadata instead of full patches

Keep the summary useful without storing huge payloads.

4. Make full diffs lazy/on-demand

If full diffs are needed, store them outside the main message row and load only when requested.

5. Make the filter configurable

Users should be able to add custom ignore patterns for summary diffs.

Acceptance Criteria

  • Generated/vendor/cache paths are not stored as full patches in message.data.summary.diffs.
  • Oversized diffs are capped or replaced with omitted metadata.
  • SQLite message rows remain bounded in size.
  • Session restore does not require parsing megabytes of summary diffs.
  • Downstream consumers can safely hydrate sessions without custom cleanup.
  • Existing conversation content remains unaffected.

Activity

  1. github-actions commented on Jun 1, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This appears to be a Feature Request but does not use the Feature Request template. The title should start with [FEATURE]: and the issue should include the required verification checkbox confirming the feature does not already exist.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Jun 1, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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