test(mcp): make session reconnect probe uptime-independent

This commit is contained in:
ethernet 2026-07-21 16:30:58 -04:00
parent 76c2f0aae2
commit fe5b4c6b2e
3 changed files with 11 additions and 9 deletions

View file

@ -4060,18 +4060,18 @@ async def check_hermes_update(force: bool = False):
``POST /api/hermes/update`` actually runs ``hermes update``.
Returns:
install_method: 'git' | 'pip' | 'docker' | 'nixos' | 'homebrew' | ...
install_method: 'git' | 'docker' | 'nixos' | 'unknown'
current_version: installed Hermes version string
behind: commits behind upstream (>=1), 0 if up to date,
-1 if behind by an unknown count (nix/pypi), or null if the
-1 if behind by an unknown count, or null if the
check could not run (offline, no remote, etc.)
update_available: convenience bool (behind is non-zero and not null)
can_apply: True when the dashboard's update button can apply it
in place (git/pip); False for docker/nix/homebrew where the
in place (git); False for other install methods where the
user must update out-of-band
update_command: the recommended command for this install method
message: human-readable guidance for non-applyable methods
commits: for git/pip installs that are behind, a list of the commits
commits: for git installs that are behind, a list of the commits
the local checkout is behind upstream by each
{sha, summary, author, at}. Absent/empty otherwise. The
desktop's remote update overlay renders this as "what's
@ -4108,7 +4108,7 @@ async def check_hermes_update(force: bool = False):
payload["message"] = format_docker_update_message()
return payload
# banner.check_for_updates() handles git / pypi / nix-revision paths and
# banner.check_for_updates() handles git / nix-revision paths and
# caches the result for 6h. ``force`` busts the cache so the "Check now"
# button reflects reality immediately.
try:

View file

@ -13,6 +13,7 @@ affected MCP server failed until the gateway was manually restarted.
import asyncio
import json
import threading
import time
from unittest.mock import MagicMock
import pytest
@ -507,7 +508,11 @@ def test_session_expired_retry_waits_for_new_session(monkeypatch, tmp_path):
server._reconnect_event = _ReconnectAdapter()
mcp_tool._servers["hindsight"] = server
mcp_tool._server_error_counts["hindsight"] = 7
mcp_tool._server_breaker_opened_at["hindsight"] = 123.0
# Make this a half-open probe regardless of the runner's uptime. A fixed
# timestamp can still be inside the cooldown on a freshly booted CI host.
mcp_tool._server_breaker_opened_at["hindsight"] = (
time.monotonic() - mcp_tool._CIRCUIT_BREAKER_COOLDOWN_SEC - 1
)
try:
handler = _make_tool_handler("hindsight", "get_bank", 10.0)

View file

@ -85,7 +85,6 @@ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
| 安装方式 | 代码位置 | `hermes` 二进制 | 数据目录 |
| --------------------------------------- | ------------------------------ | ---------------------------------------- | ------------------------------------- |
| pip install | Python site-packages | `~/.local/bin/hermes`console_scripts | `~/.hermes/` |
| 用户级git 安装程序) | `~/.hermes/hermes-agent/` | `~/.local/bin/hermes`(符号链接) | `~/.hermes/` |
| Root 模式(`sudo curl … \| sudo bash` | `/usr/local/lib/hermes-agent/` | `/usr/local/bin/hermes` | `/root/.hermes/`(或 `$HERMES_HOME` |
@ -124,8 +123,6 @@ hermes setup --portal
## 前置条件
**pip install** 除 Python 3.11+ 外无其他前置条件,其余均自动处理。
**Git 安装程序:** 唯一的前置条件是 **Git**。安装程序自动处理其余一切:
- **uv**(快速 Python 包管理器)