[错误]: GET /agents/connections/me?agent_session_name=… 对于已停用(非活动)的连接返回 404
作者: nagelm创建于 2026年9月4日更新于 2026年9月30日
问题描述
GET /api/v1/agents/connections/me?agent_session_name=<name> 返回 404 {"detail":"connection not found"},对于已存在的连接,只要该连接已被 POST /api/v1/agents/unregister 失效,即可出现此问题。GET /api/v1/agents/connections?active_only=false 仍然将其列出(状态为 inactive)。
原因:get_agent_connection_detail()(cognee/modules/agents/operations.py)调用 list_agent_connections(),默认参数 active_only=True,然后通过 agent_session_name 进行过滤。在执行名称过滤之前,失效的连接将被丢弃,因此通过名称查找永远无法找到它们。未命名的 /connections/me 仅仅因为它返回了先排序的活动连接 - 在繁忙机器上,不同会话的连接。
内容来源: topoteretes/cognee