fix(persistence): address review feedback on PR #1851

- Fix naive datetime.now() → datetime.now(UTC) in all ORM models
- Fix seq race condition in DbRunEventStore.put() with FOR UPDATE
  and UNIQUE(thread_id, seq) constraint
- Encapsulate _store access in RunManager.update_run_completion()
- Deduplicate _store.put() logic in RunManager via _persist_to_store()
- Add update_run_completion to RunStore ABC + MemoryRunStore
- Wire follow_up_to_run_id through the full create path
- Add error recovery to RunJournal._flush_sync() lost-event scenario
- Add migration note for search_threads breaking change
- Fix test_checkpointer_none_fix mock to set database=None

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
rayhpeng
2026-04-05 22:02:50 +08:00
parent 7fdf9cad99
commit fc4e3a52d4
14 changed files with 172 additions and 110 deletions
+10 -1
View File
@@ -317,7 +317,16 @@ async def create_thread(body: ThreadCreateRequest, request: Request) -> ThreadRe
@router.post("/search", response_model=list[ThreadResponse])
async def search_threads(body: ThreadSearchRequest, request: Request) -> list[ThreadResponse]:
"""Search and list threads from the threads_meta table."""
"""Search and list threads from the threads_meta table.
NOTE: Migration from pre-persistence-layer deployments:
Threads created via LangGraph Server before this change are NOT
automatically indexed in threads_meta. They will not appear in
search results until a new run is created on them (which triggers
thread_meta upsert in services.py). For bulk migration, run:
python -m deerflow.persistence.migrate_threads_from_checkpointer
(migration script TBD in a follow-up PR)
"""
from app.gateway.deps import get_thread_meta_repo
repo = get_thread_meta_repo(request)