mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +08:00
补充历史压缩与会话诊断链路,强化 tool pairing 与空响应兜底观测;完善 Admin MCP 导入/绑定与相关前端展示;新增 web_search_fast/web_fetch_clean 及多项测试与文档更新,并同步技能安装与角色绑定策略改进。 Made-with: Cursor
22 lines
958 B
Python
22 lines
958 B
Python
from __future__ import annotations
|
|
|
|
from oclaw.platform.persistence.sqlite_store import SqliteStore
|
|
|
|
|
|
def test_delete_session_cascades_chat_message_and_tool_log(tmp_path) -> None: # noqa: ANN001
|
|
db = tmp_path / "ops.sqlite"
|
|
store = SqliteStore(str(db))
|
|
sess = store.create_session("t")
|
|
store.add_message(session_id=sess.id, role="user", content="hi", event_type="user_text")
|
|
store.add_tool_log(session_id=sess.id, tool_name="x", args={"a": 1}, result={"ok": True})
|
|
|
|
store.delete_session(sess.id)
|
|
|
|
with store._connect() as conn: # noqa: SLF001
|
|
c1 = conn.execute("select count(1) from chat_message where session_id=?", (sess.id,)).fetchone()[0]
|
|
c2 = conn.execute("select count(1) from tool_log where session_id=?", (sess.id,)).fetchone()[0]
|
|
c3 = conn.execute("select count(1) from chat_session where id=?", (sess.id,)).fetchone()[0]
|
|
assert int(c3) == 0
|
|
assert int(c1) == 0
|
|
assert int(c2) == 0
|
|
|