Skip to content

userData retention: tool-images and attachments have no owner, and the comment gating that decision has expired #625

Closed as not planned

Description

@currentbits

#316/#559/#563 gave worktrees a retention owner, and it worked — worktrees went 96 GB → 27.6 GB this week. Every other thing Solenta writes to userData still has none, and two of them say so in their own source.

Inventory (this machine, 2026-08-20)

worktrees               27.6 GB   owned by GC (#316/#559)     ✓
coder-store.json.bak       177 MB no owner
coder-store.json           163 MB per-thread caps (#89), aggregate unbounded (#225)
memory.db                   44 MB memory-server janitor
tool-images                 28 MB no owner
attachments                  5 MB no owner

electron/tool-images.js:8-9 states the shortcut and its trigger:

// ponytail: files are never pruned — a screenshot is ~200KB and nothing else
// in userData is pruned either. Add an age sweep on boot if it ever grows.

Both halves have expired. The premise "nothing else in userData is pruned either" was true when it was written (2026-08-15) and false since #559 shipped. And it grew: 19 MB / 114 files yesterday → 28 MB / 159 files today, roughly +9 MB/day under normal use. electron/attachments.js:92 carries the same note ("nothing here is pruned") without even the trigger condition.

None of this is urgent in absolute terms — 33 MB of images against 27.6 GB of worktrees is a rounding error, and it should be filed as the small ticket it is. It is unbounded, which is the only reason it is worth a ticket at all: at ~9 MB/day it is a few GB a year, and nothing will ever reclaim a byte.

The .bak is the odd one out

coder-store.json.bak is 177 MB, larger than the live store, rewritten in full on every boot (store.js:1086, copyFileSync on the load path — 62 ms measured, see #618). It is not really a retention problem; it is a whole-file backup of a whole-file store, so #225's shard makes it small automatically. Noting it here only so the inventory is complete — do not fix it separately, it falls out of #225.

Proposal

One boot sweep that owns the non-worktree surfaces, next to the existing worktree sweep in main.js:380:

Deliberately not proposed: a UI. The worktree GC earned one because it was reclaiming tens of GB; 33 MB does not deserve a dialog. A log line is enough.

Tests

  • A tool-image older than the cutoff and unreferenced is removed; one referenced by a retained message is kept regardless of age.
  • The sweep is a no-op on a fresh profile and never throws on a missing directory.

Related

#559/#316/#563 (the GC that made this comment's premise stale), #225 (owns the .bak and makes the reference scan cheap), #618 (boot ordering — the sweep must stay off the critical path), #89.

Activity

  1. currentbits commented on Aug 20, 2026

    @currentbits
    OwnerAuthor

    Duplicate of #145, which filed the same defect on 2026-08-16 from a code reading of the same tool-images.js:8-9 / attachments.js:92 comments. #145 is the superset - it also covers the sync readFileSync + base64 reads on the main thread.

    The disk inventory and the +9 MB/day growth measurement from this issue have been copied onto #145. Closing here so the retention work has one home.

  2. added
    plan:done
    and removed
    plan:todo
    on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions