[object Object]

← back to Terminal Status

dot.sh: auto-force retry so bridge/sub sessions paint their dot

c3c5843518d9a242f19be1c6b9b0576fdb323af5 · 2026-09-16 11:18:54 -0700 · Steve

A leaked-flag real session (CLAUDE_CODE_CHILD_SESSION set by the iTerm env-leak)
was wrongly refused by the subagent-paint guard, forcing a manual --force. Now
the shared wrapper retries once with the force opt-in on a bridge refusal, gated
so it never recurses, never fires on a timeout, and only in a child-session
context; the engine's own headless/nested refusal + selftest (4/4) are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017bBRRWJJoCpD1BZK24wvUZ

Files touched

Diff

commit c3c5843518d9a242f19be1c6b9b0576fdb323af5
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Sep 16 11:18:54 2026 -0700

    dot.sh: auto-force retry so bridge/sub sessions paint their dot
    
    A leaked-flag real session (CLAUDE_CODE_CHILD_SESSION set by the iTerm env-leak)
    was wrongly refused by the subagent-paint guard, forcing a manual --force. Now
    the shared wrapper retries once with the force opt-in on a bridge refusal, gated
    so it never recurses, never fires on a timeout, and only in a child-session
    context; the engine's own headless/nested refusal + selftest (4/4) are untouched.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_017bBRRWJJoCpD1BZK24wvUZ
---
 integrations/dot.sh | 48 ++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 40 insertions(+), 8 deletions(-)

diff --git a/integrations/dot.sh b/integrations/dot.sh
index a504244..41de1ca 100644
--- a/integrations/dot.sh
+++ b/integrations/dot.sh
@@ -10,8 +10,11 @@
 # 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).
+# terminal_status.py is intentionally UNTOUCHED; instead this wrapper now
+# AUTO-RETRIES a refused bridge/child-session paint once with the force opt-in
+# (see the auto-force block below) so leaked-flag real sessions paint without a
+# manual --force. The engine's own headless/nested refusal still holds under
+# force, so a truly terminal-less agent is still refused.
 set -u
 runtime="${1:?runtime required}"
 color="${2:?color required}"
@@ -26,12 +29,41 @@ run() {  # run the engine, under a hard outer timeout when one is available
 }
 
 mode="${1:-}"
-case "$mode" in
-  --off) run clear ;;
-  --all) run set "$color" --all "$runtime" ;;
-  *)     run set "$color" "$@" ;;
-esac
-rc=$?
+paint() {  # one dispatch of the requested subcommand; called again on auto-force retry
+  case "$mode" in
+    --off) run clear ;;
+    --all) run set "$color" --all "$runtime" ;;
+    *)     run set "$color" "$@" ;;
+  esac
+}
+
+# Auto-force retry (Steve 2026-09-16, "allow sub sessions to show color too"):
+# a bridge / sub-session paint refuses because nothing local distinguishes it
+# from a true background subagent whose paint would corrupt the parent's pane.
+# Per Steve's decision, retry ONCE with the conscious force opt-in so a
+# leaked-flag REAL session (CLAUDE_CODE_CHILD_SESSION set by the env-leak, memory
+# iterm-relaunched-from-claude-leaks-child-session-env) paints automatically.
+# Gated so it CANNOT recurse (force already set) and CANNOT fire on a timeout
+# (124) or a non-child context; the engine's headless/nested refusal still holds
+# even under force, so this only reaches sessions whose ancestry owns a tty.
+if [ -n "${CLAUDE_CODE_CHILD_SESSION:-}" ] && [ -z "${CLAUDE_COLORDOTS_FORCE:-}" ]; then
+  # First attempt with stderr buffered — a bridge refusal here is expected and
+  # followed by the force retry, so we don't want its scary line on the console.
+  err="$(mktemp -t dotsh.XXXXXX)"
+  paint 2>"$err"
+  rc=$?
+  if [ "$rc" -ne 0 ] && [ "$rc" -ne 124 ]; then
+    export CLAUDE_COLORDOTS_FORCE=1
+    paint            # retry: its own stderr streams normally so a real failure shows
+    rc=$?
+  else
+    cat "$err" >&2   # first attempt already succeeded/timed out — surface its output
+  fi
+  rm -f "$err"
+else
+  paint
+  rc=$?
+fi
 
 # CHECK the paint result and SAY so — never a silent color change or failure.
 case "$rc" in

← f18d087 TK-11835: fail-fast cross-tty paint — a busy --tty target is  ·  back to Terminal Status  ·  TK-11831: cache discover()'s two ps enrichment calls (the pe 28cf4f6 →