lex-agentic-memory 0.1.23 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a795b1799756184a81da06e46f2958513f404882292040cb7ebd7d35005d93be
4
- data.tar.gz: 709c8605a2e70964e91a1a143a89d5469d243a92bd54ad6a47d48b500f4d3a09
3
+ metadata.gz: 5c02b5c5fc14dfba427fc4a6c321eab9abc4aa12218671c132f747da6af2de92
4
+ data.tar.gz: 1e7b698497e270656372bb2f47eb4dc3b93d16e64faf9d4d95ea466bcf6071c7
5
5
  SHA512:
6
- metadata.gz: 00c7573a851ec910a6380c7c0723a3aaa684710d5b7fdda2e2d7123c8439ef634d356030b0a11a8e3827b00b6fdc6c622fbc215206bbf35c3671e6f74f8a6f92
7
- data.tar.gz: 8299132b32423db960b554fadaf63439050de19c76f86767b6555cba014b3e92339e8aebab70abccbfb937c749838a147dcf9df49ba30f7d94b3d19293709be7
6
+ metadata.gz: b02c36cc24ffb379cc41988398b8d69588ee5bddddd008bdc4eaedfdd062d44d3fe4fc8e5981b58e2d1d7b014863aa24a49e55a490ada138727e3f9ac9132e6d
7
+ data.tar.gz: 0dc565499fac89a69ddf26b3a83465e699205ad32a9a5b10deb83ed5818ef9c9babd2d421a8fdf78f7b90ff1dc19e06fecd94cde8b3a01652082b40f85e72c1a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.24] - 2026-04-03
4
+
5
+ ### Fixed
6
+ - Wrap `save_to_local` persist in a single SQLite transaction — 32K individual lock acquisitions become 1
7
+ - Use `insert_conflict(:replace)` instead of SELECT-then-INSERT/UPDATE per trace
8
+
3
9
  ## [0.1.23] - 2026-04-03
4
10
 
5
11
  ### Fixed
@@ -165,10 +165,12 @@ module Legion
165
165
  return unless snapshots
166
166
 
167
167
  traces_snapshot, associations_snapshot, trace_rows_snapshot, traces_dirty, associations_dirty = snapshots
168
- scoped_trace_ids = db[:memory_traces].where(partition_id: @partition_id).select_map(:trace_id)
169
- memory_trace_ids = traces_snapshot.keys
170
- stale_ids = persist_dirty_traces(db, trace_rows_snapshot, scoped_trace_ids, memory_trace_ids, traces_dirty)
171
- persist_dirty_associations(db, associations_snapshot, scoped_trace_ids, memory_trace_ids, stale_ids, associations_dirty)
168
+ db.transaction do
169
+ scoped_trace_ids = db[:memory_traces].where(partition_id: @partition_id).select_map(:trace_id)
170
+ memory_trace_ids = traces_snapshot.keys
171
+ stale_ids = persist_dirty_traces(db, trace_rows_snapshot, scoped_trace_ids, memory_trace_ids, traces_dirty)
172
+ persist_dirty_associations(db, associations_snapshot, scoped_trace_ids, memory_trace_ids, stale_ids, associations_dirty)
173
+ end
172
174
  clear_dirty_flags(trace_rows_snapshot)
173
175
  end
174
176
 
@@ -187,12 +189,9 @@ module Legion
187
189
  def persist_dirty_traces(db, trace_rows_snapshot, scoped_trace_ids, memory_trace_ids, traces_dirty)
188
190
  return [] unless traces_dirty
189
191
 
190
- trace_rows_snapshot.each do |trace_id, row|
191
- if db[:memory_traces].where(trace_id: trace_id).first
192
- db[:memory_traces].where(trace_id: trace_id).update(row)
193
- else
194
- db[:memory_traces].insert(row)
195
- end
192
+ ds = db[:memory_traces]
193
+ trace_rows_snapshot.each_value do |row|
194
+ ds.insert_conflict(:replace).insert(row)
196
195
  end
197
196
  stale_ids = scoped_trace_ids - memory_trace_ids
198
197
  db[:memory_traces].where(trace_id: stale_ids).delete unless stale_ids.empty?
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Memory
7
- VERSION = '0.1.23'
7
+ VERSION = '0.1.24'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-memory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity