Repository navigation
Description
discuss: make the provider request timeout configurable (env + config)
Problem
OpenAiProvider::new() hard-codes a 120s global HTTP timeout (crates/tole-core/src/openai.rs, the build_chat_agent(Duration::from_secs(120)) default), and discussion_host::factory() never calls .with_timeout(). Every discussion provider call is therefore capped at 120s, with no config key and no env override anywhere (grep -rn "request_timeout\|timeout_global" crates/ finds only unrelated domains).
Consequence (found in real QA, #756): long multi-round discussions on reasoning models (e.g. GLM thinking) grow context every round, generation routinely exceeds 120s, and the round dies at timeout: global. Unblocking currently requires a locally patched binary.
Proposal
Make the discussion provider timeout configurable, using the house precedence (same pattern as TOLE_CONTEXT_WINDOW > config context_window > detect, #440):
- env
TOLE_DISCUSSION_TIMEOUT_SECS— seconds, must parse asu64and be> 0 - config
[discussions] request_timeout_secs— new user-config key - default
120— unchanged; fully backward compatible
Implementation shape (small, two touch points):
Settingsgainsrequest_timeout: Eff<u64>resolved through the standardresolve(...)path inconfig_apply.rs;config checkreports the resolved value and source like every other key.- An invalid env value (non-numeric or
0) is a startup error naming the env var — same spirit asreasoning_effort'seffort_error(feat(core): reasoning effort setting, sent as reasoning_effort #457). Silently ignoring a typo would quietly re-introduce the mystery 120s failure this issue exists to fix. discussion_host::factory()applies the resolved value via the existing.with_timeout(Duration::from_secs(n))builder — the knob already exists on the provider (doctor.rsuses it); discussions simply never pass one.
Validation
- Resolution tests in
config_apply_tests.rs: env beats config, config beats default, invalid env errors with the var name. - Factory test in
discussion_host_tests.rs: the built provider carries the configured timeout (default test pins 120s). - Real E2E: a discussion round that exceeds 120s completes when
TOLE_DISCUSSION_TIMEOUT_SECS=600is set; without it, the round still dies at 120s (behavior unchanged).
Out of scope
advisor_host::factory()shares the same 120s default — wiring the same knob there can be a separate issue if wanted.- Scribe retry-on-timeout and per-round timeout escalation ideas from discuss: provider calls use the 120s default timeout — long-context rounds on reasoning models always die at 'timeout: global' #756.
- A
--request-timeoutCLI flag (can be added later with the sameEffplumbing).
Activity
feat(discuss): retry a participant turn or scribe call once after a p…