Skip to content

OpenSecret: increase non-streaming provider response-start timeout (REQUEST_TIMEOUT_SECS) from 120s to 300s #1741

In review

Description

@AnthonyRonning

Problem

In services/opensecret/src/web/openai.rs:

// Request timeout (generous for large non-streaming responses).
const REQUEST_TIMEOUT_SECS: u64 = 120;
// Providers may buffer a complete tool call before emitting its arguments.
// This is an idle read limit for every provider/model, not a total generation deadline.
const STREAM_CHUNK_TIMEOUT_SECS: u64 = 300;

PR #1167 (aed7081b) increased STREAM_CHUNK_TIMEOUT_SECS from 120 to 300 for streaming reads, but left REQUEST_TIMEOUT_SECS at 120 seconds.

REQUEST_TIMEOUT_SECS is passed as response_start_timeout into ProviderRequest::new (services/opensecret/src/web/openai.rs:4232-4236) and enforced around send (services/opensecret/src/provider_client.rs:1083-1086).

  • For streaming requests (stream: true), upstream providers return HTTP 200 headers immediately (sub-second TTFT), so only STREAM_CHUNK_TIMEOUT_SECS (300s idle) applies.
  • For non-streaming requests (stream: false / omitted), the upstream provider (vLLM / Tinfoil / Continuum) must finish the entire reasoning + completion before sending HTTP 200 headers. With long-reasoning / 1M-context models (like ergo, which has mandatory high reasoning and a 1M context window), large non-streaming completions easily exceed 120 seconds before headers are emitted.

Production observation

During the Day-0 ergo production soak (2026-12-02T02:55:54Z → 02:57:54Z, enclave-logs-prod), a non-streaming ergo chat completion (stream: None, max_tokens: Some(1048576)) timed out waiting for response headers:

ERROR opensecret::web::openai: Failed to send request to maple-i03: Timeout(120s)

Meanwhile, streaming ergo completions generating 60K–148K tokens over 10–25 minutes succeeded cleanly (763/763 HTTP 200 responses).

Proposal

  1. Evaluate raising REQUEST_TIMEOUT_SECS (or splitting streaming response-start timeout vs. non-streaming full-response timeout, e.g., 300s for non-streaming /v1/chat/completions, while keeping 120s or shorter for streaming response-start if desired).
  2. Double-check end-to-end proxy/edge timeouts (NGINX proxy_read_timeout, Cloudflare origin read timeout, socat) so clients actually benefit from a longer non-streaming window without hitting an intermediate proxy timeout first.

Activity

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