fix(cli): fail closed on empty oneshot responses
This commit is contained in:
@@ -638,6 +638,30 @@ def test_oneshot_rejects_invalid_only_toolsets(monkeypatch, capsys):
|
||||
assert "did not contain any valid toolsets" in err
|
||||
|
||||
|
||||
def test_oneshot_fails_closed_on_empty_final_response(monkeypatch, capsys):
|
||||
_stub_plugin_discovery(monkeypatch)
|
||||
import hermes_cli.oneshot as oneshot_mod
|
||||
|
||||
monkeypatch.setattr(oneshot_mod, "_run_agent", lambda *_args, **_kwargs: "")
|
||||
|
||||
assert oneshot_mod.run_oneshot("hello") == 1
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == ""
|
||||
assert "no final response" in captured.err
|
||||
|
||||
|
||||
def test_oneshot_prints_nonempty_final_response(monkeypatch, capsys):
|
||||
_stub_plugin_discovery(monkeypatch)
|
||||
import hermes_cli.oneshot as oneshot_mod
|
||||
|
||||
monkeypatch.setattr(oneshot_mod, "_run_agent", lambda *_args, **_kwargs: "done")
|
||||
|
||||
assert oneshot_mod.run_oneshot("hello") == 0
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == "done\n"
|
||||
assert captured.err == ""
|
||||
|
||||
|
||||
def test_oneshot_filters_invalid_toolsets_before_redirect(monkeypatch, capsys):
|
||||
_stub_plugin_discovery(monkeypatch)
|
||||
from hermes_cli.oneshot import _validate_explicit_toolsets
|
||||
|
||||
Reference in New Issue
Block a user