Skip to content

The agent that grows with you

test(cli): finite-chat probes expect the settled-result exit code

Teknium90c5faa235e2
diff --git a/tests/gateway/fixtures/cli_launch_policy_probe.py b/tests/gateway/fixtures/cli_launch_policy_probe.py
index ee6dc0d60c0..416d9f9abd2 100644
--- a/tests/gateway/fixtures/cli_launch_policy_probe.py
+++ b/tests/gateway/fixtures/cli_launch_policy_probe.py
@@ -107,7 +107,9 @@ def probe(tmp_path):
max_turns=1 if side == 'left' else 3, ignore_rules=side == 'left', toolsets='terminal')
result = subprocess.run([sys.executable, '-c', 'import cli; cli.main(**' + repr(args) + ')'],
cwd=cwd, env=env, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=70)
- assert result.returncode == 0, result.stdout + result.stderr
+ # A budget run stops at --max-turns with the work unfinished: `chat -Q` exits 1 (documented
+ # contract, same as the in-process CLI), never 0.
+ assert result.returncode == (1 if budget else 0), result.stdout + result.stderr
if not resume:
sessions[side] = re.search(r'Session: (\S+)', result.stderr).group(1)
return result.stdout
diff --git a/tests/hermes_cli/test_stream_json.py b/tests/hermes_cli/test_stream_json.py
index 435fe0c6c97..f42815ea26f 100644
--- a/tests/hermes_cli/test_stream_json.py
+++ b/tests/hermes_cli/test_stream_json.py
@@ -68,6 +68,8 @@ def _run_stream_json_chat(monkeypatch, capsys, run_turn, credentials_ok=True):
return {"session_create": {"sources": ["cli"], "parameters": ["cwd", "model", "request_id", "source"]}}
if method == "session.create":
return {"stored_session_id": "session-123", "info": {"model": "test-model"}}
+ if method == "prompt.receipt": # the settled result the exit code is judged from
+ return {"status": "terminal", "result": {"completed": True, "final_response": "hello"}}
assert method == "prompt.submit"
self.emit("message.complete", {**run_turn(self), "admission_id": "adm-1"})
return {"admission_id": "adm-1"}