deerflow2/backend/app/gateway/routers
Willem Jiang 39f901d3a5
fix(runs): restore historical runs from persistent store after gateway restart (#2989)
* fix(runs): restore historical runs from persistent store after gateway restart

  RunManager.list_by_thread() and get() only queried the in-memory _runs
  dict, returning empty results after a restart even when PostgreSQL had
  the records. Add store fallback to both read paths and a new async
  aget() for the API endpoint, keeping sync get() for internal callers
  that need live task/abort_event state.

    Fixes #2984

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix(runs): scope run store fallback reads by user id

Agent-Logs-Url: https://github.com/bytedance/deer-flow/sessions/e73daada-1215-4bc1-ab7d-7117826c5013

Co-authored-by: WillemJiang <219644+WillemJiang@users.noreply.github.com>

* test(runs): clarify ordering expectation and mock store filters

Agent-Logs-Url: https://github.com/bytedance/deer-flow/sessions/e73daada-1215-4bc1-ab7d-7117826c5013

Co-authored-by: WillemJiang <219644+WillemJiang@users.noreply.github.com>

* test(runs): make user filter fallback assertions explicit

Agent-Logs-Url: https://github.com/bytedance/deer-flow/sessions/e73daada-1215-4bc1-ab7d-7117826c5013

Co-authored-by: WillemJiang <219644+WillemJiang@users.noreply.github.com>

* test(runs): verify user-isolated fallback behavior with memory store

Agent-Logs-Url: https://github.com/bytedance/deer-flow/sessions/e73daada-1215-4bc1-ab7d-7117826c5013

Co-authored-by: WillemJiang <219644+WillemJiang@users.noreply.github.com>

* update the code with feedback from issue-2984

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-05-17 20:03:21 +08:00
..
__init__.py feat(gateway): implement LangGraph Platform API in Gateway, replace langgraph-cli (#1403) 2026-03-30 16:02:23 +08:00
agents.py feat(agent): add custom-agent self-updates with user isolation (#2713) 2026-05-05 23:17:42 +08:00
artifacts.py fix(gateway): cap skill artifact preview size (#2963) 2026-05-15 22:15:58 +08:00
assistants_compat.py feat(gateway): implement LangGraph Platform API in Gateway, replace langgraph-cli (#1403) 2026-03-30 16:02:23 +08:00
auth.py docs: document auth design and user isolation (#2913) 2026-05-12 23:07:11 +08:00
channels.py refactor: split backend into harness (deerflow.*) and app (app.*) (#1131) 2026-03-14 22:55:52 +08:00
feedback.py feat(persistence):Unified persistence layer with event store, feedback, and rebase cleanup (#2134) 2026-04-26 11:09:55 +08:00
mcp.py fix: issue 1138 windows encoding (#1139) 2026-03-16 16:53:12 +08:00
memory.py feat(persistence): per-user filesystem isolation, run-scoped APIs, and state/history simplification (#2153) 2026-04-26 11:13:01 +08:00
models.py refactor: thread release config through lead path (#2612) 2026-04-28 14:53:18 +08:00
runs.py feat: enhance chat history loading with new hooks and UI components (#2338) 2026-04-26 11:20:17 +08:00
skills.py refactor(skills): Unified skill storage capability (#2613) 2026-05-01 13:23:26 +08:00
suggestions.py refactor: thread release config through lead path (#2612) 2026-04-28 14:53:18 +08:00
thread_runs.py fix(runs): restore historical runs from persistent store after gateway restart (#2989) 2026-05-17 20:03:21 +08:00
threads.py perf(harness): push thread metadata filters into SQL (#2865) 2026-05-12 23:21:22 +08:00
uploads.py Fix duplicate gateway upload filenames (#2789) 2026-05-09 18:02:40 +08:00