[object Object]

← back to Terminal Status

dot.sh: check-for-color — hard timeout + report result, never a silent hang/no-op

06cd6c57eebcd97bb7c09f48cbbdd1b1add53dc4 · 2026-09-16 10:13:35 -0700 · Steve Abrams

The engine's ps-scan can run to its ~90s ceiling under host load (appeared as a
hang) and a tool/subagent-shell paint exits nonzero (silent no-op). dot.sh now
runs every paint under a hard outer timeout (TS_PAINT_TIMEOUT, default 100s) and
CHECKS the result, printing one clear line (painted/cleared/TIMED OUT/NOT painted)
so a tab never silently loses its color. Exit code preserved; subagent-paint guard
in terminal_status.py intentionally untouched (selftest still 4/4).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 06cd6c57eebcd97bb7c09f48cbbdd1b1add53dc4
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Sep 16 10:13:35 2026 -0700

    dot.sh: check-for-color — hard timeout + report result, never a silent hang/no-op
    
    The engine's ps-scan can run to its ~90s ceiling under host load (appeared as a
    hang) and a tool/subagent-shell paint exits nonzero (silent no-op). dot.sh now
    runs every paint under a hard outer timeout (TS_PAINT_TIMEOUT, default 100s) and
    CHECKS the result, printing one clear line (painted/cleared/TIMED OUT/NOT painted)
    so a tab never silently loses its color. Exit code preserved; subagent-paint guard
    in terminal_status.py intentionally untouched (selftest still 4/4).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 integrations/dot.sh | 40 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/integrations/dot.sh b/integrations/dot.sh
index 1a1acc3..a504244 100644
--- a/integrations/dot.sh
+++ b/integrations/dot.sh
@@ -1,12 +1,42 @@
 #!/usr/bin/env bash
 # Shared compatibility entrypoint for the Claude and Codex color skills.
-set -eu
+#
+# 2026-09-16 (Steve: "fix script so this is checked for color"): CHECK-FOR-COLOR
+# hardening. Two failure modes previously left a tab silently colorless with no
+# reason: (1) the engine's ps-scan can run up to its internal ~90s ceiling under
+# host load, so a caller appeared to HANG; (2) a paint from a tool/subagent shell
+# exits nonzero (the CLAUDE_CODE_CHILD_SESSION refusal), a silent no-op. Now every
+# paint runs under a HARD outer timeout and the result is CHECKED + reported with
+# ONE clear line (painted / cleared / TIMED OUT / NOT painted) so the color state
+# is never changed-or-failed silently. Exit code is preserved (0 = painted), so
+# callers doing `rc=$?` are unaffected. The subagent-paint guard in
+# terminal_status.py is intentionally UNTOUCHED (it prevents a subagent from
+# corrupting the parent's live pane across the session fleet).
+set -u
 runtime="${1:?runtime required}"
 color="${2:?color required}"
 shift 2
 engine="$HOME/Projects/terminal-status/terminal_status.py"
-case "${1:-}" in
-  --off) exec python3 "$engine" clear ;;
-  --all) exec python3 "$engine" set "$color" --all "$runtime" ;;
-  *) exec python3 "$engine" set "$color" "$@" ;;
+timeout_s="${TS_PAINT_TIMEOUT:-100}"          # just above the engine's ~90s scan ceiling
+tmo="$(command -v timeout || command -v gtimeout || true)"
+
+run() {  # run the engine, under a hard outer timeout when one is available
+  if [ -n "$tmo" ]; then "$tmo" "$timeout_s" python3 "$engine" "$@"
+  else python3 "$engine" "$@"; fi
+}
+
+mode="${1:-}"
+case "$mode" in
+  --off) run clear ;;
+  --all) run set "$color" --all "$runtime" ;;
+  *)     run set "$color" "$@" ;;
 esac
+rc=$?
+
+# CHECK the paint result and SAY so — never a silent color change or failure.
+case "$rc" in
+  0)   if [ "$mode" = --off ]; then echo "dot: cleared"; else echo "dot: painted ${color}"; fi ;;
+  124) echo "dot: paint TIMED OUT after ${timeout_s}s (host load) — tab color UNCHANGED" >&2 ;;
+  *)   echo "dot: NOT painted (engine rc=${rc}; refusal or error above) — tab color UNCHANGED" >&2 ;;
+esac
+exit "$rc"

← 5463758 TK-11826 (TK-11779 Finding 2): pin ticket_update=None in T1-  ·  back to Terminal Status  ·  TK-11835: fail-fast cross-tty paint — a busy --tty target is f18d087 →