Skip to content

Compacted tool outputs and attachments not cleared from storage, causing memory growth #7421

Closed

Description

@hendem

Problem

When compaction prunes old tool outputs (in packages/opencode/src/session/compaction.ts), only the time.compacted timestamp is being set. The actual output string (often containing large file contents) and attachments array (base64 images/PDFs from the Read tool) remain in the storage JSON files indefinitely.

This causes storage files to grow unbounded, contributing to memory issues during extended use.

Expected Behavior

When prune() marks tool parts as compacted, it should also clear the output string and attachments array to free memory.

Actual Behavior

Only time.compacted is set; large output strings and attachment data persist indefinitely.

Related

Activity

  1. hendem commented on Jan 9, 2026

    @hendem
    Author

    Closing - will use existing issue #4315

  2. added
    perfIndicates a performance issue or need for optimization
    on Jan 9, 2026
  3. github-actions commented on Jan 9, 2026

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case.

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

Metadata

Metadata

Assignees

Labels

perfIndicates a performance issue or need for optimization

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions