feat(memory): add progressive wiki and drain Dream history (#4477)
This commit is contained in:
1 parent
9ccf3b6214
commit
74d070f699
40 files changed
+1513
-738
No files matched your search
@@ -5,6 +5,8 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
from nanobot.agent.memory import _HISTORY_ENTRY_HARD_CAP, MemoryStore
|
||||
from nanobot.utils.gitstore import GitStore
|
||||
from nanobot.utils.helpers import sync_workspace_templates
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -291,18 +293,24 @@ class TestDreamCursor:
|
||||
store2 = MemoryStore(store.workspace)
|
||||
assert store2.get_last_dream_cursor() == 3
|
||||
|
||||
def test_git_restore_rolls_back_dream_cursor(self, tmp_path):
|
||||
@pytest.mark.parametrize("existing_repo", [False, True], ids=["new-workspace", "existing-workspace"])
|
||||
def test_git_restore_rolls_back_dream_cursor(self, tmp_path, existing_repo):
|
||||
store = MemoryStore(tmp_path)
|
||||
store.write_memory("before")
|
||||
store.set_last_dream_cursor(1)
|
||||
assert store.git.init() is True
|
||||
if existing_repo:
|
||||
# Workspaces initialized before the fix ignore the runtime cursor.
|
||||
old_git = GitStore(tmp_path, tracked_files=["memory/MEMORY.md"], tracked_dirs=["memory/wiki"])
|
||||
assert old_git.init()
|
||||
assert store.git.auto_commit("dream: save first cursor checkpoint")
|
||||
else:
|
||||
sync_workspace_templates(tmp_path, silent=True)
|
||||
|
||||
store.write_memory("after")
|
||||
store.set_last_dream_cursor(2)
|
||||
dream_sha = store.git.auto_commit("dream: update")
|
||||
assert dream_sha is not None
|
||||
|
||||
store.write_memory("newer")
|
||||
store.set_last_dream_cursor(3)
|
||||
|
||||
restore_sha = store.git.revert(dream_sha)
|
||||
|
||||
Reference in new issue
Block a user