Replace JSON timeline/A2A stores with shared SQL persistence (SQLite/Postgres) - #118
Draft
groupthinking with Copilot wants to merge 2 commits into
Draft
Replace JSON timeline/A2A stores with shared SQL persistence (SQLite/Postgres)#118groupthinking with Copilot wants to merge 2 commits into
groupthinking with Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Update storage approach for Railway deployment
Replace JSON timeline/A2A stores with shared SQL persistence (SQLite/Postgres)
Aug 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The timeline and A2A flows depended on per-service JSON files, which breaks cross-service state sharing on Railway and is race-prone under concurrent writers. This change moves both stores to a shared SQL backend selected via
DATABASE_URL, preserving existing store APIs used bytimeline_server.py,listener.py, andmcp_dispatcher.py.Storage backend + engine lifecycle
storage_db.pywith SQLAlchemy-backed engine/schema fortimeline_items,a2a_agents, anda2a_messages.DATABASE_URL:~/.xmcp/xmcp.db)postgres://...normalized topostgresql://...for Railway compatibility.create_all).Drop-in store refactor (API preserved)
timeline_store.pyanda2a_store.pywith SQL operations while keeping function signatures unchanged.actions,tags, andmetadataas JSON columns.Concurrency correctness
timeline_store.update_item()now executes read/merge/write in one transaction using a write lock at the DB transaction level (SQLite usesBEGIN IMMEDIATE), preventing lost updates in approval/action paths.One-time migration from legacy JSON
scripts/migrate_json_to_sql.pyto importTIMELINE_STORE_PATHandA2A_STORE_PATHJSON data.Config + deployment docs aligned with shared DB model
DATABASE_URLguidance toenv.exampleand.env.example.docker-compose.ymlto include Postgres and wire sharedDATABASE_URLacross services.README.mdanddocs/DEPLOYMENT.mdto describe SQL storage and Railway requirement that all four services share one PostgresDATABASE_URL.Coverage for new behavior
tests/test_sql_storage.pyfor:postgres://normalization