ReMe/reme
celanwang 681cc85fb5
fix(auto-memory): serialize session transcript writes per session (#633)
* fix(auto-memory): serialize session transcript writes per session

_save_session_messages ran its read-merge-write on the per-session
JSONL transcript without any lock. Concurrent HTTP requests saving the
same session could interleave: two writers both appending against a
stale snapshot write overlapping history twice, and an append racing
a full rewrite can be overwritten by the rewriter's stale merge,
losing messages.

Hold get_path_lock(path) across the whole read, merge, and write,
consistent with the existing session image handling in the same file.
Merge, ordering, and can_append logic are unchanged.

Add deterministic regression tests that gate one writer's read between
snapshot capture and write: concurrent appends must merge disjoint
messages in created_at order, and an appended message must survive a
concurrent full rewrite. Both tests fail without the lock.

Closes #622

* test(auto-memory): make session-lock regression tests deterministic

Replace fixed sleeps with explicit synchronization: a shared operation
log records lock/read/write progress per writer, and writer A holds its
post-read pause until writer B is queued on the transcript lock. The
tests now assert the serialization order from the log (B reads only
after A's write completed) in addition to transcript content, so they
no longer depend on IO timing.

Also fix pylint findings from CI: use from-import for the auto_memory
module and drop unused tmp_path parameters.
2026-10-19 16:13:42 +08:00
..
components fix(chunker): treat default file chunks as plain text (#624) 2026-10-19 12:30:35 +08:00
config fix(search): accept CLI queries that look like numbers (#612) 2026-10-16 10:36:05 +08:00
enumeration feat(classifier): add optional Jev component and service demo (#619) 2026-10-14 17:49:49 +08:00
schema feat(jobs): add a unified enabled switch for all job types (#580) 2026-09-30 18:30:36 +08:00
steps fix(auto-memory): serialize session transcript writes per session (#633) 2026-10-19 16:13:42 +08:00
utils feat(token counter): add Qwen token counting utility with fallback (#616) 2026-10-16 11:58:35 +08:00
__init__.py chore: release 0.4.2.0 and simplify publishing workflows (#631) 2026-10-16 16:53:52 +08:00
application.py feat(docker): add container deployment and multi-platform release workflow (#582) 2026-10-03 23:54:58 +08:00
constants.py feat(service): support explicit wildcard network binds (#547) 2026-09-15 14:26:33 +08:00
entry_point.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
plugin.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
plugin_cli.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
plugin_manifest.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00
reme.py feat: simplify plugin setup and add management CLI (#485) 2026-08-23 17:58:20 +08:00