The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(process): wait timeout result reads as status, not failure
Teknium0b149ca0308e
diff --git a/tests/tools/test_process_wait_clarity.py b/tests/tools/test_process_wait_clarity.pynew file mode 100644index 00000000000..d5a61ed1076--- /dev/null+++ b/tests/tools/test_process_wait_clarity.py@@ -0,0 +1,64 @@+"""Tests for process wait timeout-result clarity (not-an-error semantics)."""++import pytest++from tools.process_registry import ProcessRegistry+++def registry(tmp_path, monkeypatch):+ monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))+ return ProcessRegistry()+++def _spawn_sleeper(registry, notify=False):+ session = registry.spawn_local("sleep 30", cwd="/tmp", task_id="t-waitclar")+ session.notify_on_complete = notify+ return session.id+++class TestWaitTimeoutClarity:+ def test_wait_timeout_marks_process_running(self, registry):+ sid = _spawn_sleeper(registry)+ try:+ r = registry.wait(sid, timeout=1)+ assert r["status"] == "timeout"+ assert r["process_running"] is True+ assert "not an error" in r["timeout_note"]+ assert "Uptime" in r["timeout_note"]+ finally:+ registry.kill_process(sid)++ def test_wait_timeout_suggests_notify_when_unset(self, registry):+ sid = _spawn_sleeper(registry, notify=False)+ try:+ r = registry.wait(sid, timeout=1)+ assert "notify_on_complete=true" in r["timeout_note"]+ finally:+ registry.kill_process(sid)++ def test_wait_timeout_defers_to_notify_when_set(self, registry):+ sid = _spawn_sleeper(registry, notify=True)+ try:+ r = registry.wait(sid, timeout=1)+ assert "you will be notified on exit" in r["timeout_note"]+ finally:+ registry.kill_process(sid)++ def test_clamped_wait_keeps_clamp_note_and_running_semantics(self, registry, monkeypatch):+ monkeypatch.setenv("TERMINAL_TIMEOUT", "1")+ sid = _spawn_sleeper(registry)+ try:+ r = registry.wait(sid, timeout=600)+ assert r["status"] == "timeout"+ assert "clamped" in r["timeout_note"]+ assert "not an error" in r["timeout_note"]+ assert r["process_running"] is True+ finally:+ registry.kill_process(sid)++ def test_exited_process_unaffected(self, registry):+ session = registry.spawn_local("true", cwd="/tmp", task_id="t-waitclar")+ r = registry.wait(session.id, timeout=10)+ assert r["status"] == "exited"+ assert "process_running" not in rdiff --git a/tools/process_registry.py b/tools/process_registry.pyindex fdea8f4762e..29af51f0006 100644--- a/tools/process_registry.py+++ b/tools/process_registry.py@@ -1598,11 +1598,32 @@ class ProcessRegistry:"status": "timeout","command": session.command,"output": strip_ansi(session.output_buffer[-1000:]),+ # A wait window elapsing is NOT a failure — 511 exact-duplicate+ # process calls in a production window show models re-issuing+ # identical waits after misreading this result as an error.+ "process_running": True,}+ uptime = time.time() - session.started_at if session.started_at else None+ base_note = (+ f"Wait window of {effective_timeout}s elapsed — the process is "+ "still running. This is not an error."+ )+ if uptime is not None:+ base_note += f" Uptime: {int(uptime)}s."+ if session.notify_on_complete:+ base_note += (+ " notify_on_complete is set: you will be notified on exit — "+ "do more work instead of waiting again."+ )+ else:+ base_note += (+ " Poll again later or use terminal(background=true, "+ "notify_on_complete=true) next time for automatic notification."+ )if timeout_note:- result["timeout_note"] = timeout_note+ result["timeout_note"] = f"{timeout_note}. {base_note}"else:- result["timeout_note"] = f"Waited {effective_timeout}s, process still running"+ result["timeout_note"] = base_notereturn resultdef kill_process(