feat: async significance pass with auto-pin on score 3

This commit is contained in:
Joseph Doherty
2026-04-26 13:27:25 -04:00
parent a45dabb6ae
commit eb4cdf9cbb
9 changed files with 588 additions and 7 deletions
+9 -2
View File
@@ -64,7 +64,7 @@ def test_record_turn_memory_writes_event_and_projects(tmp_path):
apply_migrations(db)
_seed_minimal(db)
with open_db(db) as conn:
eid = record_turn_memory(
eid, mid = record_turn_memory(
conn,
chat_id="chat_bot_a",
host_bot_id="bot_a",
@@ -73,6 +73,7 @@ def test_record_turn_memory_writes_event_and_projects(tmp_path):
chat_clock_at="2026-04-26T20:00:00+00:00",
)
assert eid > 0
assert mid is not None and mid > 0
rows = conn.execute(
"SELECT id, owner_id, chat_id, pov_summary, "
@@ -110,13 +111,14 @@ def test_record_turn_memory_omits_optional_fields(tmp_path):
_seed_minimal(db)
with open_db(db) as conn:
# Call without scene_id/chat_clock_at — should default to None.
eid = record_turn_memory(
eid, mid = record_turn_memory(
conn,
chat_id="chat_bot_a",
host_bot_id="bot_a",
narrative_text="A simple memory.",
)
assert eid > 0
assert mid is not None and mid > 0
row = conn.execute(
"SELECT scene_id, chat_clock_at, source, reliability, "
@@ -168,6 +170,11 @@ def client(tmp_path, monkeypatch):
app.dependency_overrides[get_llm_client] = lambda: mock
with TestClient(app) as c:
# Disable the lifespan-managed background worker — it would try
# to call Featherless with the test API key. The unit tests in
# test_significance.py exercise the worker directly with a mock
# factory; here we only care about the synchronous turn flow.
app.state.background_worker.enabled = False
c.mock_llm = mock # type: ignore[attr-defined]
yield c