Keep Kimi going at a stop with exit code 2

Kimi's agent-core reads a top-level {"decision": "block"} as allow, so
Harbor's keep-going never took effect for Kimi; it honours exit code 2
with the reason on stderr (its hooks run through cmd.exe), once per turn.
Tool-call denials keep the JSON form, which Kimi does honour.
Also: attention skips stopped agents and closed items; file scopes of
function files carry their address.
This commit is contained in:
KeelrLeek committed 2026-10-05 10:53:32 -05:00
1 parent dbfd1720c5
commit dbc0c45ef2
2 files changed
+25 -4

No files matched your search

+16
View File
@@ -1,4 +1,5 @@
"""Regression tests for the correctness review of rounds five and six."""
import json
import os
import re
import shutil
@@ -358,6 +359,21 @@ class AttentionWithoutFalseAlarms(HarborCase):
self.assertFalse(any(a["kind"] == "ack_overdue" and f"#{m['id']}" in a["text"] for a in self.h.attention()))
class KimiStopKeepGoing(unittest.TestCase):
def test_kimi_gets_exit_2_and_stderr_others_get_json(self):
import contextlib, io
from harbor import hooks
out, err = io.StringIO(), io.StringIO()
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
code = hooks._keep_going("kimi", "keep going")
self.assertEqual((code, out.getvalue(), err.getvalue().strip()), (2, "", "keep going"))
out = io.StringIO()
with contextlib.redirect_stdout(out):
code = hooks._keep_going("codex", "keep going")
self.assertEqual(code, 0)
self.assertEqual(json.loads(out.getvalue())["decision"], "block")
class HooksVisible(HarborCase):
def test_mcp_without_hooks_needs_attention(self):
self.h.connect("Codex", "mcp", "codex")