fix(ci): clear Gitea Hermes test blockers
Some checks failed
Contributor Attribution Check / check-attribution (pull_request) Failing after 1m9s
Supply Chain Audit / Scan PR for critical supply chain risks (pull_request) Successful in 1m6s
Tests / e2e (pull_request) Successful in 2m8s
Nix / nix (ubuntu-latest) (pull_request) Failing after 13m56s
Tests / test (pull_request) Failing after 17m20s

This commit is contained in:
hongming-codex-laptop 2026-05-12 22:57:34 -07:00
parent 532ee0099d
commit f359993f33
4 changed files with 17 additions and 37 deletions

View File

@ -597,6 +597,7 @@ class TestAuxiliaryPoolAwareness:
with (
patch("agent.auxiliary_client.load_pool", return_value=_Pool()),
patch("hermes_cli.models.get_nous_recommended_aux_model", return_value="google/gemini-3-flash-preview"),
patch("agent.auxiliary_client.OpenAI") as mock_openai,
):
from agent.auxiliary_client import _try_nous

View File

@ -303,7 +303,7 @@ class TestTencentTokenhubContextLength:
def test_hy3_preview_context_length(self):
from agent.model_metadata import get_model_context_length
ctx = get_model_context_length("hy3-preview")
assert ctx == 256000
assert ctx == 262144
# =============================================================================
@ -491,4 +491,3 @@ class TestTencentTokenhubKnownProviderNames:
def test_alias_known(self, alias):
from hermes_cli.models import _KNOWN_PROVIDER_NAMES
assert alias in _KNOWN_PROVIDER_NAMES

View File

@ -945,6 +945,7 @@ class TestAuxiliaryClientProviderPriority:
monkeypatch.delenv("OPENROUTER_API_KEY", raising=False)
from agent.auxiliary_client import get_text_auxiliary_client
with patch("agent.auxiliary_client._read_nous_auth", return_value={"access_token": "nous-tok"}), \
patch("hermes_cli.models.get_nous_recommended_aux_model", return_value="google/gemini-3-flash-preview"), \
patch("agent.auxiliary_client.OpenAI") as mock:
client, model = get_text_auxiliary_client()
assert model == "google/gemini-3-flash-preview"

View File

@ -122,6 +122,16 @@ def test_wait_for_process_kills_subprocess_on_keyboardinterrupt():
proc_holder = {}
started = threading.Event()
raise_at = [None] # set by the main thread to tell worker when
original_run_bash = env._run_bash
def capture_run_bash(cmd_string, *args, **kwargs):
proc = original_run_bash(cmd_string, *args, **kwargs)
if "sleep 30" in cmd_string:
proc_holder["proc"] = proc
started.set()
return proc
env._run_bash = capture_run_bash
# Drive execute() on a separate thread so we can SIGNAL-interrupt it
# via a thread-targeted exception without killing our test process.
@ -136,42 +146,11 @@ def test_wait_for_process_kills_subprocess_on_keyboardinterrupt():
t = threading.Thread(target=worker, daemon=True)
t.start()
# Wait until the subprocess actually exists. LocalEnvironment.execute
# does init_session() (one spawn) before the real command, so we need
# to wait until a sleep 30 is visible. Use pgrep-style lookup via
# /proc to find the bash process running our sleep.
deadline = time.monotonic() + 5.0
target_pid = None
while time.monotonic() < deadline:
# Walk our children and grand-children to find one running 'sleep 30'
try:
import psutil # optional — fall back if absent
for p in psutil.Process(os.getpid()).children(recursive=True):
try:
if "sleep 30" in " ".join(p.cmdline()):
target_pid = p.pid
break
except (psutil.NoSuchProcess, psutil.AccessDenied):
continue
except ImportError:
# Fall back to ps
ps = subprocess.run(
["ps", "-eo", "pid,ppid,pgid,cmd"], capture_output=True, text=True,
)
for line in ps.stdout.splitlines():
if "sleep 30" in line and "grep" not in line:
parts = line.split()
if parts and parts[0].isdigit():
target_pid = int(parts[0])
break
if target_pid:
break
time.sleep(0.1)
assert target_pid is not None, (
"test setup: couldn't find 'sleep 30' subprocess after 5 s"
assert started.wait(timeout=5.0), (
"test setup: sleep 30 command was not spawned after 5 s"
)
pgid = os.getpgid(target_pid)
proc = proc_holder["proc"]
pgid = getattr(proc, "_hermes_pgid", None) or os.getpgid(proc.pid)
assert _pgid_still_alive(pgid), "sanity: subprocess should be alive"
# Now inject a KeyboardInterrupt into the worker thread the same