fix(tui): address copilot review on #14103

- normalizeStatusBar: trim/lowercase + 'on' → 'top' alias so user-edited
  YAML variants (Top, " bottom ", on) coerce correctly
- shift-tab yolo: no-op with sys note when no live session; success-gated
  echo and catch fallback so RPC failures don't report as 'yolo off'
- tui_gateway config.set/get statusbar: isinstance(display, dict) guards
  mirroring the compact branch so a malformed display scalar in config.yaml
  can't raise

Tests: +1 vitest for trim/case/on, +2 pytest for non-dict display survival.
This commit is contained in:
Brooklyn Nicholson 2026-04-22 15:19:50 -05:00
parent 48f2ac3352
commit 6fb98f343a
5 changed files with 399 additions and 112 deletions

View file

@ -2528,7 +2528,8 @@ def _(rid, params: dict) -> dict:
if key == "statusbar":
raw = str(value or "").strip().lower()
d0 = _load_cfg().get("display") or {}
cfg0 = _load_cfg()
d0 = cfg0.get("display") if isinstance(cfg0.get("display"), dict) else {}
current = _coerce_statusbar(d0.get("tui_statusbar", "top"))
if raw in ("", "toggle"):
@ -2659,7 +2660,10 @@ def _(rid, params: dict) -> dict:
on = bool(_load_cfg().get("display", {}).get("tui_compact", False))
return _ok(rid, {"value": "on" if on else "off"})
if key == "statusbar":
raw = _load_cfg().get("display", {}).get("tui_statusbar", "top")
display = _load_cfg().get("display")
raw = (
display.get("tui_statusbar", "top") if isinstance(display, dict) else "top"
)
return _ok(rid, {"value": _coerce_statusbar(raw)})
if key == "mtime":
cfg_path = _hermes_home / "config.yaml"