a digital entity named phi that roams bsky phi.zzstoatzz.io
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: use include_attributes=True on memory reads to survive schema evolution

v0.5.0 added source_uris as a column but old namespaces — ones not yet
written to after the upgrade — don't know about it. turbopuffer 400s when
you list an attribute in include_attributes that isn't in the namespace
schema:

attribute "source_uris" not found in schema, cannot be part of
`include_attributes`. consider passing `include_attributes=True` to
return all attribute data instead

consequence: build_user_context failed for @zzstoatzzdevlog and probably
other established namespaces, falling through to the "no previous
interactions" fallback. phi looked like it had amnesia.

fix: use include_attributes=True on the four read paths that touch the
evolving schema (observations + interactions in build_user_context,
_find_similar_observations, get_unprocessed_interactions). the cost is
returning a few unused fields per row — negligible vs the correctness
win, and forward-compatible for any future columns.

writes still use the explicit schema so new columns get added on first
write to each namespace.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

+10 -10
+10 -10
src/bot/memory/namespace_memory.py
··· 309 309 ["status", "NotEq", "superseded"], 310 310 ], 311 311 ], 312 - include_attributes=["content", "tags", "created_at", "source_uris"], 312 + # include_attributes=True so pre-schema-evolution namespaces 313 + # don't 400 on a missing source_uris column 314 + include_attributes=True, 313 315 ) 314 316 if response.rows: 315 317 return [ ··· 490 492 interactions: list[_InteractionDisplay] = [] 491 493 492 494 try: 493 - # semantic search for relevant observations (exclude superseded) 495 + # semantic search for relevant observations (exclude superseded). 496 + # include_attributes=True (all) so we don't error on namespaces 497 + # whose schema predates source_uris — turbopuffer 400s if you 498 + # list an attribute the namespace doesn't know yet. 494 499 obs_response = user_ns.query( 495 500 rank_by=("vector", "ANN", query_embedding), 496 501 top_k=10, ··· 501 506 ["status", "NotEq", "superseded"], 502 507 ], 503 508 ], 504 - include_attributes=[ 505 - "content", 506 - "tags", 507 - "source_uris", 508 - "created_at", 509 - ], 509 + include_attributes=True, 510 510 ) 511 511 if obs_response.rows: 512 512 observations = [ ··· 525 525 rank_by=("vector", "ANN", query_embedding), 526 526 top_k=5, 527 527 filters={"kind": ["Eq", "interaction"]}, 528 - include_attributes=["content", "created_at"], 528 + include_attributes=True, 529 529 ) 530 530 if interaction_response.rows: 531 531 interactions = [ ··· 968 968 rank_by=("created_at", "desc"), 969 969 top_k=5, 970 970 filters={"kind": ["Eq", "interaction"]}, 971 - include_attributes=["content", "created_at", "source_uris"], 971 + include_attributes=True, 972 972 ) 973 973 if int_response.rows: 974 974 for row in int_response.rows: