Skip to content

An always-on second brain you talk to. Voice notes in Telegram → typed, linked knowledge in your Obsidian vault. Runs 24/7 on the Claude subscription you already have.

fix(tmux): recognize the new working-spinner format

smixsb49d9b6d3e51
diff --git a/src/d_brain/services/tmux_parse.py b/src/d_brain/services/tmux_parse.py
index 44c14f9..40a5ab7 100644
--- a/src/d_brain/services/tmux_parse.py
+++ b/src/d_brain/services/tmux_parse.py
@@ -121,7 +121,12 @@ _STARTING_RE = re.compile(r"Claude Code v\d", re.I)
# for the whole turn, so its absence + an idle ❯ is the idle signal. The
# bypass footer is ALWAYS on screen under --dangerously-skip-permissions and
# must never be used as an idle signal by itself.
-_WORKING_RE = re.compile(r"esc to interrupt")
+# Two working signatures: the legacy "esc to interrupt" hint, and the newer
+# spinner with a live elapsed-time + token counter, e.g.
+# "✢ Razzle-dazzling… (44s · ↓1.8k tokens)". Newer Claude Code dropped the
+# hint entirely, so matching only the old string blinded the stall detector
+# and false-killed every turn longer than stall_timeout.
+_WORKING_RE = re.compile(r"esc to interrupt|\(\d+s\s*·")
# Idle = a BARE ❯ on its own line (empty input). A menu selector ("❯ 1. Yes…")
# has text after the chevron and must NOT count — otherwise a turn stuck on an
# approval/menu prompt would be mistaken for completion (wrap=False).
diff --git a/tests/test_tmux_parse.py b/tests/test_tmux_parse.py
index 1677b9b..a874e87 100644
--- a/tests/test_tmux_parse.py
+++ b/tests/test_tmux_parse.py
@@ -391,3 +391,24 @@ def test_survey_prompt_detected():
)
assert has_survey_prompt(pane)
assert not has_survey_prompt("❯\n ⏵⏵ bypass permissions on\n")
+
+
+def test_is_working_detects_new_spinner_format():
+ # Claude Code dropped the "esc to interrupt" hint; the live turn now
+ # shows a spinner with an elapsed-time + token counter.
+ from d_brain.services.tmux_parse import is_working
+
+ assert is_working("reply so far\n✢ Razzle-dazzling… (44s · ↓1.8k tokens)\n")
+ assert is_working("✽ Booping… (55s · ↓4.1k tokens)\n")
+
+
+def test_is_working_still_detects_legacy_hint():
+ from d_brain.services.tmux_parse import is_working
+
+ assert is_working(" ✻ Working… (esc to interrupt)\n")
+
+
+def test_is_working_false_at_idle():
+ from d_brain.services.tmux_parse import is_working
+
+ assert not is_working("❯\n ⏵⏵ bypass permissions on (shift+tab to cycle)\n")