Skip to content

storage: migrate workflow state to SQLite - #1686

Merged
likun666661 merged 2 commits into
apache:mainfrom
likun666661:agent/workflow-sqlite
Jul 31, 2026
Merged

likun666661 merged 2 commits into
apache:mainfrom
likun666661:agent/workflow-sqlite

Conversation

@likun666661

Copy link
Copy Markdown
Member

Summary

Stage 4a of #1649 moves the workflow ledgers that currently have active production writers into the shared runtime.sqlite authority:

  • Task Ledger events and projections
  • Plan events and projections
  • Deep Research events
  • Agent Mailbox messages
  • Plan Reminder records

Desktop and Runtime Host now open the SQLite-backed stores, wait for cutover before serving mutations, and release their database leases during orderly shutdown and initialization failures.

Migration guarantees

  • Legacy JSON/JSONL is decoded and validated before cutover.
  • Every source set has a deterministic fingerprint recorded in cutover_journal.
  • Row copy, validation, and the completed marker commit in one SQLite transaction.
  • A failpoint/crash after rows are copied rolls back cleanly and the next open resumes.
  • Once cutover completes, mutations are SQLite-only; legacy bytes remain unchanged as migration evidence.
  • A later legacy-file change fails closed instead of silently merging two authorities.
  • Event ledgers remain canonical; projections are reconstructable.

Scope boundary

This is deliberately Stage 4a, not a claim that all Stage 4 state is complete. A follow-up Stage 4b will handle usage/pricing and artifact metadata/lifecycle. Artifact payload bytes remain files and need their own recoverable metadata/payload publication protocol.

StoredMessage transcripts remain append-only JSONL. Configuration stores and the separate product/evaluation domains listed in the README are outside #1649.

Verification

  • npm --workspace @maka/storage run test:dist — 839 passed, 1 skipped
  • npm --workspace @maka/runtime-host run test:dist — passed
  • Runtime Host execution-host suite — 25 passed
  • npm --workspace @maka/desktop run build:main — passed
  • Desktop workflow wiring contract tests — 3 passed
  • Biome lint on changed files and git diff --check — passed

The local full Desktop pretest could not rebuild @maka/ui because this checkout is missing the declared @astryxdesign/core package in node_modules. The affected Desktop main build and migration-specific contracts pass; CI will run from a clean dependency install.

@likun666661
likun666661 marked this pull request as ready for review July 31, 2026 09:02
@likun666661
likun666661 merged commit 1c274df into apache:main Jul 31, 2026
5 of 6 checks passed
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