← back to Terminal Status
osascript enumeration: raise timeout to 30s and record blind spots
29475ed6ef9dc1630f77d72c079873d18d61170f · 2026-09-10 08:33:42 -0700 · Steve Abrams
The iTerm session enumeration ran osascript with timeout=8 and swallowed
failure as `return {}, "unavailable"` -- no exception, no exit code. That is
the false-green class: on a box that hit load 53.78 today (with the sibling
ps call measured at 20.4s), AppleScript enumeration cost scales with tab
count (~49 here), so an 8s ceiling was trippable and its failure was
indistinguishable from "no sessions".
It matters because `start` treats "unavailable" as an empty result and falls
through to painting green instead of restoring a sticky semantic dot -- a
confidently-wrong paint, worse than a missing one.
Raised to 30s, deliberately NOT the 60s used for the ps call: this runs at
session start, where a longer hang would delay startup.
Blind spots now append to the terminal-status-health log via a fail-safe
recorder that never raises and never blocks painting.
DTD 2026-09-10 verdict C (4/5). Reversible: git revert.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXNMS1TvMiVbE3ckhSaLeT
Files touched
Diff
commit 29475ed6ef9dc1630f77d72c079873d18d61170f
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Sep 10 08:33:42 2026 -0700
osascript enumeration: raise timeout to 30s and record blind spots
The iTerm session enumeration ran osascript with timeout=8 and swallowed
failure as `return {}, "unavailable"` -- no exception, no exit code. That is
the false-green class: on a box that hit load 53.78 today (with the sibling
ps call measured at 20.4s), AppleScript enumeration cost scales with tab
count (~49 here), so an 8s ceiling was trippable and its failure was
indistinguishable from "no sessions".
It matters because `start` treats "unavailable" as an empty result and falls
through to painting green instead of restoring a sticky semantic dot -- a
confidently-wrong paint, worse than a missing one.
Raised to 30s, deliberately NOT the 60s used for the ps call: this runs at
session start, where a longer hang would delay startup.
Blind spots now append to the terminal-status-health log via a fail-safe
recorder that never raises and never blocks painting.
DTD 2026-09-10 verdict C (4/5). Reversible: git revert.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXNMS1TvMiVbE3ckhSaLeT
---
terminal_status.py | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 45 insertions(+), 2 deletions(-)
diff --git a/terminal_status.py b/terminal_status.py
index 03068f0..b7e4613 100644
--- a/terminal_status.py
+++ b/terminal_status.py
@@ -31,6 +31,39 @@ COLORS = {
PRIORITY = {name: i for i, name in enumerate(
("orange", "purple", "yellow", "green", "pink", "none"))}
TTY = re.compile(r"ttys[0-9]+")
+
+
+def _record_enum_blind(reason):
+ """Record that iTerm session enumeration went blind (TK-11369).
+
+ A timeout here used to return ({}, "unavailable") silently, which makes
+ `start` paint green instead of restoring a sticky semantic dot. Never
+ raises and never blocks: a failure to log must not break painting.
+ """
+ try:
+ d = os.path.join(os.path.expanduser("~"),
+ ".claude/skills/terminal-status-health/data")
+ os.makedirs(d, exist_ok=True)
+ line = json.dumps({
+ "ts": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
+ "pid": os.getpid(),
+ "rc": "enum_blind",
+ "err": str(reason)[:300],
+ }) + "\n"
+ path = os.path.join(d, "repaint-failures.jsonl")
+ try:
+ if os.path.getsize(path) > 262144:
+ os.replace(path, path + ".1")
+ except OSError:
+ pass
+ # Single O_APPEND write keeps the record atomic across concurrent writers.
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_APPEND, 0o644)
+ try:
+ os.write(fd, line.encode())
+ finally:
+ os.close(fd)
+ except Exception:
+ pass
VERSION = 1
@@ -466,11 +499,21 @@ tell application "iTerm2"
end tell
"""
try:
+ # TK-11369 (DTD 2026-09-10, verdict C): was timeout=8. iTerm AppleScript
+ # enumeration cost scales with tab count (~49 here) and this box has hit
+ # load 53.78, so an 8s ceiling was trippable. Raised to 30s -- NOT 60s
+ # like the ps call, because this runs at session start and a longer hang
+ # would delay startup. A timeout here is a genuine blind spot, not a
+ # benign empty result: it makes `start` fall through and paint green
+ # instead of restoring a sticky semantic dot (a confidently-wrong paint),
+ # so it is now recorded rather than silently swallowed.
result = subprocess.run(["osascript", "-e", script], capture_output=True,
- text=True, timeout=8)
+ text=True, timeout=30)
if result.returncode:
+ _record_enum_blind("osascript returncode " + str(result.returncode))
return {}, "unavailable"
- except (OSError, subprocess.TimeoutExpired):
+ except (OSError, subprocess.TimeoutExpired) as exc:
+ _record_enum_blind(type(exc).__name__ + ": " + str(exc)[:120])
return {}, "unavailable"
sessions = {}
for line in result.stdout.splitlines():
← e6a426b set: automatic paints yield to sticky semantic dots (orange/
·
back to Terminal Status
·
ticket_binding: a slow ps must degrade the label, not kill t fea7539 →