fix(kanban): no-TTY gate in _wants_tui_early — the actual worker-crash fix

The earlier fix gated _resolve_use_tui, but the EARLY launcher
(_wants_tui_early) decides TUI from display.interface before cmd_chat
runs — so a `display.interface: tui` default still booted the Ink UI for
headless spawns (kanban workers), whose no-TTY bail-out exits 0 →
"protocol violation". Gate the early resolver on a real TTY: headless
stdio never boots the TUI regardless of config; explicit --tui still does.
This commit is contained in:
Brooklyn Nicholson 2026-07-09 16:13:28 -05:00
parent 77db9d6bf3
commit b06e2f846c
2 changed files with 31 additions and 2 deletions

View file

@ -153,10 +153,24 @@ class TestWantsTuiEarly:
return _make
def test_config_tui_bare_argv(self, home_with_interface):
def test_config_tui_bare_argv(self, home_with_interface, monkeypatch):
home_with_interface("tui")
_fake_tty(monkeypatch, True) # config-tui only applies on a real TTY
assert m._wants_tui_early([]) is True
def test_no_tty_blocks_config_tui(self, home_with_interface, monkeypatch):
# Headless (worker/cron/pipe): ambient config-tui must not boot the
# Ink UI in the earliest launch decision — that's the crash the
# kanban worker hit before the gate existed.
home_with_interface("tui")
_fake_tty(monkeypatch, False)
assert m._wants_tui_early([]) is False
def test_explicit_tui_flag_survives_no_tty(self, home_with_interface, monkeypatch):
home_with_interface("cli")
_fake_tty(monkeypatch, False)
assert m._wants_tui_early(["--tui"]) is True
def test_cli_flag_overrides_config_tui(self, home_with_interface):
home_with_interface("tui")
assert m._wants_tui_early(["--cli"]) is False