MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / stream_idle_timeout_seconds

Function stream_idle_timeout_seconds

src/utils/stream_watchdog.py:46–61  ·  view source on GitHub ↗

Resolve the idle-timeout from ``CLAUDE_STREAM_IDLE_TIMEOUT_MS`` env var. Falls back to ``DEFAULT_STREAM_IDLE_TIMEOUT_S`` (90s) when the env var is unset or malformed. Mirrors TS ``claude.ts:1922``.

()

Source from the content-addressed store, hash-verified

44
45
46def stream_idle_timeout_seconds() -> float:
47 """Resolve the idle-timeout from ``CLAUDE_STREAM_IDLE_TIMEOUT_MS`` env var.
48
49 Falls back to ``DEFAULT_STREAM_IDLE_TIMEOUT_S`` (90s) when the env var
50 is unset or malformed. Mirrors TS ``claude.ts:1922``.
51 """
52 raw = os.environ.get("CLAUDE_STREAM_IDLE_TIMEOUT_MS", "").strip()
53 if not raw:
54 return DEFAULT_STREAM_IDLE_TIMEOUT_S
55 try:
56 ms = int(raw)
57 except (TypeError, ValueError):
58 return DEFAULT_STREAM_IDLE_TIMEOUT_S
59 if ms <= 0:
60 return DEFAULT_STREAM_IDLE_TIMEOUT_S
61 return ms / 1000.0
62
63
64class StreamIdleTimeout(Exception):

Calls 1

getMethod · 0.45