Compare commits

..

2 commits

Author SHA1 Message Date
a15080b2bb chore(deps): update dependency @types/node to v25.9.3 2026-06-11 10:26:43 +00:00
344e5edaa8
Fix temporal_next edges: wire link_temporal_next into capture path, fix events_query decryption
- capture.py: call link_temporal_next() after store.insert() in capture_turn()
- retrieve.py: call link_temporal_next() in contradict() for contradict inserts
- qdrant_store.py: events_query() was json.loads() on encrypted data_json,
  losing record_id — pass raw string so query_events() can decrypt it
2026-06-11 12:18:03 +02:00
3 changed files with 18 additions and 5 deletions

View file

@ -201,6 +201,13 @@ def capture_turn(
log.exception("capture_turn insert failed")
return {"status": "skipped", "record_id": None, "reason": f"insert-failed: {type(e).__name__}"}
# Wire temporal_next: link this insert to the previous same-session insert.
try:
from iai_mcp.retrieve import link_temporal_next
link_temporal_next(store, rec, session_id=session_id)
except Exception:
pass # diagnostic only; never block the write path.
return {"status": "inserted", "record_id": str(rec.id), "reason": f"tier={tier}"}

View file

@ -1335,10 +1335,10 @@ class QdrantStore:
continue
raw_data = p.get("data_json") or "{}"
try:
data = json.loads(raw_data)
except (TypeError, json.JSONDecodeError):
data = {}
# data_json is AES-GCM encrypted; pass it through as a raw string
# so query_events() in events.py can decrypt it properly.
# Pre-02-08 unencrypted rows are plain JSON — query_events()
# handles both paths via is_encrypted() / decrypt_field().
try:
source_ids = json.loads(p.get("source_ids_json") or "[]")
except (TypeError, json.JSONDecodeError):
@ -1350,7 +1350,7 @@ class QdrantStore:
"severity": p.get("severity") or None,
"domain": p.get("domain") or None,
"ts": ts_dt,
"data": data,
"data": raw_data,
"session_id": p.get("session_id", "-"),
"source_ids": source_ids,
})

View file

@ -278,6 +278,12 @@ def contradict(
store.insert(new_rec)
store.add_contradicts_edge(original_id, new_rec.id)
# Wire temporal_next: contradict inserts land in same session, link them.
try:
link_temporal_next(store, new_rec, session_id="-")
except Exception:
pass # diagnostic only; never block the write path.
# monotropic proactive check fires only in high-focus
# domains. Hints aren't surfaced via contradict() (its signature is fixed
# to ReconsolidationReceipt), but events land in the events table so the