Skip to content

fix(core): bound event log compaction#36710

Open
chubes4 wants to merge 3 commits into
anomalyco:devfrom
chubes4:fix/33356-event-log-compaction
Open

fix(core): bound event log compaction#36710
chubes4 wants to merge 3 commits into
anomalyco:devfrom
chubes4:fix/33356-event-log-compaction

Conversation

@chubes4

@chubes4 chubes4 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #33356

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds read-only event-log status plus explicit, dry-run-by-default bounded compaction (--session or --all, --apply, maximum 10,000 rows). Apply verifies latest message/part projection contents, batches in one immediate transaction, and only writes checkpoints for aggregates with no workspace or sync owner. Sync has no marker version negotiation, so synced/owned aggregates are reported and rejected.

How did you verify your code works?

  • bun test test/session-event-log-compaction.test.ts test/event.test.ts
  • bun typecheck (30 packages)
  • Prettier check

Screenshots / recordings

Not applicable; database maintenance CLI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

AI assistance

  • AI assistance: Yes
  • Tool(s): GPT-5.6-terra via OpenCode
  • Used for: Implementation, tests, and review-driven revision; Chris owns the change.

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Compact superseded session event snapshots doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added contributor needs:compliance This means the issue will auto-close after 2 hours. labels Jul 13, 2026
@chubes4 chubes4 changed the title Compact superseded session event snapshots fix(core): compact superseded event snapshots Jul 13, 2026
@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@chubes4 chubes4 changed the title fix(core): compact superseded event snapshots fix(core): bound event log compaction Jul 13, 2026
@chubes4 chubes4 force-pushed the fix/33356-event-log-compaction branch from bef5885 to 04954f8 Compare July 14, 2026 12:25
@chubes4

chubes4 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current dev (323d687173) and reverified after the latest upstream changes.

Fresh production evidence from today: ~/.local/share/opencode/opencode.db is now 27.2 GiB (page_size=4096, page_count=7,124,817, freelist_count=0), so this remains live append-only event data rather than reclaimable SQLite slack.

Verification on the rebased branch:

  • bun test test/session-event-log-compaction.test.ts test/event.test.ts — 45 passed
  • bun typecheck — 30 tasks passed across the workspace
  • bun prettier --check $(git diff --name-only origin/dev...HEAD) — passed

The branch is current, clean, mergeable, and CI is green. Maintainer review would be appreciated.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unbounded growth of the event table: opencode.db reaches 13GB+, mostly message.updated.1 snapshots (no retention/compaction)

1 participant