Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(memory): repair stale profile summary (#1616)

Call White1158046f2b3b
diff --git a/core/memory/everos.py b/core/memory/everos.py
index 8ecbcdb5a..a9df5d9ad 100644
--- a/core/memory/everos.py
+++ b/core/memory/everos.py
@@ -1410,6 +1410,7 @@ def _structured_profile(value: Any) -> MemoryProfile | None:
summary = _safe_text(value.get("summary")) if "summary" in value else None
explicit_info = _structured_explicit_info(value)
implicit_traits = _structured_implicit_traits(value)
+ summary = _repair_stale_profile_summary(summary, explicit_info, implicit_traits)
updated_at = _normalized_profile_timestamp(value.get("profile_timestamp_ms"))
# A provider timestamp is metadata, not readable profile content. Unknown
@@ -1424,6 +1425,32 @@ def _structured_profile(value: Any) -> MemoryProfile | None:
)
+def _repair_stale_profile_summary(
+ summary: str | None,
+ explicit_info: tuple[MemoryProfileExplicitInfo, ...],
+ implicit_traits: tuple[MemoryProfileTrait, ...],
+) -> str | None:
+ """Repair EverAlgo summaries surfaced by EverOS when pinned to item one.
+
+ EverAlgo's profile updater appends new items but rebuilds ``summary`` from
+ the first non-empty explicit description. That makes a transient first
+ message the permanent headline. Only the distinctive stale shape is
+ changed here; provider-authored summaries that differ from the first item
+ remain authoritative, and the raw provider JSON stays untouched.
+ """
+
+ if summary is None:
+ return None
+
+ if len(explicit_info) > 1 and summary == explicit_info[0].description:
+ for info in reversed(explicit_info[1:]):
+ if info.description != summary:
+ return info.description
+ return summary
+
+ return summary
+
+
def _structured_explicit_info(value: dict[str, Any]) -> tuple[MemoryProfileExplicitInfo, ...]:
if "explicit_info" not in value:
return ()
diff --git a/tests/test_memory_everos.py b/tests/test_memory_everos.py
index e7dc36681..f3b359deb 100644
--- a/tests/test_memory_everos.py
+++ b/tests/test_memory_everos.py
@@ -1252,6 +1252,63 @@ def test_profile_maps_known_fields_without_collapsing_basis_and_evidence() -> No
assert json.loads(items[0].text)["implicit_traits"][0]["evidence"] == "Three recent planning discussions."
+def test_profile_repairs_provider_summary_pinned_to_first_explicit_item() -> None:
+ profile_data = {
+ "summary": "Continue",
+ "explicit_info": [
+ {"category": "conversation", "description": "Continue"},
+ {
+ "category": "engineering",
+ "description": "Prefers evidence-backed engineering decisions.",
+ },
+ ],
+ "implicit_traits": [
+ {
+ "trait": "systematic",
+ "description": "Builds a causal model before choosing scope.",
+ }
+ ],
+ "profile_timestamp_ms": 1_757_000_000_000,
+ }
+
+ def handler(_request: httpx.Request) -> httpx.Response:
+ return httpx.Response(
+ 200,
+ json={"data": {"profiles": [{"user_id": "owner-1", "profile_data": profile_data}]}},
+ )
+
+ with _sidecar_transport(handler):
+ items = asyncio.run(EverOSPort(Path("/tmp/everos.sock")).profile("owner-1", PROJECT))
+
+ assert items[0].profile is not None
+ assert items[0].profile.summary == "Prefers evidence-backed engineering decisions."
+ # The compatibility correction is read-only; raw provider data remains available.
+ assert json.loads(items[0].text)["summary"] == "Continue"
+
+
+def test_profile_preserves_provider_summary_that_is_not_the_first_item() -> None:
+ profile_data = {
+ "summary": "A concise portrait of the user's stable preferences.",
+ "explicit_info": [
+ {"description": "Uses Python."},
+ {"description": "Prefers written updates."},
+ ],
+ "profile_timestamp_ms": 1_757_000_000_000,
+ }
+
+ def handler(_request: httpx.Request) -> httpx.Response:
+ return httpx.Response(
+ 200,
+ json={"data": {"profiles": [{"user_id": "owner-1", "profile_data": profile_data}]}},
+ )
+
+ with _sidecar_transport(handler):
+ items = asyncio.run(EverOSPort(Path("/tmp/everos.sock")).profile("owner-1", PROJECT))
+
+ assert items[0].profile is not None
+ assert items[0].profile.summary == profile_data["summary"]
+
+
def test_profile_timestamp_without_recognized_content_uses_the_raw_fallback() -> None:
raw_profile = {
"profile_timestamp_ms": 1_754_012_345_678,