Skip to content

Commit 4187927

Browse files
Staacksclaude
andcommitted
t1_experiments: retry a timed-out tool command once, visibly
A 30 s hang on launch or terminate is a simulator/adb hiccup, not a property of the experiment being launched (healthy duration 0.2-0.4 s). sh() now retries once on timeout - free when things are healthy, and it removes the one failure mode that has turned the workflow red without an app defect behind it. A successful retry still prints a ~ retried note so the hiccup stays visible; only a second timeout returns the failed-command stand-in. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0cd4c95 commit 4187927

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

tools/t1_experiments.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,26 @@ class _Timeout:
9090

9191

9292
def sh(cmd, timeout=30):
93-
try:
94-
return subprocess.run(cmd, capture_output=True, text=True,
95-
timeout=timeout)
96-
except subprocess.TimeoutExpired:
97-
print(f" ~ command timed out after {timeout}s: {' '.join(cmd[:4])} ...")
98-
return _Timeout()
93+
"""One retry on timeout: a 30 s hang on launch or terminate is a
94+
simulator/adb hiccup, not a property of the experiment (measured
95+
healthy duration 0.2-0.4 s) - the retry costs nothing when things
96+
work and removes the one failure mode that has turned this workflow
97+
red without an app defect behind it. The ~ retried note keeps the
98+
hiccup visible even when the retry succeeds."""
99+
for attempt in (1, 2):
100+
try:
101+
r = subprocess.run(cmd, capture_output=True, text=True,
102+
timeout=timeout)
103+
if attempt == 2:
104+
print(f" ~ retried after a timeout: "
105+
f"{' '.join(cmd[:4])} ...")
106+
return r
107+
except subprocess.TimeoutExpired:
108+
if attempt == 1:
109+
continue
110+
print(f" ~ command timed out twice ({timeout}s each): "
111+
f"{' '.join(cmd[:4])} ...")
112+
return _Timeout()
99113

100114

101115
def api(base, path, timeout=5):

0 commit comments

Comments
 (0)