Skip to content

Commit 7f1af60

Browse files
committed
test(kilocode): skip the installed-CLI smoke tests when --help cannot run (#955)
Second codex review pass, and it is right that the two halves disagreed. This branch makes an unreadable `kilo --help` a *supported* state -- detection falls back to modern, asserted directly in test_kilocode_prompt_955 -- but test_the_installed_cli_matches_one_of_the_two_known_surfaces still read the same EROFS crash log as evidence of an unknown third surface and failed. Any sandbox or hardened CI image with kilo installed and an unwritable log dir stayed red on a case the adapter handles by design. When the binary cannot produce help, the installed surface is unknowable, so these two tests have nothing to measure and skip with the reason. Their real job -- catching the next CLI rewrite -- is unaffected: a kilo whose --help works and matches neither surface still fails. Refs #955
1 parent 86d059f commit 7f1af60

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

tests/core/adapters/test_kilocode_7x_1015.py

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,33 @@ def test_legacy_never_uses_stdin(adapter, monkeypatch, tmp_path):
209209
# ---------------------------------------------------------------------------
210210

211211

212-
@pytest.mark.skipif(shutil.which("kilo") is None, reason="kilo not installed")
213-
def test_the_installed_cli_matches_one_of_the_two_known_surfaces():
214-
"""Pins the next rewrite: a third surface must fail here, not in production."""
212+
def _installed_help() -> str:
213+
"""`kilo --help`, or skip when the binary cannot produce help at all.
214+
215+
A kilo whose log directory is unwritable prints a Bun EROFS stack trace and
216+
exits 1 — sandboxes and hardened CI images hit this. Since #955 that is a
217+
*supported* state: detection falls back to modern, which these tests assert
218+
directly. So a smoke test that reads the installed CLI has nothing to
219+
measure here and must skip, not fail; asserting on a crash log would make
220+
the suite red for a case the adapter handles by design.
221+
"""
215222
proc = subprocess.run(
216223
["kilo", "--help"], capture_output=True, text=True, timeout=90
217224
)
218225
help_text = proc.stdout + proc.stderr
226+
if proc.returncode != 0 and kilo_mod._RUN_SUBCOMMAND_MARKER not in help_text:
227+
pytest.skip(
228+
"`kilo --help` failed on this machine, so the installed surface is "
229+
f"unknowable. Detection falls back to modern by design (#955). "
230+
f"Output begins:\n{help_text[:300]}"
231+
)
232+
return help_text
233+
234+
235+
@pytest.mark.skipif(shutil.which("kilo") is None, reason="kilo not installed")
236+
def test_the_installed_cli_matches_one_of_the_two_known_surfaces():
237+
"""Pins the next rewrite: a third surface must fail here, not in production."""
238+
help_text = _installed_help()
219239

220240
modern = kilo_mod._RUN_SUBCOMMAND_MARKER in help_text
221241
legacy = "--workspace" in help_text and "--yolo" in help_text
@@ -229,6 +249,10 @@ def test_the_installed_cli_matches_one_of_the_two_known_surfaces():
229249
@pytest.mark.skipif(shutil.which("kilo") is None, reason="kilo not installed")
230250
def test_the_detected_surface_documents_the_flags_the_adapter_uses(tmp_path):
231251
"""Whatever is installed, every flag the adapter emits must exist on it."""
252+
# Skips when the binary cannot produce help, for the reason in _installed_help:
253+
# the surface is unknowable, so "the flags match the CLI" is unmeasurable.
254+
_installed_help()
255+
232256
adapter = KilocodeAdapter()
233257
cmd = adapter.build_command("x", tmp_path)
234258

0 commit comments

Comments
 (0)