Skip to content

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

@hendem

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

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