Persist timeline and A2A state in shared SQL storage - #1778
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
| try: | ||
| conn.execute( | ||
| insert(self.sessions).values( | ||
| session_id=session_id, |
🔍 PR Validation |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches. Re-running this action after a short time may resolve the issue. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
groupthinking
left a comment
There was a problem hiding this comment.
@copilot Make sure no super seeded issue
There was a problem hiding this comment.
🟡 Changes recommended
The CAS still permits stale metadata clobbering, and several persistence paths have concurrency and operational reliability gaps.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds shared SQL persistence for session timelines and A2A messages.
Changes:
- Introduces SQLite/PostgreSQL shared-state storage and URL normalization.
- Integrates persistence into session and agent orchestration.
- Adds cross-instance regression tests.
File summaries
| File | Description |
|---|---|
src/youtube_extension/services/shared_sql_state.py |
Implements shared SQL storage. |
src/youtube_extension/services/agents/adapters/agent_orchestrator.py |
Persists and retrieves A2A logs. |
scripts/maintenance/session_orchestration_manager.py |
Moves session timelines to SQL. |
tests/unit/test_agent_orchestrator.py |
Tests A2A persistence and URL normalization. |
tests/unit/test_session_orchestration.py |
Tests cross-instance timeline updates. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 8
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| merged = self._deserialize(current["payload"]) | ||
| merged.update(payload) |
| self._shared_state.save_session(session) | ||
| self._shared_state.append_timeline_event(session_id, initial_event) |
| session = self._shared_state.get_session(session_id) | ||
| if not session or session.get("status") != "running": | ||
| logger.error(f"Session {session_id} is not active.") | ||
| return False |
| if shared_database_url: | ||
| try: | ||
| self._shared_state = SharedSQLStateStore( | ||
| database_url=shared_database_url | ||
| ) | ||
| except Exception as exc: | ||
| self.logger.warning("Shared A2A SQL state unavailable: %s", exc) | ||
| self._shared_state = None | ||
| else: | ||
| self._shared_state = None |
| "strategic_analysis": ["personality_agent", "strategy_agent"], | ||
| "chat_assistance": ["transcript_action"], | ||
| } | ||
| self._hydrate_a2a_log() |
| if self.get_session(session["id"]) is not None: | ||
| continue | ||
| self.save_session(session) | ||
| for event in session.get("timeline", []): | ||
| self.append_timeline_event(session["id"], event) |
| for payload in rows: | ||
| session = self._deserialize(payload) | ||
| session["timeline"] = self.list_timeline(session["id"]) | ||
| sessions[session["id"]] = session |
| assert manager_one.send_message(session["id"], "first update") is True | ||
| assert manager_two.send_message(session["id"], "second update") is True |
|
Pull request created: #1840
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔴 E2E Test Results: FAILURE DETECTED
Test Output |
Canonical issue
Shared state for session timelines and A2A logs now lives in SQL instead of process-local JSON/in-memory storage, with Postgres URLs normalized onto psycopg and session writes guarded against lost updates.
Outcome
Session timeline events and A2A messages survive cross-instance access and share a single SQLite/Postgres-backed source of truth. Concurrent session metadata updates no longer clobber each other on stale writes.
Scope
SharedSQLStateStorefor sessions, timeline events, and A2A messagesSessionOrchestrationManagerreads/writes session state through shared SQL and imports legacy JSON session data onceAgentOrchestratorrecords and rehydrates A2A log entries from shared SQL when a shared DB is configuredpostgres://,postgresql://,postgresql+asyncpg://, andpostgresql+psycopg2://, normalizing topostgresql+psycopg://Risk
SharedSQLStateStoreintegration in the session orchestration manager and agent orchestrator; legacy JSON bootstrap path remains available in the managerVerification
List exact automated and manual checks, tied to the current head SHA.
1aac5e8:PYTHONPATH=src python3 -m pytest --no-cov tests/unit/test_session_orchestration.py tests/unit/test_agent_orchestrator.py tests/unit/test_antigravity_backend.py tests/unit/test_antigravity_orchestration.py -qProduction evidence
Not applicable. This change is backend/shared-state persistence work; no production deployment or Vercel-specific runtime evidence was required to validate the behavior.
Agent handoff