Skip to content

discuss: make the provider request timeout configurable (env + config) #786

Closed

Description

@ajianaz

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):

  1. env TOLE_DISCUSSION_TIMEOUT_SECS — seconds, must parse as u64 and be > 0
  2. config [discussions] request_timeout_secs — new user-config key
  3. default 120 — unchanged; fully backward compatible

Implementation shape (small, two touch points):

  • Settings gains request_timeout: Eff<u64> resolved through the standard resolve(...) path in config_apply.rs; config check reports 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 as reasoning_effort's effort_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.rs uses 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=600 is set; without it, the round still dies at 120s (behavior unchanged).

Out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions