mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
fix(kanban): detect darwin zombie workers
This commit is contained in:
parent
f6b68f0f50
commit
1a03e3b1c6
2 changed files with 40 additions and 5 deletions
|
|
@ -13,9 +13,11 @@ from __future__ import annotations
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from typing import Optional
|
||||
|
||||
import pytest
|
||||
|
|
@ -183,6 +185,20 @@ def test_pid_alive_helper():
|
|||
assert not kb._pid_alive(2 ** 30)
|
||||
|
||||
|
||||
def test_pid_alive_detects_darwin_zombie(monkeypatch):
|
||||
monkeypatch.setattr(kb.sys, "platform", "darwin")
|
||||
monkeypatch.setattr(kb.os, "kill", lambda pid, sig: None)
|
||||
|
||||
def fake_run(args, **kwargs):
|
||||
assert args == ["ps", "-o", "stat=", "-p", "123"]
|
||||
assert kwargs["stdout"] is subprocess.PIPE
|
||||
return SimpleNamespace(returncode=0, stdout="Z+\n")
|
||||
|
||||
monkeypatch.setattr(kb.subprocess, "run", fake_run)
|
||||
|
||||
assert kb._pid_alive(123) is False
|
||||
|
||||
|
||||
def test_detect_crashed_workers_reclaims(kanban_home):
|
||||
"""A running task whose pid vanished gets dropped to ready with a
|
||||
``crashed`` event, independent of the claim TTL."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue