deerflow2/backend/packages/harness/deerflow/runtime
ly-wang19 579e416459
perf(runtime): index messages in MemoryRunEventStore to avoid O(n) scans (#3531)
list_messages re-scanned every event in the thread on each call (category
filter + seq filter) — O(total events) per paginated request on the default
run-events backend. Maintain a messages-only, seq-sorted projection of _events
(shared dict refs, no copies) and locate the seq window with bisect:
list_messages drops to O(log m + page) and count_messages to O(1). The index is
kept in lockstep at every mutation site (put / put_batch via _put_one,
delete_by_run, delete_by_thread).

Externally observable behavior is unchanged — the full RunEventStore contract
suite passes across memory/db/jsonl.

Add a test covering pagination over non-contiguous message seqs (messages
interleaved with trace events), including in-gap and exact-boundary cursors.

Co-authored-by: ly-wang19 <ly-wang19@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 22:58:30 +08:00
..
checkpointer fix(runtime): protect sync singleton init and reset (#3413) 2026-06-08 08:38:36 +08:00
events perf(runtime): index messages in MemoryRunEventStore to avoid O(n) scans (#3531) 2026-06-12 22:58:30 +08:00
runs perf(runtime): index runs by thread_id to avoid O(n) scans in RunManager (#3499) 2026-06-12 16:48:47 +08:00
store fix(runtime): protect sync singleton init and reset (#3413) 2026-06-08 08:38:36 +08:00
stream_bridge refactor: root release config in gateway runtime (#2611) 2026-04-28 00:13:04 +08:00
__init__.py feat(persistence):Unified persistence layer with event store, feedback, and rebase cleanup (#2134) 2026-04-26 11:09:55 +08:00
converters.py Fix the issues when reviewing 2566 persistant part (#2604) 2026-04-28 11:44:40 +08:00
journal.py fix runtime journal run lifecycle events (#3470) 2026-06-10 08:33:29 +08:00
serialization.py feat(gateway): implement LangGraph Platform API in Gateway, replace langgraph-cli (#1403) 2026-03-30 16:02:23 +08:00
user_context.py fix(agents): make update_agent honor runtime.context user_id like setup_agent (#2867) 2026-05-12 23:18:54 +08:00