Skip to content

chore(ops): reclaim pre-guard session data from the local database #531

Description

@LeXwDeX

This was generated by AI during triage.

Why

The payload-growth defect fixed by #522 left historical data in the local opencode.db. The #523 and #525 code fixes prevent or reduce future growth but cannot remove existing user sessions or return already allocated SQLite pages to the filesystem.

This is a destructive operator task, not a source-code delivery.

Scope

  • Identify the exact database path and create a verified backup before any mutation.
  • Produce a read-only dry run listing the proposed cutoff, affected session IDs/counts, event/message/part counts, estimated reclaimable bytes, and sessions that will remain.
  • Obtain explicit human approval for that exact deletion set.
  • Stop every opencode process, delete only approved sessions through a path that also removes event and event_sequence, then run SQLite integrity checks and VACUUM while exclusive access is guaranteed.
  • Record before/after counts, database size, integrity result, and application startup smoke result.

Safety constraints

  • No agent may execute deletion or VACUUM from this issue without a separate explicit approval after presenting the dry-run evidence and backup location.
  • Do not infer consent from approval of chore(core): design bounded event retention and SQLite reclamation #524 or from approval to develop code.
  • Abort if the database changes between dry run and maintenance window, backup verification fails, or another opencode process is active.

Acceptance

  • The approved backup exists and is restorable.
  • The actual deletion set exactly matches the approved dry run.
  • PRAGMA integrity_check succeeds after cleanup.
  • The database file shrinks materially after offline VACUUM and opencode starts successfully.
  • A completion comment records non-sensitive before/after measurements without publishing session contents.

Relations

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions