Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

Fix/oc2ov remote ov adapt (#1815)

kaisonglifa19814d9113
diff --git a/tests/oc2ov_test/tests/base_cli_test.py b/tests/oc2ov_test/tests/base_cli_test.py
index b6c6453cb..3ece00183 100644
--- a/tests/oc2ov_test/tests/base_cli_test.py
+++ b/tests/oc2ov_test/tests/base_cli_test.py
@@ -314,6 +314,12 @@ class BaseOpenClawCLITest(unittest.TestCase):
if not is_timeout and not is_empty and not is_tool_result:
return response
if is_timeout:
+ is_subprocess_timeout = isinstance(response, dict) and response.get(
+ "error", ""
+ ).startswith("命令执行超时")
+ if is_subprocess_timeout:
+ self.logger.warning("subprocess 超时,不再重试 (auto-recall 上下文可能过大)")
+ return response
reason = "LLM idle timeout"
elif is_empty:
reason = "empty response (no text)"
diff --git a/tests/oc2ov_test/tests/p0/test_context_engine.py b/tests/oc2ov_test/tests/p0/test_context_engine.py
index 70777066e..5d34f0917 100644
--- a/tests/oc2ov_test/tests/p0/test_context_engine.py
+++ b/tests/oc2ov_test/tests/p0/test_context_engine.py
@@ -38,10 +38,12 @@ TASK_POLL_MAX_WAIT = 120
def _get_api_headers() -> Dict[str, str]:
headers = {
"X-API-Key": OPENVIKING_API_KEY,
- "X-OpenViking-Account": OPENVIKING_ACCOUNT,
- "X-OpenViking-User": OPENVIKING_USER,
"Content-Type": "application/json",
}
+ if OPENVIKING_ACCOUNT and "." not in OPENVIKING_API_KEY:
+ headers["X-OpenViking-Account"] = OPENVIKING_ACCOUNT
+ if OPENVIKING_USER and "." not in OPENVIKING_API_KEY:
+ headers["X-OpenViking-User"] = OPENVIKING_USER
return headers
diff --git a/tests/oc2ov_test/tests/p0/test_memory_crud.py b/tests/oc2ov_test/tests/p0/test_memory_crud.py
index df76e4690..9cb705c55 100644
--- a/tests/oc2ov_test/tests/p0/test_memory_crud.py
+++ b/tests/oc2ov_test/tests/p0/test_memory_crud.py
@@ -61,7 +61,7 @@ class TestMemoryRead(BaseOpenClawCLITest):
for query, expected_keywords, desc in queries:
self.logger.info(f" 查询: {query} (场景: {desc})")
- resp = self.send_and_retry_on_timeout(query, session_id=session_id, timeout=300)
+ resp = self.send_and_retry_on_timeout(query, session_id=session_id)
self.assertAnyKeywordInResponse(resp, expected_keywords, case_sensitive=False)
@@ -93,7 +93,7 @@ class TestMemoryUpdate(BaseOpenClawCLITest):
)
self.logger.info("[3/4] 验证更新是否生效")
- resp1 = self.send_and_retry_on_timeout("我现在多少岁?我的职业是什么?", timeout=300)
+ resp1 = self.send_and_retry_on_timeout("我现在多少岁?我的职业是什么?")
self.assertAnyKeywordInResponse(
resp1, [["29", "二十九"], ["数据科学家"]], case_sensitive=False
)
@@ -132,9 +132,7 @@ class TestMemoryDelete(BaseOpenClawCLITest):
)
self.logger.info("[2/4] 确认信息已存在")
- resp1 = self.send_and_retry_on_timeout(
- "我的临时密码是什么?", session_id=session_id, timeout=300
- )
+ resp1 = self.send_and_retry_on_timeout("我的临时密码是什么?", session_id=session_id)
self.assertAnyKeywordInResponse(resp1, [["temp12345"]], case_sensitive=False)
self.logger.info("[3/4] 请求删除临时密码信息并 commit")
@@ -213,7 +211,7 @@ class TestMemoryUpdateOverwrite(BaseOpenClawCLITest):
self.logger.info("[3/4] 查询并验证记忆信息")
response = self.send_and_retry_on_timeout(
- "我今年几岁?生日是什么时候?", session_id=session_a, timeout=300
+ "我今年几岁?生日是什么时候?", session_id=session_a
)
self.logger.info("[4/4] 验证结果:应包含新信息(31岁、8月),不应包含旧信息(30岁)")
diff --git a/tests/oc2ov_test/tests/p0/test_memory_v2_full_suite.py b/tests/oc2ov_test/tests/p0/test_memory_v2_full_suite.py
index 4a6bfb3d5..5c4e0865d 100644
--- a/tests/oc2ov_test/tests/p0/test_memory_v2_full_suite.py
+++ b/tests/oc2ov_test/tests/p0/test_memory_v2_full_suite.py
@@ -646,8 +646,8 @@ class MemoryV2TestSuite:
print(f" OV session ID: {ov_session_id}")
commit_resp = self.api.commit_session(ov_session_id)
- commit_data = commit_resp.get("data", {})
- commit_result = commit_data.get("result", {})
+ commit_data = commit_resp.get("data") or {}
+ commit_result = commit_data.get("result") or {}
task_id = commit_result.get("task_id")
if not task_id and commit_result.get("status") == "accepted":
@@ -665,8 +665,8 @@ class MemoryV2TestSuite:
except Exception:
pass
commit_resp = self.api.commit_session(ov_session_id)
- commit_data = commit_resp.get("data", {})
- commit_result = commit_data.get("result", {})
+ commit_data = commit_resp.get("data") or {}
+ commit_result = commit_data.get("result") or {}
task_id = commit_result.get("task_id")
if commit_resp["status_code"] == 200 and task_id:
@@ -679,8 +679,8 @@ class MemoryV2TestSuite:
print(" 等待 10 秒后重试 commit...")
time.sleep(10)
commit_resp = self.api.commit_session(ov_session_id)
- commit_data = commit_resp.get("data", {})
- commit_result = commit_data.get("result", {})
+ commit_data = commit_resp.get("data") or {}
+ commit_result = commit_data.get("result") or {}
task_id = commit_result.get("task_id")
if task_id:
print(f"✓ 重试 Commit 成功 (task_id: {task_id})")
diff --git a/tests/oc2ov_test/utils/openclaw_cli_client.py b/tests/oc2ov_test/utils/openclaw_cli_client.py
index 56f04ff63..13309057f 100644
--- a/tests/oc2ov_test/utils/openclaw_cli_client.py
+++ b/tests/oc2ov_test/utils/openclaw_cli_client.py
@@ -52,7 +52,7 @@ class OpenClawCLIClient:
初始化客户端
"""
self.session_id = session_id or "test_session_default"
- self.timeout = 300
+ self.timeout = 180
def send_message(
self,