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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(memory): accept truncated cloud probes
cyh63f9397d2805
diff --git a/core/memory/everos.py b/core/memory/everos.pyindex b34cfb43e..a34eb92af 100644--- a/core/memory/everos.py+++ b/core/memory/everos.py@@ -66,6 +66,7 @@ PROCESSING_PROBE_MAX_DEADLINE_SECONDS = (_PROCESSING_TIMEOUT_SECONDS = PROCESSING_PROBE_REQUEST_TIMEOUT_SECONDS_PREFLIGHT_TIMEOUT_SECONDS = 5.0_PREFLIGHT_RESPONSE_BYTES = _MAX_RESPONSE_BYTES+_CHAT_PROBE_MAX_TOKENS = 8_PREFLIGHT_IMAGE_DATA_URI = ("data:image/png;base64,""iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAYElEQVR42u3QAQ0AAAwC"@@ -629,7 +630,7 @@ class EverOSPort:payload={"model": self._llm_model,"messages": [{"role": "user", "content": "Reply with OK."}],- "max_tokens": 1,+ "max_tokens": _CHAT_PROBE_MAX_TOKENS,"temperature": 0,},validator=_valid_chat_probe_response,@@ -677,9 +678,19 @@ class EverOSPort:async def preflight(self) -> MemoryPreflightResult:"""Run one bounded request for each configured processing endpoint."""checks = [- ("llm", self._llm_base_url, self._llm_api_key, "chat/completions", {- "model": self._llm_model, "messages": [{"role": "user", "content": "OK"}], "max_tokens": 1, "temperature": 0,- }, _valid_chat_probe_response),+ (+ "llm",+ self._llm_base_url,+ self._llm_api_key,+ "chat/completions",+ {+ "model": self._llm_model,+ "messages": [{"role": "user", "content": "OK"}],+ "max_tokens": _CHAT_PROBE_MAX_TOKENS,+ "temperature": 0,+ },+ _valid_chat_probe_response,+ ),("embedding", self._embedding_base_url, self._embedding_api_key, "embeddings", {"model": self._embedding_model, "input": "OK",}, _valid_embedding_probe_response),@@ -1037,7 +1048,10 @@ class EverOSPort:)return Nonecode = None- message = f"HTTP {status_code}"+ if 200 <= status_code < 300:+ message = _probe_response_issue(side, value) or "provider_response_invalid"+ else:+ message = f"HTTP {status_code}"if isinstance(value, dict) and isinstance(value.get("error"), dict):error = value["error"]code = _bounded_opaque_string(@@ -1570,14 +1584,31 @@ def _is_bounded_json_value(value: Any, *, depth: int = 0) -> bool:def _valid_chat_probe_response(value: Any) -> bool:+ return _chat_probe_response_issue(value) is None+++def _chat_probe_response_issue(value: Any) -> str | None:if not isinstance(value, dict):- return False+ return "provider_response_not_object"choices = value.get("choices")- if not isinstance(choices, list) or not choices or not isinstance(choices[0], dict):- return False+ if not isinstance(choices, list) or not choices:+ return "provider_response_missing_choices"+ if not isinstance(choices[0], dict):+ return "provider_response_invalid_choice"message = choices[0].get("message")- content = message.get("content") if isinstance(message, dict) else None- return isinstance(content, str) and bool(content.strip())+ if not isinstance(message, dict):+ return "provider_response_missing_message"+ if "content" not in message:+ return "provider_response_missing_content"+ if not isinstance(message["content"], str):+ return "provider_response_invalid_content"+ return None+++def _probe_response_issue(side: str, value: Any) -> str | None:+ if side in {"llm", "multimodal"}:+ return _chat_probe_response_issue(value)+ return f"provider_{side}_response_invalid"def _valid_embedding_probe_response(value: Any) -> bool:@@ -1627,7 +1658,7 @@ def _multimodal_preflight_payload(model: str | None) -> dict[str, Any]:],}],- "max_tokens": 1,+ "max_tokens": _CHAT_PROBE_MAX_TOKENS,"temperature": 0,}diff --git a/tests/test_memory_everos.py b/tests/test_memory_everos.pyindex dd602a151..b61ec000a 100644--- a/tests/test_memory_everos.py+++ b/tests/test_memory_everos.py@@ -1313,7 +1313,18 @@ def test_processing_health_probes_both_authenticated_endpoints() -> None:def handler(request: httpx.Request) -> httpx.Response:requests.append(request)if request.url.path.endswith("/chat/completions"):- return httpx.Response(200, json={"choices": [{"message": {"content": "OK"}}]})+ return httpx.Response(+ 200,+ json={+ "model": "provider-slot-model",+ "choices": [+ {+ "finish_reason": "length",+ "message": {"content": "", "role": "assistant"},+ }+ ],+ },+ )return httpx.Response(200, json={"data": [{"embedding": [0.1, 0.2]}]})async def run() -> bool:@@ -1339,6 +1350,7 @@ def test_processing_health_probes_both_authenticated_endpoints() -> None:assert [request.url.path for request in requests] == ["/v1/chat/completions", "/v1/embeddings"]assert all(request.headers["authorization"].startswith("Bearer ") for request in requests)+ assert json.loads(requests[0].content)["max_tokens"] == 8def test_processing_health_serializes_identical_provider_credentials(monkeypatch) -> None:@@ -1427,6 +1439,87 @@ def test_processing_preflight_projects_sanitized_provider_error() -> None:assert "secret" not in result.failure.diagnostic.message+def test_processing_preflight_accepts_truncated_chat_completion_from_resolved_slot() -> None:+ requests: list[httpx.Request] = []++ def handler(request: httpx.Request) -> httpx.Response:+ requests.append(request)+ if request.url.path.endswith("/chat/completions"):+ return httpx.Response(+ 200,+ json={+ "id": "chatcmpl-probe",+ "object": "chat.completion",+ "model": "provider-slot-model",+ "choices": [+ {+ "index": 0,+ "finish_reason": "length",+ "message": {+ "role": "assistant",+ "content": "",+ "reasoning_content": "O",+ },+ }+ ],+ },+ )+ return httpx.Response(200, json={"data": [{"embedding": [0.1]}]})++ async def run():+ return await EverOSPort(+ Path("/tmp/everos.sock"),+ llm_base_url="https://llm.example.test/v1",+ llm_model="client-alias",+ llm_api_key="secret",+ embedding_base_url="https://embed.example.test/v1",+ embedding_model="embed",+ embedding_api_key="secret",+ ).preflight()++ real_async_client = httpx.AsyncClient+ with patch("core.memory.everos.httpx.AsyncClient", autospec=True) as client_type:+ client_type.side_effect = lambda **kwargs: real_async_client(+ transport=httpx.MockTransport(handler), **kwargs+ )+ result = asyncio.run(run())++ assert result.ok is True+ request_payload = json.loads(requests[0].content)+ assert request_payload["model"] == "client-alias"+ assert request_payload["max_tokens"] == 8+++def test_processing_preflight_reports_the_rejected_2xx_shape() -> None:+ def handler(request: httpx.Request) -> httpx.Response:+ if request.url.path.endswith("/chat/completions"):+ return httpx.Response(200, json={"choices": [{}]})+ return httpx.Response(200, json={"data": [{"embedding": [0.1]}]})++ async def run():+ return await EverOSPort(+ Path("/tmp/everos.sock"),+ llm_base_url="https://llm.example.test/v1",+ llm_model="chat",+ llm_api_key="secret",+ embedding_base_url="https://embed.example.test/v1",+ embedding_model="embed",+ embedding_api_key="secret",+ ).preflight()++ real_async_client = httpx.AsyncClient+ with patch("core.memory.everos.httpx.AsyncClient", autospec=True) as client_type:+ client_type.side_effect = lambda **kwargs: real_async_client(+ transport=httpx.MockTransport(handler), **kwargs+ )+ result = asyncio.run(run())++ assert result.ok is False+ assert result.failure is not None+ assert result.failure.diagnostic.http_status == 200+ assert result.failure.diagnostic.message == "provider_response_missing_message"++def test_processing_preflight_probes_configured_rerank_endpoint() -> None:requests: list[httpx.Request] = []recorded: list[dict[str, object]] = []@@ -1521,6 +1614,7 @@ def test_processing_preflight_probes_configured_multimodal_endpoint() -> None:]payload = json.loads(requests[-1].content)assert payload["model"] == "vision-model"+ assert payload["max_tokens"] == 8assert payload["messages"][0]["content"][0] == {"type": "text","text": "Reply with OK.",