feat(core): share session history through timelines by thdxr · Pull Request #47552 · anomalyco/opencode · GitHub
Skip to content

feat(core): share session history through timelines - #47552

Open
thdxr wants to merge 3 commits into
v2from
timeline
Open

feat(core): share session history through timelines#47552
thdxr wants to merge 3 commits into
v2from
timeline

Conversation

@thdxr

@thdxr thdxr commented Sep 6, 2026

Copy link
Copy Markdown
Member

Issue for this PR

No linked issue.

Type of change

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

What does this PR do?

Adds timeline-backed session history. Forks reference a frozen prefix, committed undo selects a new timeline, and reads use indexed message ranges. Shared history survives deletion of its originating session. Active forks omit unfinished messages and materialize only the necessary settled suffix.

The transactional migration gives every existing session a root timeline and rebuilds the session/message tables while preserving their data and dependent rows. V1 imports create timelines directly; the temporary opencode-next.db importer is removed.

Clients keep flat session message lists. Undo handling uses message order rather than lexical IDs, and snapshot imports handle shared-ID collisions. Public API/event schemas and event versions are unchanged; settled-message selection happens inside the fork projection transaction.

How did you verify your code works?

  • Workspace pre-push typecheck: 33 tasks passed.
  • Core session/instruction/migration suites: 650 tests passed.
  • TUI: 80 tests; client: 24; server: 5; protocol: 8; schema event manifest: 7—all passed.
  • Temporary checks exercised populated migration with FK enforcement, nested and active forks, pagination, independent undo, source deletion, and overlapping snapshot imports.
  • Client generation and migration-schema consistency checks passed.
  • One unrelated schema hygiene test fails on both this branch and v2 because of existing Schema.Any usage.

Screenshots / recordings

Not applicable.

Checklist

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant