Skip to content

socket-client: bump default RPC timeout 3s → 30s for cold-start ccbd warmup#185

Closed
SevenX77 wants to merge 1 commit intobfly123:mainfrom
SevenX77:td-005-default-rpc-timeout-30s
Closed

socket-client: bump default RPC timeout 3s → 30s for cold-start ccbd warmup#185
SevenX77 wants to merge 1 commit intobfly123:mainfrom
SevenX77:td-005-default-rpc-timeout-30s

Conversation

@SevenX77
Copy link
Copy Markdown

Summary

Bump CcbdClient._resolve_timeout default from 3.0s30.0s (both fallback branches).

Why

ccbd cold-start warmup reliably takes 10–30 seconds in practice (first tmux session materialization + completion tracker state load + backend enumeration). The 3s default meant that the first ccb ask after ccb kill (or on a fresh machine) would routinely fail with socket_unreachable, surfacing a brittle workflow:

  • Users hit the error, retry manually, and eventually it works; OR
  • Users learn to export CCB_CCBD_CLIENT_TIMEOUT_S=60 as a permanent shell-level workaround (which is what we've been doing in a fork for weeks)

30s covers nearly all observed cold-starts while still being short enough that a truly unreachable ccbd is caught quickly.

Scope

  • lib/ccbd/socket_client.py:_resolve_timeout — two fallback return 3.0return 30.0
  • test/test_ccbd_socket_client.py::test_ccbd_client_uses_stable_default_timeout — assertion 3.030.0

What is unchanged

  • CCB_CCBD_CLIENT_TIMEOUT_S env override (still takes precedence over default)
  • Explicit timeout_s= kwarg precedence (overrides both env and default)
  • Callers passing timeout_s=0.2 for health probes (daemon_process.py, keeper_runtime/loop.py) — unaffected
  • max(0.1, ...) clamp — unaffected

Test plan

  • pytest test/test_ccbd_socket_client.py → 7 passed
  • pytest test/ full suite (clean env) → no new failures vs pre-change baseline on this branch's base (main @ 52f6d95). Confirmed by stashing the 4-line diff and re-running: identical pre-existing failure set before/after.

…t ccbd warmup

Root cause (TD-005): ccbd cold-start warmup often takes 10-30s (first
tmux session materialization + completion tracker state load), but
CcbdClient's 3s default client-side RPC timeout fails long before that.
Local fork used CCB_CCBD_CLIENT_TIMEOUT_S=60 as a workaround; upstreaming
the default bump so the env override isn't mandatory out of the box.

env override (CCB_CCBD_CLIENT_TIMEOUT_S) and explicit timeout_s= kwarg
precedence are unchanged. Existing callers that pass timeout_s=0.2
(daemon health probe in daemon_process.py) are unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bfly123
Copy link
Copy Markdown
Owner

bfly123 commented Apr 27, 2026

I give a deeper design to solve this problem, thank you !

@bfly123 bfly123 closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants