Repository navigation
Keep observation watermarks advancing beyond the retrieval cap - #462
rudycelekli wants to merge 1 commit into
Conversation
| # retrieve_recent returns memories in chronological (append) order; | ||
| all_recent = memory.retrieve_recent(limit=1_000_000) | ||
| # The full-bank API preserves chronological (append) order. | ||
| all_recent = memory.get_all_memories_as_text() |
There was a problem hiding this comment.
This now materializes the entire memory history on every pre_act, even if only one observation was appended. ListMemory.get_all_memories_as_text() copies all N strings into a tuple; the associative backend builds a full DataFrame/text list, so a long simulation becomes O(N) work/allocation per action (O(N²) over N actions). The old one-million-item cap at least bounded that cost, and this becomes unbounded exactly where the PR fixes the watermark. Could we expose an append count/cursor and fetch only count - last_seen_index recent entries, with a regression for histories beyond the previous cap?
|
This only makes a difference past 1,000,000 memories, which does not arise in real Concordia simulations, and the test allocates a 1M-entry list. Closing for now, happy to reopen if you have a real use case. |
ObservationsSinceLastPreActuses the number of retrieved memories as a persistent append-order watermark, but retrieves at most one million entries. Once that limit is reached, the watermark stops growing and later observations are silently omitted from agent context.Use the existing
Memory.get_all_memories_as_text()API to obtain the full committed bank. Preserve the observation filter, ordering, watermark state format and resume behavior; update the documented retrieval assumption accordingly. This retains the existing append-only memory assumption and does not add a streaming retrieval API or repair observations omitted by earlier actions.Validation: an actual public
EntityAgent.act()→observe()→act()regression with one million repeated non-observation filler entries fails before the fix and passes afterward, including once-only delivery. Two further public-agent controls cover multiple observations in order, watermark checkpoint resume and associative memory backed by a local deterministic embedder. All 12 tests pass across the new three-test suite and existing nine-test Publisher/Subscriber suite. Focused pylint/type checks pass; formatting passes for the changed production lines and complete new test file. No provider calls or external model downloads.AI assistance was used to prepare this fix and its regression tests.