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): keep processing events out of IM (#1631)

rkrkrkk0210f154cea0
diff --git a/core/controller.py b/core/controller.py
index 50fd5cbd3..3c466ab8a 100644
--- a/core/controller.py
+++ b/core/controller.py
@@ -487,7 +487,7 @@ class Controller:
self.memory_runtime = create_memory_runtime(
getattr(self.config, "memory", None) or MemoryConfig(),
- processing_event=self._send_memory_processing_event,
+ processing_event=self._log_memory_processing_event,
on_config_settled=self._adopt_settled_memory_config,
)
self.memory_module = self.memory_runtime.module
@@ -864,7 +864,7 @@ class Controller:
artifact_manager=getattr(runtime, "artifact_manager", None),
process_factory=getattr(runtime, "process_factory", None),
effective_home=runtime.effective_home,
- processing_event=self._send_memory_processing_event,
+ processing_event=self._log_memory_processing_event,
on_config_settled=self._adopt_settled_memory_config,
)
if not await self._retain_failed_factory_reset_runtime(
@@ -900,7 +900,7 @@ class Controller:
artifact_manager=runtime.artifact_manager,
process_factory=runtime.process_factory,
effective_home=runtime.effective_home,
- processing_event=self._send_memory_processing_event,
+ processing_event=self._log_memory_processing_event,
on_config_settled=self._adopt_settled_memory_config,
)
activation = await fresh.activate_fresh(settled)
@@ -2782,31 +2782,26 @@ class Controller:
int((time.monotonic() - started_at) * 1000),
)
- async def _send_memory_processing_event(
+ async def _log_memory_processing_event(
self,
event: str,
kind: str | None,
occurred_at: str,
queued: int,
) -> bool:
- from core.handlers.admin_notifications import send_admin_text
-
- store = self.settings_manager.get_store()
- admin_ids = list(store.get_admins().keys()) if store else []
- if not admin_ids:
- return True
- if event == "recovered":
- key = "memory.alert.recovered"
- else:
- key = "memory.alert.credential" if kind == "credential" else "memory.alert.engine"
- text = self._t(key, occurred_at=occurred_at, queued=queued)
- delivered = await send_admin_text(
- self,
- admin_ids,
- text,
- log_label="Memory processing notification",
+ """Record one durable Memory health event without notifying IM users."""
+
+ logger.log(
+ logging.INFO if event == "recovered" else logging.WARNING,
+ "Memory processing event=%s kind=%s occurred_at=%s queued=%d",
+ event,
+ kind or "none",
+ occurred_at,
+ queued,
)
- return bool(delivered)
+ # Logging is the terminal sink for this durable event. Acknowledge it so
+ # the coordinator does not replay the same record on every drain tick.
+ return True
def update_thread_message_id(self, context: MessageContext) -> None:
"""Run real-turn-start hooks after the runtime gate is acquired."""
diff --git a/docs/MEMORY.md b/docs/MEMORY.md
index 412dd35d1..66ab4af87 100644
--- a/docs/MEMORY.md
+++ b/docs/MEMORY.md
@@ -80,6 +80,11 @@ composite status poll. A section may be marked stale or unavailable while the
other independently sourced sections continue to render, including while
Memory is disabled.
+Memory processing pause and recovery events are written only to the main Avibe
+service log, including the fault kind, occurrence time, and queued-capture
+count. They are not sent as direct messages to administrators on Slack,
+Discord, Telegram, Lark, WeChat, or other IM transports.
+
The timeline is the installation operator's view across every valid project and
user. Each row and its detail view visibly includes the full **Project ID** and
**User ID**, followed by the path from message capture through memcell creation,
diff --git a/docs/MEMORY_ZH.md b/docs/MEMORY_ZH.md
index b63a2bd9a..bd6e17f53 100644
--- a/docs/MEMORY_ZH.md
+++ b/docs/MEMORY_ZH.md
@@ -54,6 +54,9 @@ LLM、Embedding 或重排序服务。
获得这一安装级日志读取范围;画像和搜索读取仍按用户隔离。某个来源数据库缺失、忙碌、
格式异常,或关联标记已经过期时,对应部分会显示为不可用,其他部分仍会继续显示。
+记忆处理暂停和恢复事件只会写入 Avibe 主服务日志,其中包含故障类别、发生时间和排队
+捕获数量;它们不会通过 Slack、Discord、Telegram、飞书/Lark、微信或其他 IM 私信管理员。
+
提供方调用只有在能够根据确切 provenance 证明属于所展示的项目和用户时,才会关联到时间线。
安装级视图不会放宽这些关联条件:外部、损坏或多用户 memcell 会被过滤,详情
读取也会先从记录本身取得真实范围,再读取运行、捕获和调用。
diff --git a/docs/plans/memory-plugin-system.md b/docs/plans/memory-plugin-system.md
index a175b89b7..c05fcf324 100644
--- a/docs/plans/memory-plugin-system.md
+++ b/docs/plans/memory-plugin-system.md
@@ -181,7 +181,7 @@ The `core/memory/` package is the ownership boundary:
|---|---|
| `module.py` | Provider-independent capture, search, profile, status, failure log, and idempotent clear |
| `store.py` | Dedicated SQLite metadata, principal derivation, queue state, deduplication, tombstones, and recovery markers |
-| `worker.py` | Health-gated add/flush delivery, retry classification, flush observations, and processing alerts |
+| `worker.py` | Health-gated add/flush delivery, retry classification, flush observations, and processing health event reconciliation |
| `everos.py` | Bounded mapping between the module contract and EverOS public HTTP operations |
| `runtime.py` | Enable/disable/reconcile lifecycle and composition of the module, worker, and sidecar |
| `process.py` / `sidecar.py` | Owned child process, private UDS, request allowlist, environment, restart, and shutdown |
diff --git a/tests/scenarios/INDEX.yaml b/tests/scenarios/INDEX.yaml
index 59a9eb493..94958d0e1 100644
--- a/tests/scenarios/INDEX.yaml
+++ b/tests/scenarios/INDEX.yaml
@@ -71,6 +71,7 @@ capabilities:
name: Memory remains optional across delivery and session lifecycle
status: active
catalog: tests/scenarios/memory_independence/catalog.yaml
+ observations: tests/scenarios/memory_independence/observations.yaml
scenario_tests:
- tests/test_session_delivery_fsm.py
unit_or_contract_tests:
@@ -83,6 +84,7 @@ capabilities:
- tests/test_controller_dispatch_loop.py
- tests/test_native_session_providers.py
- tests/test_core_services_dispatch.py
+ - tests/test_admin_notifications.py
- id: memory_im_attachment_capture
name: Bound-DM attachment capture through EverOS multimodal ingest
status: active
diff --git a/tests/scenarios/memory_independence/catalog.yaml b/tests/scenarios/memory_independence/catalog.yaml
index c7c2b0827..1c3205621 100644
--- a/tests/scenarios/memory_independence/catalog.yaml
+++ b/tests/scenarios/memory_independence/catalog.yaml
@@ -12,6 +12,7 @@ capability:
- tests/test_controller_dispatch_loop.py
- tests/test_native_session_providers.py
- tests/test_core_services_dispatch.py
+ - tests/test_admin_notifications.py
contract:
dispatch: capture_must_not_fence_turn_start
destructive_ops: new_and_archive_fail_open_on_capture_timeout
@@ -21,6 +22,7 @@ contract:
retention: settled_lifecycle_and_archive_authorization_state_is_released
scheduling: capture_setup_failure_is_best_effort
transient_dispatch: lifecycle_snapshots_never_enter_platform_payloads_or_waiters
+ processing_events: memory_health_events_stay_in_service_logs_without_im_delivery
status_legend:
covered: executable evidence exists
scenarios:
@@ -90,3 +92,9 @@ scenarios:
kind: guardrail
layer: contract
test: tests/test_core_services_dispatch.py::test_streaming_dispatch_releases_lifecycle_snapshot_after_handler_returns
+ - id: MEMORY-INDEP-012
+ name: Memory processing health events stay in service logs and out of IM delivery
+ status: covered
+ kind: regression_keep
+ layer: contract
+ test: tests/test_admin_notifications.py::test_memory_indep_012_processing_events_stay_in_service_logs
diff --git a/tests/scenarios/memory_independence/observations.yaml b/tests/scenarios/memory_independence/observations.yaml
new file mode 100644
index 000000000..cbb7fe9d0
--- /dev/null
+++ b/tests/scenarios/memory_independence/observations.yaml
@@ -0,0 +1,14 @@
+version: 1
+capability: memory_independence
+observations:
+ - id: OBS-MEMORY-INDEP-001
+ source: live_local_diagnosis
+ related_scenarios:
+ - MEMORY-INDEP-012
+ summary: A transient Memory processing fault and its recovery were delivered as direct messages to administrators on every configured IM transport.
+ previous_assumption: Installation-wide Memory health events should use the shared cross-platform administrator notification path.
+ observed_behavior: One fault cycle produced unsolicited pause and recovery messages in bound administrator conversations even though no capture was queued.
+ required_updates:
+ - keep durable fault classification and acknowledgement intact
+ - write fault and recovery events to the main service log
+ - never resolve administrator identities or invoke IM clients for Memory health events
diff --git a/tests/test_admin_notifications.py b/tests/test_admin_notifications.py
index 761a17d0f..a9e128098 100644
--- a/tests/test_admin_notifications.py
+++ b/tests/test_admin_notifications.py
@@ -2,6 +2,8 @@
from __future__ import annotations
+import logging
+
from core.handlers.admin_notifications import send_admin_text
from core.controller import Controller
@@ -41,13 +43,13 @@ async def test_admin_text_routes_only_to_active_platform_clients() -> None:
delivered = await send_admin_text(
controller,
["slack::U1", "discord::D1", "telegram::123"],
- "Memory processing paused",
- log_label="Memory alert",
+ "Update available",
+ log_label="update notification",
)
assert delivered == {"slack"}
- assert slack.calls == [("U1", "Memory processing paused")]
- assert discord.calls == [("D1", "Memory processing paused")]
+ assert slack.calls == [("U1", "Update available")]
+ assert discord.calls == [("D1", "Update available")]
assert fallback.calls == []
@@ -76,44 +78,84 @@ async def test_admin_text_routes_legacy_unknown_users_to_the_primary_platform()
class _Store:
+ def __init__(self) -> None:
+ self.get_admins_calls = 0
+
def get_admins(self) -> dict[str, object]:
- return {"slack::U1": object()}
+ self.get_admins_calls += 1
+ return {
+ "slack::U1": object(),
+ "wechat::W1": object(),
+ }
class _SettingsManager:
+ def __init__(self) -> None:
+ self.store = _Store()
+
def get_store(self) -> _Store:
- return _Store()
+ return self.store
class _ControllerCallbackStub:
- def __init__(self, client: _Client) -> None:
+ def __init__(self) -> None:
self.settings_manager = _SettingsManager()
- self.im_clients = {"slack": client}
- self.im_client = client
- self.translation_calls: list[tuple[str, dict[str, object]]] = []
-
- def _t(self, key: str, **kwargs: object) -> str:
- self.translation_calls.append((key, kwargs))
- return key
-
-
-async def test_memory_processing_callback_selects_copy_and_acks_delivery() -> None:
- client = _Client({"ok": True})
- controller = _ControllerCallbackStub(client)
-
- delivered = await Controller._send_memory_processing_event(
- controller,
- "fault",
- "credential",
- "2026-01-01T00:00:00.000Z",
- 4,
- )
-
- assert delivered is True
- assert controller.translation_calls == [
+ self.im_clients = {
+ "slack": _Client({"ok": True}),
+ "wechat": _Client({"ok": True}),
+ }
+ self.im_client = self.im_clients["slack"]
+ self.primary_platform = "slack"
+
+
+async def test_memory_indep_012_processing_events_stay_in_service_logs(caplog) -> None:
+ """MEMORY-INDEP-012: processing health stays observable without IM delivery."""
+
+ controller = _ControllerCallbackStub()
+
+ with caplog.at_level(logging.INFO, logger="core.controller"):
+ results = [
+ await Controller._log_memory_processing_event(
+ controller,
+ "fault",
+ "credential",
+ "2026-01-01T00:00:00.000Z",
+ 4,
+ ),
+ await Controller._log_memory_processing_event(
+ controller,
+ "fault",
+ "engine",
+ "2026-01-01T00:01:00.000Z",
+ 2,
+ ),
+ await Controller._log_memory_processing_event(
+ controller,
+ "recovered",
+ None,
+ "2026-01-01T00:02:00.000Z",
+ 0,
+ ),
+ ]
+
+ assert results == [True, True, True]
+ assert controller.settings_manager.store.get_admins_calls == 0
+ assert all(client.calls == [] for client in controller.im_clients.values())
+ records = [record for record in caplog.records if record.name == "core.controller"]
+ assert [(record.levelno, record.getMessage()) for record in records] == [
+ (
+ logging.WARNING,
+ "Memory processing event=fault kind=credential "
+ "occurred_at=2026-01-01T00:00:00.000Z queued=4",
+ ),
+ (
+ logging.WARNING,
+ "Memory processing event=fault kind=engine "
+ "occurred_at=2026-01-01T00:01:00.000Z queued=2",
+ ),
(
- "memory.alert.credential",
- {"occurred_at": "2026-01-01T00:00:00.000Z", "queued": 4},
- )
+ logging.INFO,
+ "Memory processing event=recovered kind=none "
+ "occurred_at=2026-01-01T00:02:00.000Z queued=0",
+ ),
]
- assert client.calls == [("U1", "memory.alert.credential")]
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index 258312566..11378392e 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -779,11 +779,6 @@
"truncated": "Memory listing reached the provider ordering limit. Later pages may be incomplete."
},
"partialRestartWarning": "Memory Settings content is unavailable: the Web UI restarted while the service kept running,\n and their shared Memory proof exists only inside the running processes.\n Run 'vibe stop' and then 'vibe' to restart both together."
- },
- "alert": {
- "credential": "Memory processing paused at {occurred_at}: the configured model endpoint is unavailable. Check API key balance and permissions. Queued captures: {queued}.",
- "engine": "Memory processing paused at {occurred_at}: the Memory engine reported an internal error. Try repairing the Memory runtime. Queued captures: {queued}.",
- "recovered": "Memory processing recovered at {occurred_at}. Queued captures: {queued}."
}
},
"language": {
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index 0d095c9e8..b573f92de 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -779,11 +779,6 @@
"truncated": "记忆列表已达到服务排序上限,后续页面可能不完整。"
},
"partialRestartWarning": "记忆设置内容暂不可用:Web UI 已重启,但服务仍在运行,\n 两者共享的记忆访问凭证仅存在于运行中的进程内。\n 请先运行 'vibe stop',再运行 'vibe',以同时重启两者。"
- },
- "alert": {
- "credential": "记忆处理已于 {occurred_at} 暂停:无法调用已配置的模型接口,请检查 API Key 余额/权限。排队捕获:{queued} 条。",
- "engine": "记忆处理已于 {occurred_at} 暂停:记忆引擎内部错误,可尝试修复记忆运行时。排队捕获:{queued} 条。",
- "recovered": "记忆处理已于 {occurred_at} 恢复。排队捕获:{queued} 条。"
}
},
"language": {