Make control_timeout configurable via session opts#22
Make control_timeout configurable via session opts#22john-walter wants to merge 4 commits intoguess:mainfrom
Conversation
Allow overriding the 30s default control timeout by setting:
config :claude_code, control_timeout: 60_000
Falls back to the existing @control_timeout module attribute (30s)
when not configured.
|
We have encountered issues with the hardcoded value when using certain mcp servers that take longer to launch |
|
Thanks for the contribution @john-walter! A few things to address before merging:
|
Alright I 8000 updated it - by making the control timeout a session specific detail and not global does mean that the overarching genserver call timeout no longer can be something directly derived from a given session timeout. I just decided to set a sane upper limit (120s) for the happy path control timeout and defaulted the genserver timeout to be slightly higher than that. Let me know if you want a different approach here. In our particular case the mcp server init ranges between 25-50 seconds so fine with bringing the max down lower. I was considering making the client_control_exit_timeout configurable but it seems like its more of a failsafe implementation detail than something a user really should be aware of. |
|
Nice, thanks for the quick turnaround! Couple suggestions–
def send_control_request(adapter, subtype, params) do
GenServer.call(adapter, {:control_request, subtype, params}, :infinity)
enddef validate_control_timeout(value) when is_integer(value) and value > 0, do: {:ok, value}
def validate_control_timeout(value), do: {:error, "expected a positive integer, got: #{inspect(value)}"}
|
Allow overriding the 30s default control timeout via a session opt. Maintains a fixed upper limit to the user defined timeout (120s) to support the GenServer client exit timeout.